OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/debugger/devtools_protocol_handler.h" | 5 #include "content/browser/debugger/devtools_protocol_handler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/browser/content_browser_client.h" |
8 #include "content/browser/debugger/inspectable_tab_proxy.h" | 9 #include "content/browser/debugger/inspectable_tab_proxy.h" |
9 #include "content/browser/debugger/debugger_remote_service.h" | 10 #include "content/browser/debugger/debugger_remote_service.h" |
10 #include "content/browser/debugger/devtools_remote_message.h" | 11 #include "content/browser/debugger/devtools_remote_message.h" |
11 #include "content/browser/debugger/devtools_remote_listen_socket.h" | 12 #include "content/browser/debugger/devtools_remote_listen_socket.h" |
12 #include "content/browser/debugger/devtools_remote_service.h" | 13 #include "content/browser/debugger/devtools_remote_service.h" |
13 #include "content/browser/debugger/extension_ports_remote_service.h" | |
14 #include "content/browser/browser_thread.h" | 14 #include "content/browser/browser_thread.h" |
| 15 #include "content/common/content_client.h" |
15 | 16 |
16 // static | 17 // static |
17 scoped_refptr<DevToolsProtocolHandler> DevToolsProtocolHandler::Start( | 18 scoped_refptr<DevToolsProtocolHandler> DevToolsProtocolHandler::Start( |
18 int port) { | 19 int port) { |
19 scoped_refptr<DevToolsProtocolHandler> proto_handler = | 20 scoped_refptr<DevToolsProtocolHandler> proto_handler = |
20 new DevToolsProtocolHandler(port); | 21 new DevToolsProtocolHandler(port); |
21 proto_handler->RegisterDestination( | 22 proto_handler->RegisterDestination( |
22 new DevToolsRemoteService(proto_handler), | 23 new DevToolsRemoteService(proto_handler), |
23 DevToolsRemoteService::kToolName); | 24 DevToolsRemoteService::kToolName); |
24 proto_handler->RegisterDestination( | 25 proto_handler->RegisterDestination( |
25 new DebuggerRemoteService(proto_handler), | 26 new DebuggerRemoteService(proto_handler), |
26 DebuggerRemoteService::kToolName); | 27 DebuggerRemoteService::kToolName); |
27 proto_handler->RegisterDestination( | 28 |
28 new ExtensionPortsRemoteService(proto_handler), | 29 content::GetContentClient()->browser()->RegisterDevToolsRemoteListeners( |
29 ExtensionPortsRemoteService::kToolName); | 30 proto_handler); |
| 31 |
30 proto_handler->Start(); | 32 proto_handler->Start(); |
31 return proto_handler; | 33 return proto_handler; |
32 } | 34 } |
33 | 35 |
34 DevToolsProtocolHandler::DevToolsProtocolHandler(int port) | 36 DevToolsProtocolHandler::DevToolsProtocolHandler(int port) |
35 : port_(port), | 37 : port_(port), |
36 connection_(NULL), | 38 connection_(NULL), |
37 server_(NULL) { | 39 server_(NULL) { |
38 inspectable_tab_proxy_.reset(new InspectableTabProxy); | 40 inspectable_tab_proxy_.reset(new InspectableTabProxy); |
39 } | 41 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 for (ToolToListenerMap::const_iterator it = tool_to_listener_map_.begin(), | 119 for (ToolToListenerMap::const_iterator it = tool_to_listener_map_.begin(), |
118 end = tool_to_listener_map_.end(); | 120 end = tool_to_listener_map_.end(); |
119 it != end; | 121 it != end; |
120 ++it) { | 122 ++it) { |
121 BrowserThread::PostTask( | 123 BrowserThread::PostTask( |
122 BrowserThread::UI, FROM_HERE, | 124 BrowserThread::UI, FROM_HERE, |
123 NewRunnableMethod( | 125 NewRunnableMethod( |
124 it->second.get(), &DevToolsRemoteListener::OnConnectionLost)); | 126 it->second.get(), &DevToolsRemoteListener::OnConnectionLost)); |
125 } | 127 } |
126 } | 128 } |
OLD | NEW |