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/browser_handler.h" |
9 #include "content/browser/devtools/protocol/io_handler.h" | 10 #include "content/browser/devtools/protocol/io_handler.h" |
10 #include "content/browser/devtools/protocol/memory_handler.h" | 11 #include "content/browser/devtools/protocol/memory_handler.h" |
11 #include "content/browser/devtools/protocol/system_info_handler.h" | 12 #include "content/browser/devtools/protocol/system_info_handler.h" |
12 #include "content/browser/devtools/protocol/tethering_handler.h" | 13 #include "content/browser/devtools/protocol/tethering_handler.h" |
13 #include "content/browser/devtools/protocol/tracing_handler.h" | 14 #include "content/browser/devtools/protocol/tracing_handler.h" |
14 #include "content/browser/frame_host/frame_tree_node.h" | 15 #include "content/browser/frame_host/frame_tree_node.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 | 18 |
18 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::CreateForBrowser( | 19 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::CreateForBrowser( |
19 scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner, | 20 scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner, |
20 const CreateServerSocketCallback& socket_callback) { | 21 const CreateServerSocketCallback& socket_callback) { |
21 return new BrowserDevToolsAgentHost(tethering_task_runner, socket_callback); | 22 return new BrowserDevToolsAgentHost(tethering_task_runner, socket_callback); |
22 } | 23 } |
23 | 24 |
24 BrowserDevToolsAgentHost::BrowserDevToolsAgentHost( | 25 BrowserDevToolsAgentHost::BrowserDevToolsAgentHost( |
25 scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner, | 26 scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner, |
26 const CreateServerSocketCallback& socket_callback) | 27 const CreateServerSocketCallback& socket_callback) |
27 : io_handler_(new devtools::io::IOHandler(GetIOContext())), | 28 : browser_handler_(new devtools::browser::BrowserHandler()), |
| 29 io_handler_(new devtools::io::IOHandler(GetIOContext())), |
28 memory_handler_(new devtools::memory::MemoryHandler()), | 30 memory_handler_(new devtools::memory::MemoryHandler()), |
29 system_info_handler_(new devtools::system_info::SystemInfoHandler()), | 31 system_info_handler_(new devtools::system_info::SystemInfoHandler()), |
30 tethering_handler_( | 32 tethering_handler_( |
31 new devtools::tethering::TetheringHandler(socket_callback, | 33 new devtools::tethering::TetheringHandler(socket_callback, |
32 tethering_task_runner)), | 34 tethering_task_runner)), |
33 tracing_handler_(new devtools::tracing::TracingHandler( | 35 tracing_handler_(new devtools::tracing::TracingHandler( |
34 devtools::tracing::TracingHandler::Browser, | 36 devtools::tracing::TracingHandler::Browser, |
35 FrameTreeNode::kFrameTreeNodeInvalidId, | 37 FrameTreeNode::kFrameTreeNodeInvalidId, |
36 GetIOContext())), | 38 GetIOContext())), |
37 protocol_handler_(new DevToolsProtocolHandler(this)) { | 39 protocol_handler_(new DevToolsProtocolHandler(this)) { |
38 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); | 40 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); |
| 41 dispatcher->SetBrowserHandler(browser_handler_.get()); |
39 dispatcher->SetIOHandler(io_handler_.get()); | 42 dispatcher->SetIOHandler(io_handler_.get()); |
40 dispatcher->SetMemoryHandler(memory_handler_.get()); | 43 dispatcher->SetMemoryHandler(memory_handler_.get()); |
41 dispatcher->SetSystemInfoHandler(system_info_handler_.get()); | 44 dispatcher->SetSystemInfoHandler(system_info_handler_.get()); |
42 dispatcher->SetTetheringHandler(tethering_handler_.get()); | 45 dispatcher->SetTetheringHandler(tethering_handler_.get()); |
43 dispatcher->SetTracingHandler(tracing_handler_.get()); | 46 dispatcher->SetTracingHandler(tracing_handler_.get()); |
44 } | 47 } |
45 | 48 |
46 BrowserDevToolsAgentHost::~BrowserDevToolsAgentHost() { | 49 BrowserDevToolsAgentHost::~BrowserDevToolsAgentHost() { |
47 } | 50 } |
48 | 51 |
(...skipping 23 matching lines...) Expand all Loading... |
72 return false; | 75 return false; |
73 } | 76 } |
74 | 77 |
75 bool BrowserDevToolsAgentHost::DispatchProtocolMessage( | 78 bool BrowserDevToolsAgentHost::DispatchProtocolMessage( |
76 const std::string& message) { | 79 const std::string& message) { |
77 protocol_handler_->HandleMessage(session_id(), message); | 80 protocol_handler_->HandleMessage(session_id(), message); |
78 return true; | 81 return true; |
79 } | 82 } |
80 | 83 |
81 } // content | 84 } // content |
OLD | NEW |