diff --git a/brightray/brightray.gyp b/brightray/brightray.gyp index 17057574e6..df52343db2 100644 --- a/brightray/brightray.gyp +++ b/brightray/brightray.gyp @@ -75,8 +75,6 @@ 'browser/platform_notification_service_impl.h', 'browser/linux/notification_presenter_linux.h', 'browser/linux/notification_presenter_linux.cc', - 'browser/remote_debugging_server.cc', - 'browser/remote_debugging_server.h', 'browser/url_request_context_getter.cc', 'browser/url_request_context_getter.h', 'browser/views/inspectable_web_contents_view_views.h', diff --git a/brightray/browser/browser_main_parts.cc b/brightray/browser/browser_main_parts.cc index 351bee9c98..de938eacd9 100644 --- a/brightray/browser/browser_main_parts.cc +++ b/brightray/browser/browser_main_parts.cc @@ -5,11 +5,12 @@ #include "browser/browser_main_parts.h" #include "browser/browser_context.h" -#include "browser/remote_debugging_server.h" +#include "browser/devtools_manager_delegate.h" #include "browser/web_ui_controller_factory.h" #include "base/command_line.h" #include "base/strings/string_number_conversions.h" +#include "content/public/browser/devtools_http_handler.h" #include "content/public/common/content_switches.h" #include "net/proxy/proxy_resolver_v8.h" @@ -125,16 +126,9 @@ void BrowserMainParts::PreMainMessageLoopRun() { web_ui_controller_factory_.get()); // --remote-debugging-port - base::CommandLine* command_line = CommandLine::ForCurrentProcess(); - if (command_line->HasSwitch(switches::kRemoteDebuggingPort)) { - std::string port_str = command_line->GetSwitchValueASCII(switches::kRemoteDebuggingPort); - int port; - if (base::StringToInt(port_str, &port) && port >= 0 && port < 65535) - remote_debugging_server_.reset( - new RemoteDebuggingServer("127.0.0.1", static_cast(port))); - else - DLOG(WARNING) << "Invalid http debugger port number " << port; - } + auto command_line = base::CommandLine::ForCurrentProcess(); + if (command_line->HasSwitch(switches::kRemoteDebuggingPort)) + devtools_http_handler_.reset(DevToolsManagerDelegate::CreateHttpHandler()); } void BrowserMainParts::PostMainMessageLoopRun() { diff --git a/brightray/browser/browser_main_parts.h b/brightray/browser/browser_main_parts.h index 3e52af4bd5..59674ef2e5 100644 --- a/brightray/browser/browser_main_parts.h +++ b/brightray/browser/browser_main_parts.h @@ -9,6 +9,10 @@ #include "base/memory/scoped_ptr.h" #include "content/public/browser/browser_main_parts.h" +namespace content { +class DevToolsHttpHandler; +} + #if defined(TOOLKIT_VIEWS) namespace brightray { class ViewsDelegate; @@ -25,7 +29,6 @@ namespace brightray { class BrowserContext; class WebUIControllerFactory; -class RemoteDebuggingServer; class BrowserMainParts : public content::BrowserMainParts { public: @@ -58,7 +61,7 @@ class BrowserMainParts : public content::BrowserMainParts { scoped_ptr browser_context_; scoped_ptr web_ui_controller_factory_; - scoped_ptr remote_debugging_server_; + scoped_ptr devtools_http_handler_; #if defined(TOOLKIT_VIEWS) scoped_ptr views_delegate_; diff --git a/brightray/browser/remote_debugging_server.cc b/brightray/browser/remote_debugging_server.cc deleted file mode 100644 index 9aa004c313..0000000000 --- a/brightray/browser/remote_debugging_server.cc +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE-CHROMIUM file. - -#include "browser/remote_debugging_server.h" - -#include "browser/devtools_manager_delegate.h" - -#include "base/files/file_util.h" -#include "content/public/browser/devtools_http_handler.h" -#include "net/socket/tcp_server_socket.h" - -namespace brightray { - -namespace { - -class TCPServerSocketFactory - : public content::DevToolsHttpHandler::ServerSocketFactory { - public: - TCPServerSocketFactory(const std::string& address, uint16 port, int backlog) - : content::DevToolsHttpHandler::ServerSocketFactory(address, port, backlog) {} - - private: - // content::DevToolsHttpHandler::ServerSocketFactory: - scoped_ptr Create() const override { - return scoped_ptr(new net::TCPServerSocket(NULL, net::NetLog::Source())); - } - - DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory); -}; - -} // namespace - -RemoteDebuggingServer::RemoteDebuggingServer(const std::string& ip, uint16 port) { - scoped_ptr factory( - new TCPServerSocketFactory(ip, port, 1)); - devtools_http_handler_ = DevToolsManagerDelegate::CreateHttpHandler(); -} - -RemoteDebuggingServer::~RemoteDebuggingServer() { - devtools_http_handler_->Stop(); -} - -} // namespace brightray diff --git a/brightray/browser/remote_debugging_server.h b/brightray/browser/remote_debugging_server.h deleted file mode 100644 index 89faf65730..0000000000 --- a/brightray/browser/remote_debugging_server.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE-CHROMIUM file. - -#ifndef BROWSER_REMOTE_DEBUGGING_SERVER_H_ -#define BROWSER_REMOTE_DEBUGGING_SERVER_H_ - -#include - -#include "base/basictypes.h" - -namespace content { -class DevToolsHttpHandler; -} - -namespace brightray { - -class RemoteDebuggingServer { - public: - RemoteDebuggingServer(const std::string& ip, uint16 port); - virtual ~RemoteDebuggingServer(); - - private: - content::DevToolsHttpHandler* devtools_http_handler_; - - DISALLOW_COPY_AND_ASSIGN(RemoteDebuggingServer); -}; - -} // namespace brightray - -#endif // BROWSER_REMOTE_DEBUGGING_SERVER_H_