OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/shell/shell_devtools_delegate.h" |
| 6 |
| 7 #include "base/stringprintf.h" |
| 8 #include "content/public/browser/android/devtools_auth.h" |
| 9 #include "content/public/browser/devtools_http_handler.h" |
| 10 #include "grit/shell_resources.h" |
| 11 #include "net/base/unix_domain_socket_posix.h" |
| 12 #include "net/url_request/url_request_context_getter.h" |
| 13 #include "ui/base/layout.h" |
| 14 #include "ui/base/resource/resource_bundle.h" |
| 15 |
| 16 namespace { |
| 17 |
| 18 // TODO(mnaganov): This hardcoded version should be replaced with the webkit |
| 19 // revision of this build of content shell. This requires a feature addition |
| 20 // to the devtools frontend. |
| 21 const char* kFrontendVersion = "21.0.1175.0"; |
| 22 const char kSocketName[] = "content_shell_devtools_remote"; |
| 23 const char kFrontEndURL[] = |
| 24 "http://chrome-devtools-frontend.appspot.com/static/%s/devtools.html"; |
| 25 |
| 26 } |
| 27 |
| 28 namespace content { |
| 29 |
| 30 ShellDevToolsDelegate::ShellDevToolsDelegate( |
| 31 int port, |
| 32 net::URLRequestContextGetter* context_getter) |
| 33 : context_getter_(context_getter) { |
| 34 devtools_http_handler_ = DevToolsHttpHandler::Start( |
| 35 new net::UnixDomainSocketWithAbstractNamespaceFactory( |
| 36 kSocketName, |
| 37 base::Bind(&CanUserConnectToDevTools)), |
| 38 StringPrintf(kFrontEndURL, kFrontendVersion), |
| 39 context_getter, |
| 40 this); |
| 41 } |
| 42 |
| 43 ShellDevToolsDelegate::~ShellDevToolsDelegate() { |
| 44 } |
| 45 |
| 46 void ShellDevToolsDelegate::Stop() { |
| 47 // The call below destroys this. |
| 48 devtools_http_handler_->Stop(); |
| 49 } |
| 50 |
| 51 std::string ShellDevToolsDelegate::GetDiscoveryPageHTML() { |
| 52 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 53 IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE, |
| 54 ui::SCALE_FACTOR_NONE).as_string(); |
| 55 } |
| 56 |
| 57 bool ShellDevToolsDelegate::BundlesFrontendResources() { |
| 58 return false; |
| 59 } |
| 60 |
| 61 std::string ShellDevToolsDelegate::GetFrontendResourcesBaseURL() { |
| 62 return ""; |
| 63 } |
| 64 |
| 65 } // namespace content |
OLD | NEW |