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/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 return DevToolsWindow::CreateWebSocketAPIChannel(path); | 146 return DevToolsWindow::CreateWebSocketAPIChannel(path); |
147 } | 147 } |
148 | 148 |
149 } // namespace | 149 } // namespace |
150 | 150 |
151 // static | 151 // static |
152 void RemoteDebuggingServer::EnableTetheringForDebug() { | 152 void RemoteDebuggingServer::EnableTetheringForDebug() { |
153 g_tethering_enabled.Get() = true; | 153 g_tethering_enabled.Get() = true; |
154 } | 154 } |
155 | 155 |
156 RemoteDebuggingServer::RemoteDebuggingServer( | 156 RemoteDebuggingServer::RemoteDebuggingServer(const std::string& ip, |
157 chrome::HostDesktopType host_desktop_type, | 157 uint16_t port) { |
158 const std::string& ip, | |
159 uint16_t port) { | |
160 base::FilePath output_dir; | 158 base::FilePath output_dir; |
161 if (!port) { | 159 if (!port) { |
162 // The client requested an ephemeral port. Must write the selected | 160 // The client requested an ephemeral port. Must write the selected |
163 // port to a well-known location in the profile directory to | 161 // port to a well-known location in the profile directory to |
164 // bootstrap the connection process. | 162 // bootstrap the connection process. |
165 bool result = PathService::Get(chrome::DIR_USER_DATA, &output_dir); | 163 bool result = PathService::Get(chrome::DIR_USER_DATA, &output_dir); |
166 DCHECK(result); | 164 DCHECK(result); |
167 } | 165 } |
168 | 166 |
169 base::FilePath debug_frontend_dir; | 167 base::FilePath debug_frontend_dir; |
170 #if defined(DEBUG_DEVTOOLS) | 168 #if defined(DEBUG_DEVTOOLS) |
171 PathService::Get(chrome::DIR_INSPECTOR, &debug_frontend_dir); | 169 PathService::Get(chrome::DIR_INSPECTOR, &debug_frontend_dir); |
172 #endif | 170 #endif |
173 | 171 |
174 devtools_http_handler_.reset(new devtools_http_handler::DevToolsHttpHandler( | 172 devtools_http_handler_.reset(new devtools_http_handler::DevToolsHttpHandler( |
175 make_scoped_ptr(new TCPServerSocketFactory(ip, port)), | 173 make_scoped_ptr(new TCPServerSocketFactory(ip, port)), |
176 std::string(), | 174 std::string(), |
177 new ChromeDevToolsHttpHandlerDelegate(), | 175 new ChromeDevToolsHttpHandlerDelegate(), |
178 output_dir, | 176 output_dir, |
179 debug_frontend_dir, | 177 debug_frontend_dir, |
180 version_info::GetProductNameAndVersionForUserAgent(), | 178 version_info::GetProductNameAndVersionForUserAgent(), |
181 ::GetUserAgent())); | 179 ::GetUserAgent())); |
182 } | 180 } |
183 | 181 |
184 RemoteDebuggingServer::~RemoteDebuggingServer() { | 182 RemoteDebuggingServer::~RemoteDebuggingServer() { |
185 // Ensure Profile is alive, because the whole DevTools subsystem | 183 // Ensure Profile is alive, because the whole DevTools subsystem |
186 // accesses it during shutdown. | 184 // accesses it during shutdown. |
187 DCHECK(g_browser_process->profile_manager()); | 185 DCHECK(g_browser_process->profile_manager()); |
188 } | 186 } |
OLD | NEW |