| 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/browser_view_renderer_impl.h" | 7 #include "android_webview/browser/browser_view_renderer_impl.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/stringprintf.h" | 10 #include "base/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/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 #include "content/public/common/url_constants.h" | 15 #include "content/public/common/url_constants.h" |
| 16 #include "net/base/unix_domain_socket_posix.h" | 16 #include "net/base/unix_domain_socket_posix.h" |
| 17 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 const char kSocketNameFormat[] = "webview_devtools_remote_%d"; | 20 const char kSocketNameFormat[] = "webview_devtools_remote_%d"; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace android_webview { | 23 namespace android_webview { |
| 24 | 24 |
| 25 AwDevToolsDelegate::AwDevToolsDelegate(content::BrowserContext* browser_context) | 25 AwDevToolsDelegate::AwDevToolsDelegate(content::BrowserContext* browser_context) |
| 26 : browser_context_(browser_context) { | 26 : browser_context_(browser_context) { |
| 27 devtools_http_handler_ = content::DevToolsHttpHandler::Start( | 27 devtools_http_handler_ = content::DevToolsHttpHandler::Start( |
| 28 new net::UnixDomainSocketWithAbstractNamespaceFactory( | 28 new net::UnixDomainSocketWithAbstractNamespaceFactory( |
| 29 StringPrintf(kSocketNameFormat, getpid()), | 29 base::StringPrintf(kSocketNameFormat, getpid()), |
| 30 base::Bind(&content::CanUserConnectToDevTools)), | 30 base::Bind(&content::CanUserConnectToDevTools)), |
| 31 "", | 31 "", |
| 32 this); | 32 this); |
| 33 } | 33 } |
| 34 | 34 |
| 35 AwDevToolsDelegate::~AwDevToolsDelegate() { | 35 AwDevToolsDelegate::~AwDevToolsDelegate() { |
| 36 } | 36 } |
| 37 | 37 |
| 38 void AwDevToolsDelegate::Stop() { | 38 void AwDevToolsDelegate::Stop() { |
| 39 devtools_http_handler_->Stop(); | 39 devtools_http_handler_->Stop(); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 if (!screen_rect.size().IsEmpty()) { | 226 if (!screen_rect.size().IsEmpty()) { |
| 227 description.SetInteger("width", screen_rect.width()); | 227 description.SetInteger("width", screen_rect.width()); |
| 228 description.SetInteger("height", screen_rect.height()); | 228 description.SetInteger("height", screen_rect.height()); |
| 229 } | 229 } |
| 230 std::string json; | 230 std::string json; |
| 231 base::JSONWriter::Write(&description, &json); | 231 base::JSONWriter::Write(&description, &json); |
| 232 return json; | 232 return json; |
| 233 } | 233 } |
| 234 | 234 |
| 235 } // namespace android_webview | 235 } // namespace android_webview |
| OLD | NEW |