Remove RemoteDebuggingServer class

This commit is contained in:
Cheng Zhao 2015-03-08 19:53:37 -07:00
parent 2837b730f2
commit f04ee342ea
5 changed files with 10 additions and 90 deletions

View file

@ -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',

View file

@ -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<uint16>(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() {

View file

@ -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<BrowserContext> browser_context_;
scoped_ptr<WebUIControllerFactory> web_ui_controller_factory_;
scoped_ptr<RemoteDebuggingServer> remote_debugging_server_;
scoped_ptr<content::DevToolsHttpHandler> devtools_http_handler_;
#if defined(TOOLKIT_VIEWS)
scoped_ptr<ViewsDelegate> views_delegate_;

View file

@ -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<net::ServerSocket> Create() const override {
return scoped_ptr<net::ServerSocket>(new net::TCPServerSocket(NULL, net::NetLog::Source()));
}
DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory);
};
} // namespace
RemoteDebuggingServer::RemoteDebuggingServer(const std::string& ip, uint16 port) {
scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory> factory(
new TCPServerSocketFactory(ip, port, 1));
devtools_http_handler_ = DevToolsManagerDelegate::CreateHttpHandler();
}
RemoteDebuggingServer::~RemoteDebuggingServer() {
devtools_http_handler_->Stop();
}
} // namespace brightray

View file

@ -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 <string>
#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_