Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1648)

Unified Diff: content/shell/browser/shell_devtools_frontend.cc

Issue 2295623002: DevTools: simplify http handler delegate as it is moving into content. (Closed)
Patch Set: lcean Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/shell/browser/shell_devtools_frontend.cc
diff --git a/content/shell/browser/shell_devtools_frontend.cc b/content/shell/browser/shell_devtools_frontend.cc
index 9b597db955a4c32bf9315e007a63d3e7645f3685..1e6695d1aaf02327889d31517872a72070c006dd 100644
--- a/content/shell/browser/shell_devtools_frontend.cc
+++ b/content/shell/browser/shell_devtools_frontend.cc
@@ -22,6 +22,7 @@
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_client.h"
+#include "content/public/common/content_switches.h"
#include "content/shell/browser/shell.h"
#include "content/shell/browser/shell_browser_context.h"
#include "content/shell/browser/shell_browser_main_parts.h"
@@ -97,6 +98,25 @@ int ResponseWriter::Finish(const net::CompletionCallback& callback) {
return net::OK;
}
+static GURL GetFrontendURL() {
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
+ uint16_t port = 0;
+ 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 = static_cast<uint16_t>(temp_port);
+ } else {
+ DLOG(WARNING) << "Invalid http debugger port number " << temp_port;
+ }
+ }
+ return GURL(
+ base::StringPrintf("http://127.0.0.1:%d/devtools/inspector.html", port));
+}
+
} // namespace
// This constant should be in sync with
@@ -113,13 +133,7 @@ ShellDevToolsFrontend* ShellDevToolsFrontend::Show(
ShellDevToolsFrontend* devtools_frontend = new ShellDevToolsFrontend(
shell,
inspected_contents);
-
- devtools_http_handler::DevToolsHttpHandler* http_handler =
- ShellContentBrowserClient::Get()
- ->shell_browser_main_parts()
- ->devtools_http_handler();
- shell->LoadURL(http_handler->GetFrontendURL("/devtools/inspector.html"));
-
+ shell->LoadURL(GetFrontendURL());
return devtools_frontend;
}
« no previous file with comments | « content/public/browser/devtools_socket_factory.h ('k') | content/shell/browser/shell_devtools_manager_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698