| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/browser/devtools/remote_debugging_server.h" | 5 #include "chromecast/browser/devtools/remote_debugging_server.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chromecast/base/pref_names.h" | 15 #include "chromecast/base/pref_names.h" |
| 16 #include "chromecast/browser/cast_browser_process.h" | 16 #include "chromecast/browser/cast_browser_process.h" |
| 17 #include "chromecast/browser/devtools/cast_devtools_manager_delegate.h" | 17 #include "chromecast/browser/devtools/cast_devtools_manager_delegate.h" |
| 18 #include "chromecast/common/cast_content_client.h" | 18 #include "chromecast/common/cast_content_client.h" |
| 19 #include "content/public/browser/browser_context.h" | 19 #include "content/public/browser/browser_context.h" |
| 20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 21 #include "content/public/browser/devtools_agent_host.h" | 21 #include "content/public/browser/devtools_agent_host.h" |
| 22 #include "content/public/browser/devtools_socket_factory.h" | 22 #include "content/public/browser/devtools_socket_factory.h" |
| 23 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
| 24 #include "content/public/common/user_agent.h" | 24 #include "content/public/common/user_agent.h" |
| 25 #include "net/base/net_errors.h" | 25 #include "net/base/net_errors.h" |
| 26 #include "net/log/net_log_source.h" | 26 #include "net/log/net_log_source.h" |
| 27 #include "net/socket/tcp_server_socket.h" | 27 #include "net/socket/tcp_server_socket.h" |
| 28 #include "v8/include/v8.h" |
| 28 | 29 |
| 29 #if defined(OS_ANDROID) | 30 #if defined(OS_ANDROID) |
| 30 #include "content/public/browser/android/devtools_auth.h" | 31 #include "content/public/browser/android/devtools_auth.h" |
| 31 #include "net/socket/unix_domain_server_socket_posix.h" | 32 #include "net/socket/unix_domain_server_socket_posix.h" |
| 32 #endif // defined(OS_ANDROID) | 33 #endif // defined(OS_ANDROID) |
| 33 | 34 |
| 34 namespace chromecast { | 35 namespace chromecast { |
| 35 namespace shell { | 36 namespace shell { |
| 36 | 37 |
| 37 namespace { | 38 namespace { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 157 |
| 157 void RemoteDebuggingServer::OnEnabledChanged() { | 158 void RemoteDebuggingServer::OnEnabledChanged() { |
| 158 bool enabled = *pref_enabled_ && port_ != 0; | 159 bool enabled = *pref_enabled_ && port_ != 0; |
| 159 if (enabled && !is_started_) { | 160 if (enabled && !is_started_) { |
| 160 content::DevToolsAgentHost::StartRemoteDebuggingServer( | 161 content::DevToolsAgentHost::StartRemoteDebuggingServer( |
| 161 CreateSocketFactory(port_), | 162 CreateSocketFactory(port_), |
| 162 GetFrontendUrl(), | 163 GetFrontendUrl(), |
| 163 base::FilePath(), | 164 base::FilePath(), |
| 164 base::FilePath(), | 165 base::FilePath(), |
| 165 std::string(), | 166 std::string(), |
| 166 GetUserAgent()); | 167 GetUserAgent(), |
| 168 v8::V8::GetVersion()); |
| 167 LOG(INFO) << "Devtools started: port=" << port_; | 169 LOG(INFO) << "Devtools started: port=" << port_; |
| 168 } else if (!enabled && is_started_) { | 170 } else if (!enabled && is_started_) { |
| 169 LOG(INFO) << "Stop devtools: port=" << port_; | 171 LOG(INFO) << "Stop devtools: port=" << port_; |
| 170 is_started_ = false; | 172 is_started_ = false; |
| 171 content::DevToolsAgentHost::StopRemoteDebuggingServer(); | 173 content::DevToolsAgentHost::StopRemoteDebuggingServer(); |
| 172 } | 174 } |
| 173 } | 175 } |
| 174 | 176 |
| 175 } // namespace shell | 177 } // namespace shell |
| 176 } // namespace chromecast | 178 } // namespace chromecast |
| OLD | NEW |