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 "base/stringprintf.h" |
8 | |
9 #include "content/public/browser/devtools_http_handler.h" | 8 #include "content/public/browser/devtools_http_handler.h" |
10 #include "grit/shell_resources.h" | 9 #include "grit/shell_resources.h" |
11 #include "net/base/tcp_listen_socket.h" | 10 #include "net/base/unix_domain_socket_posix.h" |
12 #include "net/url_request/url_request_context_getter.h" | 11 #include "net/url_request/url_request_context_getter.h" |
13 #include "ui/base/layout.h" | 12 #include "ui/base/layout.h" |
14 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
15 | 14 |
15 namespace { | |
16 | |
17 // TODO(mnaganov): This hardcoded version should be replaced with the webkit | |
18 // revision of this build of content shell. This requires a feature addition | |
19 // to the devtools frontend. | |
20 const char* kFrontendVersion = "21.0.1175.0"; | |
pfeldman
2012/08/02 17:05:50
I don't see how this requires an additional featur
mnaganov (inactive)
2012/08/02 17:09:57
I remember we have discussed this and have agreed
pfeldman
2012/08/02 17:37:53
Sounds good.
| |
21 const char kSocketName[] = "content_shell_devtools_remote"; | |
22 const char kFrontEndURL[] = | |
23 "http://chrome-devtools-frontend.appspot.com/static/%s/devtools.html"; | |
24 | |
25 } | |
26 | |
16 namespace content { | 27 namespace content { |
17 | 28 |
18 ShellDevToolsDelegate::ShellDevToolsDelegate( | 29 ShellDevToolsDelegate::ShellDevToolsDelegate( |
19 int port, | 30 int port, |
20 net::URLRequestContextGetter* context_getter) | 31 net::URLRequestContextGetter* context_getter) |
21 : context_getter_(context_getter) { | 32 : context_getter_(context_getter) { |
22 devtools_http_handler_ = DevToolsHttpHandler::Start( | 33 devtools_http_handler_ = DevToolsHttpHandler::Start( |
23 new net::TCPListenSocketFactory("127.0.0.1", port), | 34 new net::UnixDomainSocketWithAbstractNamespaceFactory( |
24 "", | 35 kSocketName, |
25 context_getter_, | 36 base::Bind(&DevToolsHttpHandler::IsUserAllowedToConnect)), |
pfeldman
2012/08/02 17:05:50
Could you define IsUserAllowedToConnect locally?
Satish
2012/08/02 17:17:53
I could, but it is also used by chrome/browser/and
| |
37 StringPrintf(kFrontEndURL, kFrontendVersion), | |
38 context_getter, | |
26 this); | 39 this); |
27 } | 40 } |
28 | 41 |
29 ShellDevToolsDelegate::~ShellDevToolsDelegate() { | 42 ShellDevToolsDelegate::~ShellDevToolsDelegate() { |
30 } | 43 } |
31 | 44 |
32 void ShellDevToolsDelegate::Stop() { | 45 void ShellDevToolsDelegate::Stop() { |
33 // The call below destroys this. | 46 // The call below destroys this. |
34 devtools_http_handler_->Stop(); | 47 devtools_http_handler_->Stop(); |
35 } | 48 } |
36 | 49 |
37 std::string ShellDevToolsDelegate::GetDiscoveryPageHTML() { | 50 std::string ShellDevToolsDelegate::GetDiscoveryPageHTML() { |
38 return ResourceBundle::GetSharedInstance().GetRawDataResource( | 51 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
39 IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE, | 52 IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE, |
40 ui::SCALE_FACTOR_NONE).as_string(); | 53 ui::SCALE_FACTOR_NONE).as_string(); |
41 } | 54 } |
42 | 55 |
43 bool ShellDevToolsDelegate::BundlesFrontendResources() { | 56 bool ShellDevToolsDelegate::BundlesFrontendResources() { |
44 return true; | 57 return false; |
45 } | 58 } |
46 | 59 |
47 std::string ShellDevToolsDelegate::GetFrontendResourcesBaseURL() { | 60 std::string ShellDevToolsDelegate::GetFrontendResourcesBaseURL() { |
48 return ""; | 61 return ""; |
49 } | 62 } |
50 | 63 |
51 } // namespace content | 64 } // namespace content |
OLD | NEW |