| 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/browser/aw_devtools_delegate.h" | 5 #include "android_webview/browser/aw_devtools_delegate.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/in_process_view_renderer.h" | 7 #include "android_webview/browser/in_process_view_renderer.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "content/public/browser/android/devtools_auth.h" | 12 #include "content/public/browser/android/devtools_auth.h" |
| 13 #include "content/public/browser/devtools_http_handler.h" | 13 #include "content/public/browser/devtools_http_handler.h" |
| 14 #include "content/public/browser/devtools_remote_frontend_util.h" |
| 14 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 15 #include "content/public/common/url_constants.h" | 16 #include "content/public/common/url_constants.h" |
| 16 #include "net/socket/unix_domain_socket_posix.h" | 17 #include "net/socket/unix_domain_socket_posix.h" |
| 17 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 const char kSocketNameFormat[] = "webview_devtools_remote_%d"; | 21 const char kSocketNameFormat[] = "%s_%d"; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace android_webview { | 24 namespace android_webview { |
| 24 | 25 |
| 25 AwDevToolsDelegate::AwDevToolsDelegate(content::BrowserContext* browser_context) | 26 AwDevToolsDelegate::AwDevToolsDelegate(content::BrowserContext* browser_context) |
| 26 : browser_context_(browser_context) { | 27 : browser_context_(browser_context) { |
| 27 devtools_http_handler_ = content::DevToolsHttpHandler::Start( | 28 devtools_http_handler_ = content::DevToolsHttpHandler::Start( |
| 28 new net::UnixDomainSocketWithAbstractNamespaceFactory( | 29 new net::UnixDomainSocketWithAbstractNamespaceFactory( |
| 29 base::StringPrintf(kSocketNameFormat, getpid()), | 30 base::StringPrintf( |
| 31 kSocketNameFormat, |
| 32 content::GetDevToolsServerSocketName("webview").c_str(), |
| 33 getpid()), |
| 30 "", | 34 "", |
| 31 base::Bind(&content::CanUserConnectToDevTools)), | 35 base::Bind(&content::CanUserConnectToDevTools)), |
| 32 "", | 36 content::GetDevToolsFrontendMainResourceURL(), |
| 33 this); | 37 this); |
| 34 } | 38 } |
| 35 | 39 |
| 36 AwDevToolsDelegate::~AwDevToolsDelegate() { | 40 AwDevToolsDelegate::~AwDevToolsDelegate() { |
| 37 } | 41 } |
| 38 | 42 |
| 39 void AwDevToolsDelegate::Stop() { | 43 void AwDevToolsDelegate::Stop() { |
| 40 devtools_http_handler_->Stop(); | 44 devtools_http_handler_->Stop(); |
| 41 // WARNING: |this| has now been deleted by the method above. | 45 // WARNING: |this| has now been deleted by the method above. |
| 42 } | 46 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 " <th style='width:100px; text-align:left;'>Size</th>" | 186 " <th style='width:100px; text-align:left;'>Size</th>" |
| 183 " </tr>" | 187 " </tr>" |
| 184 " <tbody id='items'></tbody>" | 188 " <tbody id='items'></tbody>" |
| 185 " </table>" | 189 " </table>" |
| 186 "</body>" | 190 "</body>" |
| 187 "</html>"; | 191 "</html>"; |
| 188 return html; | 192 return html; |
| 189 } | 193 } |
| 190 | 194 |
| 191 bool AwDevToolsDelegate::BundlesFrontendResources() { | 195 bool AwDevToolsDelegate::BundlesFrontendResources() { |
| 192 return true; | 196 return false; |
| 193 } | 197 } |
| 194 | 198 |
| 195 base::FilePath AwDevToolsDelegate::GetDebugFrontendDir() { | 199 base::FilePath AwDevToolsDelegate::GetDebugFrontendDir() { |
| 196 return base::FilePath(); | 200 return base::FilePath(); |
| 197 } | 201 } |
| 198 | 202 |
| 199 std::string AwDevToolsDelegate::GetPageThumbnailData(const GURL& url) { | 203 std::string AwDevToolsDelegate::GetPageThumbnailData(const GURL& url) { |
| 200 return ""; | 204 return ""; |
| 201 } | 205 } |
| 202 | 206 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 } | 239 } |
| 236 | 240 |
| 237 scoped_refptr<net::StreamListenSocket> | 241 scoped_refptr<net::StreamListenSocket> |
| 238 AwDevToolsDelegate::CreateSocketForTethering( | 242 AwDevToolsDelegate::CreateSocketForTethering( |
| 239 net::StreamListenSocket::Delegate* delegate, | 243 net::StreamListenSocket::Delegate* delegate, |
| 240 std::string* name) { | 244 std::string* name) { |
| 241 return NULL; | 245 return NULL; |
| 242 } | 246 } |
| 243 | 247 |
| 244 } // namespace android_webview | 248 } // namespace android_webview |
| OLD | NEW |