summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-14 15:05:55 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-14 15:05:55 +0000
commit9451f95f60c940d1357e23ddc243975143e860cd (patch)
treedf2498607ef9555aa18b0aae7436273e4cace82a /content
parentd1566aca0e35ff59ac4b76585e76d8a8c58a4bf9 (diff)
downloadchromium_src-9451f95f60c940d1357e23ddc243975143e860cd.zip
chromium_src-9451f95f60c940d1357e23ddc243975143e860cd.tar.gz
chromium_src-9451f95f60c940d1357e23ddc243975143e860cd.tar.bz2
Add --remote-debugging-port back to content_shell since nduca mentioned he wants to use it with Android.
BUG=90445 Review URL: https://chromiumcodereview.appspot.com/10829303 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151480 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/public/common/content_switches.cc3
-rw-r--r--content/public/common/content_switches.h1
-rw-r--r--content/shell/shell_browser_main_parts.cc21
-rw-r--r--content/shell/shell_devtools_delegate.cc3
-rw-r--r--content/shell/shell_devtools_delegate.h2
-rw-r--r--content/shell/shell_devtools_delegate_android.cc1
6 files changed, 28 insertions, 3 deletions
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc
index b30fc2366..2afce69 100644
--- a/content/public/common/content_switches.cc
+++ b/content/public/common/content_switches.cc
@@ -530,6 +530,9 @@ const char kProcessType[] = "type";
// Register Pepper plugins (see pepper_plugin_registry.cc for its format).
const char kRegisterPepperPlugins[] = "register-pepper-plugins";
+// Enables remote debug over HTTP on the specified port.
+const char kRemoteDebuggingPort[] = "remote-debugging-port";
+
// Causes the renderer process to throw an assertion on launch.
const char kRendererAssertTest[] = "renderer-assert-test";
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h
index dc0b57e..87b76bd 100644
--- a/content/public/common/content_switches.h
+++ b/content/public/common/content_switches.h
@@ -167,6 +167,7 @@ CONTENT_EXPORT extern const char kProcessPerSite[];
CONTENT_EXPORT extern const char kProcessPerTab[];
CONTENT_EXPORT extern const char kProcessType[];
CONTENT_EXPORT extern const char kRegisterPepperPlugins[];
+CONTENT_EXPORT extern const char kRemoteDebuggingPort[];
CONTENT_EXPORT extern const char kRendererAssertTest[];
extern const char kRendererCmdPrefix[];
CONTENT_EXPORT extern const char kRendererProcess[];
diff --git a/content/shell/shell_browser_main_parts.cc b/content/shell/shell_browser_main_parts.cc
index dabd00f..31f79a0 100644
--- a/content/shell/shell_browser_main_parts.cc
+++ b/content/shell/shell_browser_main_parts.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/message_loop.h"
+#include "base/string_number_conversions.h"
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "content/public/common/content_switches.h"
@@ -95,8 +96,26 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() {
Shell::PlatformInitialize();
net::NetModule::SetResourceProvider(PlatformResourceProvider);
+ int port = 0;
+// On android the port number isn't used.
+#if !defined(OS_ANDROID)
+ // See if the user specified a port on the command line (useful for
+ // automation). If not, use an ephemeral port by specifying 0.
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) {
+ int temp_port;
+ std::string port_str =
+ command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort);
+ if (base::StringToInt(port_str, &temp_port) &&
+ temp_port > 0 && temp_port < 65535) {
+ port = temp_port;
+ } else {
+ DLOG(WARNING) << "Invalid http debugger port number " << temp_port;
+ }
+ }
+#endif
devtools_delegate_ = new ShellDevToolsDelegate(
- browser_context_->GetRequestContext());
+ port, browser_context_->GetRequestContext());
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) {
Shell::CreateNewWindow(browser_context_.get(),
diff --git a/content/shell/shell_devtools_delegate.cc b/content/shell/shell_devtools_delegate.cc
index 27a2620..1c79ea1 100644
--- a/content/shell/shell_devtools_delegate.cc
+++ b/content/shell/shell_devtools_delegate.cc
@@ -14,10 +14,11 @@
namespace content {
ShellDevToolsDelegate::ShellDevToolsDelegate(
+ int port,
net::URLRequestContextGetter* context_getter)
: context_getter_(context_getter) {
devtools_http_handler_ = DevToolsHttpHandler::Start(
- new net::TCPListenSocketFactory("127.0.0.1", 0),
+ new net::TCPListenSocketFactory("127.0.0.1", port),
"",
context_getter_,
this);
diff --git a/content/shell/shell_devtools_delegate.h b/content/shell/shell_devtools_delegate.h
index 9cf3d13..d3d6319 100644
--- a/content/shell/shell_devtools_delegate.h
+++ b/content/shell/shell_devtools_delegate.h
@@ -21,7 +21,7 @@ class DevToolsHttpHandler;
class ShellDevToolsDelegate : public DevToolsHttpHandlerDelegate {
public:
- explicit ShellDevToolsDelegate(net::URLRequestContextGetter* context_getter);
+ ShellDevToolsDelegate(int port, net::URLRequestContextGetter* context_getter);
virtual ~ShellDevToolsDelegate();
// Stops http server.
diff --git a/content/shell/shell_devtools_delegate_android.cc b/content/shell/shell_devtools_delegate_android.cc
index a9f69bd..fd87fb3 100644
--- a/content/shell/shell_devtools_delegate_android.cc
+++ b/content/shell/shell_devtools_delegate_android.cc
@@ -28,6 +28,7 @@ const char kFrontEndURL[] =
namespace content {
ShellDevToolsDelegate::ShellDevToolsDelegate(
+ int port,
net::URLRequestContextGetter* context_getter)
: context_getter_(context_getter) {
devtools_http_handler_ = DevToolsHttpHandler::Start(