| 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/android/devtools_server.h" | 5 #include "chrome/browser/android/devtools_server.h" |
| 6 | 6 |
| 7 #include <pwd.h> | 7 #include <pwd.h> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "content/public/browser/render_view_host.h" | 37 #include "content/public/browser/render_view_host.h" |
| 38 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
| 39 #include "content/public/browser/web_contents_delegate.h" | 39 #include "content/public/browser/web_contents_delegate.h" |
| 40 #include "content/public/common/content_switches.h" | 40 #include "content/public/common/content_switches.h" |
| 41 #include "content/public/common/url_constants.h" | 41 #include "content/public/common/url_constants.h" |
| 42 #include "content/public/common/user_agent.h" | 42 #include "content/public/common/user_agent.h" |
| 43 #include "jni/DevToolsServer_jni.h" | 43 #include "jni/DevToolsServer_jni.h" |
| 44 #include "net/base/net_errors.h" | 44 #include "net/base/net_errors.h" |
| 45 #include "net/socket/unix_domain_server_socket_posix.h" | 45 #include "net/socket/unix_domain_server_socket_posix.h" |
| 46 #include "net/url_request/url_request_context_getter.h" | 46 #include "net/url_request/url_request_context_getter.h" |
| 47 #include "v8/include/v8.h" |
| 47 | 48 |
| 48 using base::android::JavaParamRef; | 49 using base::android::JavaParamRef; |
| 49 using content::DevToolsAgentHost; | 50 using content::DevToolsAgentHost; |
| 50 using content::RenderViewHost; | 51 using content::RenderViewHost; |
| 51 using content::WebContents; | 52 using content::WebContents; |
| 52 | 53 |
| 53 namespace { | 54 namespace { |
| 54 | 55 |
| 55 // TL;DR: Do not change this string. | 56 // TL;DR: Do not change this string. |
| 56 // | 57 // |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 net::UnixDomainServerSocket::AuthCallback auth_callback = | 154 net::UnixDomainServerSocket::AuthCallback auth_callback = |
| 154 allow_debug_permission ? | 155 allow_debug_permission ? |
| 155 base::Bind(&AuthorizeSocketAccessWithDebugPermission) : | 156 base::Bind(&AuthorizeSocketAccessWithDebugPermission) : |
| 156 base::Bind(&content::CanUserConnectToDevTools); | 157 base::Bind(&content::CanUserConnectToDevTools); |
| 157 std::unique_ptr<content::DevToolsSocketFactory> factory( | 158 std::unique_ptr<content::DevToolsSocketFactory> factory( |
| 158 new UnixDomainServerSocketFactory(socket_name_, auth_callback)); | 159 new UnixDomainServerSocketFactory(socket_name_, auth_callback)); |
| 159 DevToolsAgentHost::StartRemoteDebuggingServer( | 160 DevToolsAgentHost::StartRemoteDebuggingServer( |
| 160 std::move(factory), | 161 std::move(factory), |
| 161 base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str()), | 162 base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str()), |
| 162 base::FilePath(), base::FilePath(), | 163 base::FilePath(), base::FilePath(), |
| 163 version_info::GetProductNameAndVersionForUserAgent(), ::GetUserAgent()); | 164 version_info::GetProductNameAndVersionForUserAgent(), ::GetUserAgent(). |
| 165 v8::V8::GetVersion()); |
| 164 is_started_ = true; | 166 is_started_ = true; |
| 165 } | 167 } |
| 166 | 168 |
| 167 void DevToolsServer::Stop() { | 169 void DevToolsServer::Stop() { |
| 168 is_started_ = false; | 170 is_started_ = false; |
| 169 DevToolsAgentHost::StopRemoteDebuggingServer(); | 171 DevToolsAgentHost::StopRemoteDebuggingServer(); |
| 170 } | 172 } |
| 171 | 173 |
| 172 bool DevToolsServer::IsStarted() const { | 174 bool DevToolsServer::IsStarted() const { |
| 173 return is_started_; | 175 return is_started_; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 203 jlong server, | 205 jlong server, |
| 204 jboolean enabled, | 206 jboolean enabled, |
| 205 jboolean allow_debug_permission) { | 207 jboolean allow_debug_permission) { |
| 206 DevToolsServer* devtools_server = reinterpret_cast<DevToolsServer*>(server); | 208 DevToolsServer* devtools_server = reinterpret_cast<DevToolsServer*>(server); |
| 207 if (enabled) { | 209 if (enabled) { |
| 208 devtools_server->Start(allow_debug_permission); | 210 devtools_server->Start(allow_debug_permission); |
| 209 } else { | 211 } else { |
| 210 devtools_server->Stop(); | 212 devtools_server->Stop(); |
| 211 } | 213 } |
| 212 } | 214 } |
| OLD | NEW |