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 "base/guid.h" | |
9 #include "content/browser/devtools/devtools_protocol_handler.h" | 8 #include "content/browser/devtools/devtools_protocol_handler.h" |
10 #include "content/browser/devtools/protocol/browser_handler.h" | 9 #include "content/browser/devtools/protocol/browser_handler.h" |
11 #include "content/browser/devtools/protocol/io_handler.h" | 10 #include "content/browser/devtools/protocol/io_handler.h" |
12 #include "content/browser/devtools/protocol/memory_handler.h" | 11 #include "content/browser/devtools/protocol/memory_handler.h" |
13 #include "content/browser/devtools/protocol/system_info_handler.h" | 12 #include "content/browser/devtools/protocol/system_info_handler.h" |
14 #include "content/browser/devtools/protocol/tethering_handler.h" | 13 #include "content/browser/devtools/protocol/tethering_handler.h" |
15 #include "content/browser/devtools/protocol/tracing_handler.h" | 14 #include "content/browser/devtools/protocol/tracing_handler.h" |
16 #include "content/browser/frame_host/frame_tree_node.h" | 15 #include "content/browser/frame_host/frame_tree_node.h" |
17 | 16 |
18 namespace content { | 17 namespace content { |
19 | 18 |
20 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::CreateForBrowser( | 19 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::CreateForBrowser( |
21 scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner, | 20 scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner, |
22 const CreateServerSocketCallback& socket_callback) { | 21 const CreateServerSocketCallback& socket_callback) { |
23 return new BrowserDevToolsAgentHost(tethering_task_runner, socket_callback); | 22 return new BrowserDevToolsAgentHost(tethering_task_runner, socket_callback); |
24 } | 23 } |
25 | 24 |
26 BrowserDevToolsAgentHost::BrowserDevToolsAgentHost( | 25 BrowserDevToolsAgentHost::BrowserDevToolsAgentHost( |
27 scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner, | 26 scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner, |
28 const CreateServerSocketCallback& socket_callback) | 27 const CreateServerSocketCallback& socket_callback) |
29 : DevToolsAgentHostImpl(base::GenerateGUID()), | 28 : browser_handler_(new devtools::browser::BrowserHandler()), |
30 browser_handler_(new devtools::browser::BrowserHandler()), | |
31 io_handler_(new devtools::io::IOHandler(GetIOContext())), | 29 io_handler_(new devtools::io::IOHandler(GetIOContext())), |
32 memory_handler_(new devtools::memory::MemoryHandler()), | 30 memory_handler_(new devtools::memory::MemoryHandler()), |
33 system_info_handler_(new devtools::system_info::SystemInfoHandler()), | 31 system_info_handler_(new devtools::system_info::SystemInfoHandler()), |
34 tethering_handler_( | 32 tethering_handler_( |
35 new devtools::tethering::TetheringHandler(socket_callback, | 33 new devtools::tethering::TetheringHandler(socket_callback, |
36 tethering_task_runner)), | 34 tethering_task_runner)), |
37 tracing_handler_(new devtools::tracing::TracingHandler( | 35 tracing_handler_(new devtools::tracing::TracingHandler( |
38 devtools::tracing::TracingHandler::Browser, | 36 devtools::tracing::TracingHandler::Browser, |
39 FrameTreeNode::kFrameTreeNodeInvalidId, | 37 FrameTreeNode::kFrameTreeNodeInvalidId, |
40 GetIOContext())), | 38 GetIOContext())), |
41 protocol_handler_(new DevToolsProtocolHandler(this)) { | 39 protocol_handler_(new DevToolsProtocolHandler(this)) { |
42 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); | 40 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); |
43 dispatcher->SetBrowserHandler(browser_handler_.get()); | 41 dispatcher->SetBrowserHandler(browser_handler_.get()); |
44 dispatcher->SetIOHandler(io_handler_.get()); | 42 dispatcher->SetIOHandler(io_handler_.get()); |
45 dispatcher->SetMemoryHandler(memory_handler_.get()); | 43 dispatcher->SetMemoryHandler(memory_handler_.get()); |
46 dispatcher->SetSystemInfoHandler(system_info_handler_.get()); | 44 dispatcher->SetSystemInfoHandler(system_info_handler_.get()); |
47 dispatcher->SetTetheringHandler(tethering_handler_.get()); | 45 dispatcher->SetTetheringHandler(tethering_handler_.get()); |
48 dispatcher->SetTracingHandler(tracing_handler_.get()); | 46 dispatcher->SetTracingHandler(tracing_handler_.get()); |
49 } | 47 } |
50 | 48 |
51 BrowserDevToolsAgentHost::~BrowserDevToolsAgentHost() { | 49 BrowserDevToolsAgentHost::~BrowserDevToolsAgentHost() { |
52 } | 50 } |
53 | 51 |
54 void BrowserDevToolsAgentHost::Attach() { | 52 void BrowserDevToolsAgentHost::Attach() { |
55 } | 53 } |
56 | 54 |
57 void BrowserDevToolsAgentHost::Detach() { | 55 void BrowserDevToolsAgentHost::Detach() { |
58 } | 56 } |
59 | 57 |
60 std::string BrowserDevToolsAgentHost::GetType() { | 58 DevToolsAgentHost::Type BrowserDevToolsAgentHost::GetType() { |
61 return kTypeBrowser; | 59 return TYPE_BROWSER; |
62 } | 60 } |
63 | 61 |
64 std::string BrowserDevToolsAgentHost::GetTitle() { | 62 std::string BrowserDevToolsAgentHost::GetTitle() { |
65 return ""; | 63 return ""; |
66 } | 64 } |
67 | 65 |
68 GURL BrowserDevToolsAgentHost::GetURL() { | 66 GURL BrowserDevToolsAgentHost::GetURL() { |
69 return GURL(); | 67 return GURL(); |
70 } | 68 } |
71 | 69 |
72 bool BrowserDevToolsAgentHost::Activate() { | 70 bool BrowserDevToolsAgentHost::Activate() { |
73 return false; | 71 return false; |
74 } | 72 } |
75 | 73 |
76 bool BrowserDevToolsAgentHost::Inspect() { | |
77 return false; | |
78 } | |
79 | |
80 bool BrowserDevToolsAgentHost::Close() { | 74 bool BrowserDevToolsAgentHost::Close() { |
81 return false; | 75 return false; |
82 } | 76 } |
83 | 77 |
84 void BrowserDevToolsAgentHost::Reload() { | |
85 } | |
86 | |
87 bool BrowserDevToolsAgentHost::DispatchProtocolMessage( | 78 bool BrowserDevToolsAgentHost::DispatchProtocolMessage( |
88 const std::string& message) { | 79 const std::string& message) { |
89 protocol_handler_->HandleMessage(session_id(), message); | 80 protocol_handler_->HandleMessage(session_id(), message); |
90 return true; | 81 return true; |
91 } | 82 } |
92 | 83 |
93 } // content | 84 } // content |
OLD | NEW |