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 "content/shell/shell_devtools_delegate.h" | 5 #include "content/shell/shell_devtools_delegate.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "content/public/browser/devtools_http_handler.h" | 9 #include "content/public/browser/devtools_http_handler.h" |
10 #include "grit/shell_resources.h" | 10 #include "grit/shell_resources.h" |
| 11 #include "net/base/tcp_listen_socket.h" |
11 #include "net/url_request/url_request_context_getter.h" | 12 #include "net/url_request/url_request_context_getter.h" |
12 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 | 16 |
16 ShellDevToolsDelegate::ShellDevToolsDelegate( | 17 ShellDevToolsDelegate::ShellDevToolsDelegate( |
17 int port, | 18 int port, |
18 net::URLRequestContextGetter* context_getter) | 19 net::URLRequestContextGetter* context_getter) |
19 : context_getter_(context_getter) { | 20 : context_getter_(context_getter) { |
20 devtools_http_handler_ = DevToolsHttpHandler::Start( | 21 devtools_http_handler_ = DevToolsHttpHandler::Start( |
21 "127.0.0.1", | 22 new net::TCPListenSocketFactory("127.0.0.1", port), |
22 port, | |
23 "", | 23 "", |
24 context_getter_, | 24 context_getter_, |
25 this); | 25 this); |
26 } | 26 } |
27 | 27 |
28 ShellDevToolsDelegate::~ShellDevToolsDelegate() { | 28 ShellDevToolsDelegate::~ShellDevToolsDelegate() { |
29 } | 29 } |
30 | 30 |
31 void ShellDevToolsDelegate::Stop() { | 31 void ShellDevToolsDelegate::Stop() { |
32 // The call below destroys this. | 32 // The call below destroys this. |
33 devtools_http_handler_->Stop(); | 33 devtools_http_handler_->Stop(); |
34 } | 34 } |
35 | 35 |
36 std::string ShellDevToolsDelegate::GetDiscoveryPageHTML() { | 36 std::string ShellDevToolsDelegate::GetDiscoveryPageHTML() { |
37 return ResourceBundle::GetSharedInstance().GetRawDataResource( | 37 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
38 IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE).as_string(); | 38 IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE).as_string(); |
39 } | 39 } |
40 | 40 |
41 bool ShellDevToolsDelegate::BundlesFrontendResources() { | 41 bool ShellDevToolsDelegate::BundlesFrontendResources() { |
42 return true; | 42 return true; |
43 } | 43 } |
44 | 44 |
45 std::string ShellDevToolsDelegate::GetFrontendResourcesBaseURL() { | 45 std::string ShellDevToolsDelegate::GetFrontendResourcesBaseURL() { |
46 return ""; | 46 return ""; |
47 } | 47 } |
48 | 48 |
49 } // namespace content | 49 } // namespace content |
OLD | NEW |