| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "android_webview/native/aw_dev_tools_server.h" | 5 #include "android_webview/native/aw_dev_tools_server.h" |
| 6 | 6 |
| 7 #include "android_webview/native/aw_contents.h" | 7 #include "android_webview/native/aw_contents.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "content/public/browser/android/devtools_auth.h" | 14 #include "content/public/browser/android/devtools_auth.h" |
| 15 #include "content/public/browser/devtools_agent_host.h" | 15 #include "content/public/browser/devtools_agent_host.h" |
| 16 #include "content/public/browser/devtools_http_handler.h" | 16 #include "content/public/browser/devtools_http_handler.h" |
| 17 #include "content/public/browser/devtools_http_handler_delegate.h" | 17 #include "content/public/browser/devtools_http_handler_delegate.h" |
| 18 #include "content/public/browser/devtools_target.h" | 18 #include "content/public/browser/devtools_target.h" |
| 19 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 20 #include "content/public/common/user_agent.h" | 20 #include "content/public/common/user_agent.h" |
| 21 #include "jni/AwDevToolsServer_jni.h" | 21 #include "jni/AwDevToolsServer_jni.h" |
| 22 #include "net/socket/unix_domain_socket_posix.h" | 22 #include "net/socket/unix_domain_listen_socket_posix.h" |
| 23 | 23 |
| 24 using content::DevToolsAgentHost; | 24 using content::DevToolsAgentHost; |
| 25 using content::RenderViewHost; | 25 using content::RenderViewHost; |
| 26 using content::WebContents; | 26 using content::WebContents; |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 const char kFrontEndURL[] = | 30 const char kFrontEndURL[] = |
| 31 "http://chrome-devtools-frontend.appspot.com/serve_rev/%s/devtools.html"; | 31 "http://chrome-devtools-frontend.appspot.com/serve_rev/%s/devtools.html"; |
| 32 const char kSocketNameFormat[] = "webview_devtools_remote_%d"; | 32 const char kSocketNameFormat[] = "webview_devtools_remote_%d"; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 AwDevToolsServer::~AwDevToolsServer() { | 170 AwDevToolsServer::~AwDevToolsServer() { |
| 171 Stop(); | 171 Stop(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void AwDevToolsServer::Start() { | 174 void AwDevToolsServer::Start() { |
| 175 if (protocol_handler_) | 175 if (protocol_handler_) |
| 176 return; | 176 return; |
| 177 | 177 |
| 178 protocol_handler_ = content::DevToolsHttpHandler::Start( | 178 protocol_handler_ = content::DevToolsHttpHandler::Start( |
| 179 new net::UnixDomainSocketWithAbstractNamespaceFactory( | 179 new net::deprecated::UnixDomainListenSocketWithAbstractNamespaceFactory( |
| 180 base::StringPrintf(kSocketNameFormat, getpid()), | 180 base::StringPrintf(kSocketNameFormat, getpid()), |
| 181 "", | 181 "", |
| 182 base::Bind(&content::CanUserConnectToDevTools)), | 182 base::Bind(&content::CanUserConnectToDevTools)), |
| 183 base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str()), | 183 base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str()), |
| 184 new AwDevToolsServerDelegate(), | 184 new AwDevToolsServerDelegate(), |
| 185 base::FilePath()); | 185 base::FilePath()); |
| 186 } | 186 } |
| 187 | 187 |
| 188 void AwDevToolsServer::Stop() { | 188 void AwDevToolsServer::Stop() { |
| 189 if (!protocol_handler_) | 189 if (!protocol_handler_) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 219 AwDevToolsServer* devtools_server = | 219 AwDevToolsServer* devtools_server = |
| 220 reinterpret_cast<AwDevToolsServer*>(server); | 220 reinterpret_cast<AwDevToolsServer*>(server); |
| 221 if (enabled) { | 221 if (enabled) { |
| 222 devtools_server->Start(); | 222 devtools_server->Start(); |
| 223 } else { | 223 } else { |
| 224 devtools_server->Stop(); | 224 devtools_server->Stop(); |
| 225 } | 225 } |
| 226 } | 226 } |
| 227 | 227 |
| 228 } // namespace android_webview | 228 } // namespace android_webview |
| OLD | NEW |