| OLD | NEW |
| 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/history/top_sites_factory.h" | 17 #include "chrome/browser/history/top_sites_factory.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
| 19 #include "chrome/browser/ui/browser_list.h" | 20 #include "chrome/browser/ui/browser_list.h" |
| 20 #include "chrome/common/chrome_content_client.h" | 21 #include "chrome/common/chrome_content_client.h" |
| 21 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
| 23 #include "chrome/common/chrome_switches.h" |
| 24 #include "chrome/common/url_constants.h" |
| 22 #include "components/devtools_http_handler/devtools_http_handler.h" | 25 #include "components/devtools_http_handler/devtools_http_handler.h" |
| 23 #include "components/devtools_http_handler/devtools_http_handler_delegate.h" | 26 #include "components/devtools_http_handler/devtools_http_handler_delegate.h" |
| 24 #include "components/history/core/browser/top_sites.h" | 27 #include "components/history/core/browser/top_sites.h" |
| 25 #include "components/version_info/version_info.h" | 28 #include "components/version_info/version_info.h" |
| 26 #include "content/public/browser/devtools_frontend_host.h" | 29 #include "content/public/browser/devtools_frontend_host.h" |
| 27 #include "grit/browser_resources.h" | 30 #include "grit/browser_resources.h" |
| 28 #include "net/base/net_errors.h" | 31 #include "net/base/net_errors.h" |
| 29 #include "net/socket/tcp_server_socket.h" | 32 #include "net/socket/tcp_server_socket.h" |
| 30 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
| 31 | 34 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 // bootstrap the connection process. | 173 // bootstrap the connection process. |
| 171 bool result = PathService::Get(chrome::DIR_USER_DATA, &output_dir); | 174 bool result = PathService::Get(chrome::DIR_USER_DATA, &output_dir); |
| 172 DCHECK(result); | 175 DCHECK(result); |
| 173 } | 176 } |
| 174 | 177 |
| 175 base::FilePath debug_frontend_dir; | 178 base::FilePath debug_frontend_dir; |
| 176 #if defined(DEBUG_DEVTOOLS) | 179 #if defined(DEBUG_DEVTOOLS) |
| 177 PathService::Get(chrome::DIR_INSPECTOR, &debug_frontend_dir); | 180 PathService::Get(chrome::DIR_INSPECTOR, &debug_frontend_dir); |
| 178 #endif | 181 #endif |
| 179 | 182 |
| 183 std::string frontend_url; |
| 184 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 185 switches::kRemoteDebuggingFrontend)) { |
| 186 frontend_url = chrome::kChromeUIDevToolsCustomURL; |
| 187 } |
| 188 |
| 180 devtools_http_handler_.reset(new devtools_http_handler::DevToolsHttpHandler( | 189 devtools_http_handler_.reset(new devtools_http_handler::DevToolsHttpHandler( |
| 181 base::WrapUnique(new TCPServerSocketFactory(ip, port)), std::string(), | 190 base::WrapUnique(new TCPServerSocketFactory(ip, port)), frontend_url, |
| 182 new ChromeDevToolsHttpHandlerDelegate(), output_dir, debug_frontend_dir, | 191 new ChromeDevToolsHttpHandlerDelegate(), output_dir, debug_frontend_dir, |
| 183 version_info::GetProductNameAndVersionForUserAgent(), ::GetUserAgent())); | 192 version_info::GetProductNameAndVersionForUserAgent(), ::GetUserAgent())); |
| 184 } | 193 } |
| 185 | 194 |
| 186 RemoteDebuggingServer::~RemoteDebuggingServer() { | 195 RemoteDebuggingServer::~RemoteDebuggingServer() { |
| 187 // Ensure Profile is alive, because the whole DevTools subsystem | 196 // Ensure Profile is alive, because the whole DevTools subsystem |
| 188 // accesses it during shutdown. | 197 // accesses it during shutdown. |
| 189 DCHECK(g_browser_process->profile_manager()); | 198 DCHECK(g_browser_process->profile_manager()); |
| 190 } | 199 } |
| OLD | NEW |