| 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/browser/in_process_view_renderer.h" | 7 #include "android_webview/native/aw_contents.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/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "content/public/browser/android/devtools_auth.h" | 13 #include "content/public/browser/android/devtools_auth.h" |
| 14 #include "content/public/browser/devtools_agent_host.h" | 14 #include "content/public/browser/devtools_agent_host.h" |
| 15 #include "content/public/browser/devtools_http_handler.h" | 15 #include "content/public/browser/devtools_http_handler.h" |
| 16 #include "content/public/browser/devtools_http_handler_delegate.h" | 16 #include "content/public/browser/devtools_http_handler_delegate.h" |
| 17 #include "content/public/browser/devtools_target.h" | 17 #include "content/public/browser/devtools_target.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 const char html[] = | 130 const char html[] = |
| 131 "<html>" | 131 "<html>" |
| 132 "<head><title>WebView remote debugging</title></head>" | 132 "<head><title>WebView remote debugging</title></head>" |
| 133 "<body>Please use <a href=\'chrome://inspect\'>chrome://inspect</a>" | 133 "<body>Please use <a href=\'chrome://inspect\'>chrome://inspect</a>" |
| 134 "</body>" | 134 "</body>" |
| 135 "</html>"; | 135 "</html>"; |
| 136 return html; | 136 return html; |
| 137 } | 137 } |
| 138 | 138 |
| 139 std::string GetViewDescription(WebContents* web_contents) { | 139 std::string GetViewDescription(WebContents* web_contents) { |
| 140 android_webview::BrowserViewRenderer* bvr | 140 const android_webview::BrowserViewRenderer* bvr = |
| 141 = android_webview::InProcessViewRenderer::FromWebContents(web_contents); | 141 android_webview::AwContents::FromWebContents(web_contents) |
| 142 ->GetBrowserViewRenderer(); |
| 142 if (!bvr) return ""; | 143 if (!bvr) return ""; |
| 143 base::DictionaryValue description; | 144 base::DictionaryValue description; |
| 144 description.SetBoolean("attached", bvr->IsAttachedToWindow()); | 145 description.SetBoolean("attached", bvr->IsAttachedToWindow()); |
| 145 description.SetBoolean("visible", bvr->IsVisible()); | 146 description.SetBoolean("visible", bvr->IsVisible()); |
| 146 gfx::Rect screen_rect = bvr->GetScreenRect(); | 147 gfx::Rect screen_rect = bvr->GetScreenRect(); |
| 147 description.SetInteger("screenX", screen_rect.x()); | 148 description.SetInteger("screenX", screen_rect.x()); |
| 148 description.SetInteger("screenY", screen_rect.y()); | 149 description.SetInteger("screenY", screen_rect.y()); |
| 149 description.SetBoolean("empty", screen_rect.size().IsEmpty()); | 150 description.SetBoolean("empty", screen_rect.size().IsEmpty()); |
| 150 if (!screen_rect.size().IsEmpty()) { | 151 if (!screen_rect.size().IsEmpty()) { |
| 151 description.SetInteger("width", screen_rect.width()); | 152 description.SetInteger("width", screen_rect.width()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 AwDevToolsServer* devtools_server = | 217 AwDevToolsServer* devtools_server = |
| 217 reinterpret_cast<AwDevToolsServer*>(server); | 218 reinterpret_cast<AwDevToolsServer*>(server); |
| 218 if (enabled) { | 219 if (enabled) { |
| 219 devtools_server->Start(); | 220 devtools_server->Start(); |
| 220 } else { | 221 } else { |
| 221 devtools_server->Stop(); | 222 devtools_server->Stop(); |
| 222 } | 223 } |
| 223 } | 224 } |
| 224 | 225 |
| 225 } // namespace android_webview | 226 } // namespace android_webview |
| OLD | NEW |