| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/devtools/browser_devtools_agent_host.h" | 5 #include "content/browser/devtools/browser_devtools_agent_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "content/browser/devtools/devtools_protocol_handler.h" | 8 #include "content/browser/devtools/devtools_protocol_handler.h" |
| 9 #include "content/browser/devtools/protocol/io_handler.h" |
| 9 #include "content/browser/devtools/protocol/system_info_handler.h" | 10 #include "content/browser/devtools/protocol/system_info_handler.h" |
| 10 #include "content/browser/devtools/protocol/tethering_handler.h" | 11 #include "content/browser/devtools/protocol/tethering_handler.h" |
| 11 #include "content/browser/devtools/protocol/tracing_handler.h" | 12 #include "content/browser/devtools/protocol/tracing_handler.h" |
| 12 | 13 |
| 13 namespace content { | 14 namespace content { |
| 14 | 15 |
| 15 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::CreateForBrowser( | 16 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::CreateForBrowser( |
| 16 scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner, | 17 scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner, |
| 17 const CreateServerSocketCallback& socket_callback) { | 18 const CreateServerSocketCallback& socket_callback) { |
| 18 return new BrowserDevToolsAgentHost(tethering_task_runner, socket_callback); | 19 return new BrowserDevToolsAgentHost(tethering_task_runner, socket_callback); |
| 19 } | 20 } |
| 20 | 21 |
| 21 BrowserDevToolsAgentHost::BrowserDevToolsAgentHost( | 22 BrowserDevToolsAgentHost::BrowserDevToolsAgentHost( |
| 22 scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner, | 23 scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner, |
| 23 const CreateServerSocketCallback& socket_callback) | 24 const CreateServerSocketCallback& socket_callback) |
| 24 : system_info_handler_(new devtools::system_info::SystemInfoHandler()), | 25 : io_handler_(new devtools::io::IOHandler(GetIOContext())), |
| 26 system_info_handler_(new devtools::system_info::SystemInfoHandler()), |
| 25 tethering_handler_( | 27 tethering_handler_( |
| 26 new devtools::tethering::TetheringHandler(socket_callback, | 28 new devtools::tethering::TetheringHandler(socket_callback, |
| 27 tethering_task_runner)), | 29 tethering_task_runner)), |
| 28 tracing_handler_(new devtools::tracing::TracingHandler( | 30 tracing_handler_(new devtools::tracing::TracingHandler( |
| 29 devtools::tracing::TracingHandler::Browser)), | 31 devtools::tracing::TracingHandler::Browser, GetIOContext())), |
| 30 protocol_handler_(new DevToolsProtocolHandler( | 32 protocol_handler_(new DevToolsProtocolHandler( |
| 31 this, | 33 this, |
| 32 base::Bind(&BrowserDevToolsAgentHost::SendMessageToClient, | 34 base::Bind(&BrowserDevToolsAgentHost::SendMessageToClient, |
| 33 base::Unretained(this)))) { | 35 base::Unretained(this)))) { |
| 34 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); | 36 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); |
| 35 dispatcher->SetSystemInfoHandler(system_info_handler_.get()); | 37 dispatcher->SetSystemInfoHandler(system_info_handler_.get()); |
| 36 dispatcher->SetTetheringHandler(tethering_handler_.get()); | 38 dispatcher->SetTetheringHandler(tethering_handler_.get()); |
| 37 dispatcher->SetTracingHandler(tracing_handler_.get()); | 39 dispatcher->SetTracingHandler(tracing_handler_.get()); |
| 40 dispatcher->SetIOHandler(io_handler_.get()); |
| 38 } | 41 } |
| 39 | 42 |
| 40 BrowserDevToolsAgentHost::~BrowserDevToolsAgentHost() { | 43 BrowserDevToolsAgentHost::~BrowserDevToolsAgentHost() { |
| 41 } | 44 } |
| 42 | 45 |
| 43 void BrowserDevToolsAgentHost::Attach() { | 46 void BrowserDevToolsAgentHost::Attach() { |
| 44 } | 47 } |
| 45 | 48 |
| 46 void BrowserDevToolsAgentHost::Detach() { | 49 void BrowserDevToolsAgentHost::Detach() { |
| 47 } | 50 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 66 return false; | 69 return false; |
| 67 } | 70 } |
| 68 | 71 |
| 69 bool BrowserDevToolsAgentHost::DispatchProtocolMessage( | 72 bool BrowserDevToolsAgentHost::DispatchProtocolMessage( |
| 70 const std::string& message) { | 73 const std::string& message) { |
| 71 protocol_handler_->HandleMessage(message); | 74 protocol_handler_->HandleMessage(message); |
| 72 return true; | 75 return true; |
| 73 } | 76 } |
| 74 | 77 |
| 75 } // content | 78 } // content |
| OLD | NEW |