devtools_discovery and devtools_http_handler are gone

This commit is contained in:
Cheng Zhao 2017-01-23 14:48:23 +09:00
parent f560fd56aa
commit eb89edbf5b
2 changed files with 18 additions and 29 deletions

View file

@ -15,11 +15,9 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "common/content_client.h"
#include "components/devtools_discovery/basic_target_descriptor.h"
#include "components/devtools_discovery/devtools_discovery_manager.h"
#include "components/devtools_http_handler/devtools_http_handler.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/devtools_frontend_host.h"
#include "content/public/browser/devtools_socket_factory.h"
#include "content/public/browser/favicon_status.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/common/content_switches.h"
@ -36,15 +34,14 @@ namespace brightray {
namespace {
class TCPServerSocketFactory
: public devtools_http_handler::DevToolsHttpHandler::ServerSocketFactory {
class TCPServerSocketFactory : public content::DevToolsSocketFactory {
public:
TCPServerSocketFactory(const std::string& address, int port)
: address_(address), port_(port) {
}
private:
// content::DevToolsHttpHandler::ServerSocketFactory.
// content::ServerSocketFactory.
std::unique_ptr<net::ServerSocket> CreateForHttpServer() override {
std::unique_ptr<net::ServerSocket> socket(
new net::TCPServerSocket(nullptr, net::NetLog::Source()));
@ -147,27 +144,23 @@ DevToolsManagerDelegate::CreateHttpHandler() {
DevToolsManagerDelegate::DevToolsManagerDelegate()
: handler_(new DevToolsNetworkProtocolHandler) {
// NB(zcbenz): This call does nothing, the only purpose is to make sure the
// devtools_discovery module is linked into the final executable on Linux.
// Though it is possible to achieve this by modifying the gyp settings, it
// would greatly increase gyp file's complexity, so I chose to instead do
// this hack.
devtools_discovery::DevToolsDiscoveryManager::GetInstance();
}
DevToolsManagerDelegate::~DevToolsManagerDelegate() {
}
void DevToolsManagerDelegate::DevToolsAgentStateChanged(
content::DevToolsAgentHost* agent_host,
bool attached) {
handler_->DevToolsAgentStateChanged(agent_host, attached);
void DevToolsManagerDelegate::Inspect(content::DevToolsAgentHost* agent_host) {
}
base::DictionaryValue* DevToolsManagerDelegate::HandleCommand(
content::DevToolsAgentHost* agent_host,
DevToolsAgentHost* agent_host,
base::DictionaryValue* command) {
return handler_->HandleCommand(agent_host, command);
}
scoped_refptr<content::DevToolsAgentHost>
DevToolsManagerDelegate::::CreateNewTarget(const GURL& url) {
return nullptr;
}
} // namespace brightray

View file

@ -7,31 +7,27 @@
#include "base/macros.h"
#include "base/compiler_specific.h"
#include "components/devtools_http_handler/devtools_http_handler_delegate.h"
#include "content/browser/devtools/devtools_http_handler.h"
#include "content/public/browser/devtools_manager_delegate.h"
namespace devtools_http_handler {
class DevToolsHttpHandler;
}
namespace brightray {
class DevToolsNetworkProtocolHandler;
class DevToolsManagerDelegate : public content::DevToolsManagerDelegate {
public:
static devtools_http_handler::DevToolsHttpHandler* CreateHttpHandler();
static content::DevToolsHttpHandler* CreateHttpHandler();
DevToolsManagerDelegate();
virtual ~DevToolsManagerDelegate();
// DevToolsManagerDelegate implementation.
void Inspect(content::BrowserContext* browser_context,
content::DevToolsAgentHost* agent_host) override {}
void DevToolsAgentStateChanged(content::DevToolsAgentHost* agent_host,
bool attached) override;
base::DictionaryValue* HandleCommand(content::DevToolsAgentHost* agent_host,
void Inspect(content::DevToolsAgentHost* agent_host) override;
base::DictionaryValue* HandleCommand(
content::DevToolsAgentHost* agent_host,
base::DictionaryValue* command) override;
scoped_refptr<content::DevToolsAgentHost> CreateNewTarget(
const GURL& url) override;
private:
std::unique_ptr<DevToolsNetworkProtocolHandler> handler_;