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