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

Side by Side Diff: chrome/browser/devtools/remote_debugging_server.cc

Issue 2458033003: DevTools: introduce --custom-devtools-frontend flag. (Closed)
Patch Set: propogate devtools experiments query parameter Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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 "chrome/browser/devtools/remote_debugging_server.h" 5 #include "chrome/browser/devtools/remote_debugging_server.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h"
9 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
12 #include "base/path_service.h" 13 #include "base/path_service.h"
13 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
14 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/devtools/devtools_window.h" 16 #include "chrome/browser/devtools/devtools_window.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/browser_list.h" 19 #include "chrome/browser/ui/browser_list.h"
19 #include "chrome/common/chrome_content_client.h" 20 #include "chrome/common/chrome_content_client.h"
20 #include "chrome/common/chrome_paths.h" 21 #include "chrome/common/chrome_paths.h"
22 #include "chrome/common/chrome_switches.h"
23 #include "chrome/common/url_constants.h"
21 #include "components/version_info/version_info.h" 24 #include "components/version_info/version_info.h"
22 #include "content/public/browser/devtools_agent_host.h" 25 #include "content/public/browser/devtools_agent_host.h"
23 #include "content/public/browser/devtools_frontend_host.h" 26 #include "content/public/browser/devtools_frontend_host.h"
24 #include "content/public/browser/devtools_socket_factory.h" 27 #include "content/public/browser/devtools_socket_factory.h"
25 #include "net/base/net_errors.h" 28 #include "net/base/net_errors.h"
26 #include "net/log/net_log_source.h" 29 #include "net/log/net_log_source.h"
27 #include "net/socket/tcp_server_socket.h" 30 #include "net/socket/tcp_server_socket.h"
28 #include "ui/base/resource/resource_bundle.h" 31 #include "ui/base/resource/resource_bundle.h"
29 32
30 namespace { 33 namespace {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // bootstrap the connection process. 104 // bootstrap the connection process.
102 bool result = PathService::Get(chrome::DIR_USER_DATA, &output_dir); 105 bool result = PathService::Get(chrome::DIR_USER_DATA, &output_dir);
103 DCHECK(result); 106 DCHECK(result);
104 } 107 }
105 108
106 base::FilePath debug_frontend_dir; 109 base::FilePath debug_frontend_dir;
107 #if defined(DEBUG_DEVTOOLS) 110 #if defined(DEBUG_DEVTOOLS)
108 PathService::Get(chrome::DIR_INSPECTOR_DEBUG, &debug_frontend_dir); 111 PathService::Get(chrome::DIR_INSPECTOR_DEBUG, &debug_frontend_dir);
109 #endif 112 #endif
110 113
114 std::string frontend_url;
115 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
116 if (command_line->HasSwitch(
117 switches::kRemoteDebuggingFrontend)) {
118 frontend_url = chrome::kChromeUIDevToolsCustomURL;
dgozman 2016/10/30 03:14:46 So, this relies on the remote browser to support t
lushnikov 2016/10/31 22:47:26 Done.
119 if (command_line->HasSwitch(switches::kEnableDevToolsExperiments))
120 frontend_url += "?experiments=true";
dgozman 2016/10/30 03:14:46 Can we make hosting browser to add all the paramet
lushnikov 2016/10/31 22:47:26 Done.
121 }
111 content::DevToolsAgentHost::StartRemoteDebuggingServer( 122 content::DevToolsAgentHost::StartRemoteDebuggingServer(
112 base::MakeUnique<TCPServerSocketFactory>(ip, port), 123 base::MakeUnique<TCPServerSocketFactory>(ip, port),
113 std::string(), 124 frontend_url,
114 output_dir, 125 output_dir,
115 debug_frontend_dir, 126 debug_frontend_dir,
116 version_info::GetProductNameAndVersionForUserAgent(), 127 version_info::GetProductNameAndVersionForUserAgent(),
117 ::GetUserAgent()); 128 ::GetUserAgent());
118 } 129 }
119 130
120 RemoteDebuggingServer::~RemoteDebuggingServer() { 131 RemoteDebuggingServer::~RemoteDebuggingServer() {
121 // Ensure Profile is alive, because the whole DevTools subsystem 132 // Ensure Profile is alive, because the whole DevTools subsystem
122 // accesses it during shutdown. 133 // accesses it during shutdown.
123 DCHECK(g_browser_process->profile_manager()); 134 DCHECK(g_browser_process->profile_manager());
124 content::DevToolsAgentHost::StopRemoteDebuggingServer(); 135 content::DevToolsAgentHost::StopRemoteDebuggingServer();
125 } 136 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698