diff options
author | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-07 12:52:20 +0000 |
---|---|---|
committer | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-07 12:52:20 +0000 |
commit | 689266de8e05d61c7a17ecd48571a0279a69b588 (patch) | |
tree | bd978d3c1e5613cf6ca9a45c4ec375384faa6177 /content/shell/shell_devtools_delegate_android.cc | |
parent | 7c0edc0e965fb9db8153f7bd391a384a64c10c24 (diff) | |
download | chromium_src-689266de8e05d61c7a17ecd48571a0279a69b588.zip chromium_src-689266de8e05d61c7a17ecd48571a0279a69b588.tar.gz chromium_src-689266de8e05d61c7a17ecd48571a0279a69b588.tar.bz2 |
Simplify devtools code on android and enable devtools for android content_shell.
This CL removes the unnecessary RemoteDebuggingcontroller java class and associated
c++ code. Also devtools_server.* is moved from content/ to chrome/ so that the
code to access profiles, version etc. can be handled here to make DevToolsServer
a self contained class in chrome/ layer handling devtools for android. The code
making use of this class is not yet ready to be upstreamed due to dependencies
and will land in future.
Also added shell_devtools_delegate_android.cc to enable devtools for content_shell
on android. This class and chrome/browser/android/devtools_server.cc need a
common place to put the IsUserAllowedToConnect method that ensures only adb is
allowed to access devtools on android (via the abstract unix socket, for security
purposes) hence that method is placed in DevToolsHttpHandler in content/
BUG=136682,136318
TEST=manual. Run android content shell, execute "adb forward tcp:9222 localabstract:content_shell_devtools_remote" and open "localhost:9222" on the host machine to use devtools.
Review URL: https://chromiumcodereview.appspot.com/10832112
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150336 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell/shell_devtools_delegate_android.cc')
-rw-r--r-- | content/shell/shell_devtools_delegate_android.cc | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/content/shell/shell_devtools_delegate_android.cc b/content/shell/shell_devtools_delegate_android.cc new file mode 100644 index 0000000..fd87fb3 --- /dev/null +++ b/content/shell/shell_devtools_delegate_android.cc @@ -0,0 +1,65 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/shell/shell_devtools_delegate.h" + +#include "base/stringprintf.h" +#include "content/public/browser/android/devtools_auth.h" +#include "content/public/browser/devtools_http_handler.h" +#include "grit/shell_resources.h" +#include "net/base/unix_domain_socket_posix.h" +#include "net/url_request/url_request_context_getter.h" +#include "ui/base/layout.h" +#include "ui/base/resource/resource_bundle.h" + +namespace { + +// TODO(mnaganov): This hardcoded version should be replaced with the webkit +// revision of this build of content shell. This requires a feature addition +// to the devtools frontend. +const char* kFrontendVersion = "21.0.1175.0"; +const char kSocketName[] = "content_shell_devtools_remote"; +const char kFrontEndURL[] = + "http://chrome-devtools-frontend.appspot.com/static/%s/devtools.html"; + +} + +namespace content { + +ShellDevToolsDelegate::ShellDevToolsDelegate( + int port, + net::URLRequestContextGetter* context_getter) + : context_getter_(context_getter) { + devtools_http_handler_ = DevToolsHttpHandler::Start( + new net::UnixDomainSocketWithAbstractNamespaceFactory( + kSocketName, + base::Bind(&CanUserConnectToDevTools)), + StringPrintf(kFrontEndURL, kFrontendVersion), + context_getter, + this); +} + +ShellDevToolsDelegate::~ShellDevToolsDelegate() { +} + +void ShellDevToolsDelegate::Stop() { + // The call below destroys this. + devtools_http_handler_->Stop(); +} + +std::string ShellDevToolsDelegate::GetDiscoveryPageHTML() { + return ResourceBundle::GetSharedInstance().GetRawDataResource( + IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE, + ui::SCALE_FACTOR_NONE).as_string(); +} + +bool ShellDevToolsDelegate::BundlesFrontendResources() { + return false; +} + +std::string ShellDevToolsDelegate::GetFrontendResourcesBaseURL() { + return ""; +} + +} // namespace content |