OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/devtools/remote_debugging_server.h" | 5 #include "chrome/browser/devtools/remote_debugging_server.h" |
6 | 6 |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "chrome/browser/devtools/browser_list_tabcontents_provider.h" | 8 #include "chrome/browser/devtools/browser_list_tabcontents_provider.h" |
9 #include "chrome/browser/ui/webui/devtools_ui.h" | 9 #include "chrome/browser/ui/webui/devtools_ui.h" |
10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
11 #include "content/public/browser/devtools_http_handler.h" | 11 #include "content/public/browser/devtools_http_handler.h" |
12 #include "net/socket/tcp_listen_socket.h" | 12 #include "net/socket/tcp_server_socket.h" |
13 | 13 |
14 RemoteDebuggingServer::RemoteDebuggingServer( | 14 RemoteDebuggingServer::RemoteDebuggingServer( |
15 chrome::HostDesktopType host_desktop_type, | 15 chrome::HostDesktopType host_desktop_type, |
16 const std::string& ip, | 16 const std::string& ip, |
17 int port) { | 17 int port) { |
18 base::FilePath output_dir; | 18 base::FilePath output_dir; |
19 if (!port) { | 19 if (!port) { |
20 // The client requested an ephemeral port. Must write the selected | 20 // The client requested an ephemeral port. Must write the selected |
21 // port to a well-known location in the profile directory to | 21 // port to a well-known location in the profile directory to |
22 // bootstrap the connection process. | 22 // bootstrap the connection process. |
23 bool result = PathService::Get(chrome::DIR_USER_DATA, &output_dir); | 23 bool result = PathService::Get(chrome::DIR_USER_DATA, &output_dir); |
24 DCHECK(result); | 24 DCHECK(result); |
25 } | 25 } |
26 | 26 |
| 27 scoped_ptr<net::ServerSocketFactory> factory( |
| 28 new net::TCPServerSocketFactory()); |
| 29 factory->SetAddressAndPort(ip, port); |
27 devtools_http_handler_ = content::DevToolsHttpHandler::Start( | 30 devtools_http_handler_ = content::DevToolsHttpHandler::Start( |
28 new net::TCPListenSocketFactory(ip, port), | 31 factory.Pass(), |
29 "", | 32 "", |
30 new BrowserListTabContentsProvider(host_desktop_type), | 33 new BrowserListTabContentsProvider(host_desktop_type), |
31 output_dir); | 34 output_dir); |
32 } | 35 } |
33 | 36 |
34 RemoteDebuggingServer::~RemoteDebuggingServer() { | 37 RemoteDebuggingServer::~RemoteDebuggingServer() { |
35 devtools_http_handler_->Stop(); | 38 devtools_http_handler_->Stop(); |
36 } | 39 } |
OLD | NEW |