| 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" | |
| 8 #include "android_webview/browser/in_process_view_renderer.h" | 7 #include "android_webview/browser/in_process_view_renderer.h" |
| 9 #include "android_webview/common/aw_switches.h" | |
| 10 #include "base/bind.h" | 8 #include "base/bind.h" |
| 11 #include "base/command_line.h" | |
| 12 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 13 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 14 #include "base/values.h" | 11 #include "base/values.h" |
| 15 #include "content/public/browser/android/devtools_auth.h" | 12 #include "content/public/browser/android/devtools_auth.h" |
| 16 #include "content/public/browser/devtools_http_handler.h" | 13 #include "content/public/browser/devtools_http_handler.h" |
| 17 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 18 #include "content/public/common/url_constants.h" | 15 #include "content/public/common/url_constants.h" |
| 19 #include "net/socket/unix_domain_socket_posix.h" | 16 #include "net/socket/unix_domain_socket_posix.h" |
| 20 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| 21 | 18 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 AwDevToolsDelegate::GetTargetType(content::RenderViewHost*) { | 208 AwDevToolsDelegate::GetTargetType(content::RenderViewHost*) { |
| 212 return kTargetTypeTab; | 209 return kTargetTypeTab; |
| 213 } | 210 } |
| 214 | 211 |
| 215 std::string AwDevToolsDelegate::GetViewDescription( | 212 std::string AwDevToolsDelegate::GetViewDescription( |
| 216 content::RenderViewHost* rvh) { | 213 content::RenderViewHost* rvh) { |
| 217 content::WebContents* web_contents = | 214 content::WebContents* web_contents = |
| 218 content::WebContents::FromRenderViewHost(rvh); | 215 content::WebContents::FromRenderViewHost(rvh); |
| 219 if (!web_contents) return ""; | 216 if (!web_contents) return ""; |
| 220 | 217 |
| 221 BrowserViewRenderer* bvr = NULL; | 218 BrowserViewRenderer* bvr |
| 222 | 219 = InProcessViewRenderer::FromWebContents(web_contents); |
| 223 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 224 switches::kNoMergeUIAndRendererCompositorThreads)) { | |
| 225 bvr = BrowserViewRendererImpl::FromWebContents(web_contents); | |
| 226 } else { | |
| 227 bvr = InProcessViewRenderer::FromWebContents(web_contents); | |
| 228 } | |
| 229 if (!bvr) return ""; | 220 if (!bvr) return ""; |
| 230 base::DictionaryValue description; | 221 base::DictionaryValue description; |
| 231 description.SetBoolean("attached", bvr->IsAttachedToWindow()); | 222 description.SetBoolean("attached", bvr->IsAttachedToWindow()); |
| 232 description.SetBoolean("visible", bvr->IsViewVisible()); | 223 description.SetBoolean("visible", bvr->IsViewVisible()); |
| 233 gfx::Rect screen_rect = bvr->GetScreenRect(); | 224 gfx::Rect screen_rect = bvr->GetScreenRect(); |
| 234 description.SetInteger("screenX", screen_rect.x()); | 225 description.SetInteger("screenX", screen_rect.x()); |
| 235 description.SetInteger("screenY", screen_rect.y()); | 226 description.SetInteger("screenY", screen_rect.y()); |
| 236 description.SetBoolean("empty", screen_rect.size().IsEmpty()); | 227 description.SetBoolean("empty", screen_rect.size().IsEmpty()); |
| 237 if (!screen_rect.size().IsEmpty()) { | 228 if (!screen_rect.size().IsEmpty()) { |
| 238 description.SetInteger("width", screen_rect.width()); | 229 description.SetInteger("width", screen_rect.width()); |
| 239 description.SetInteger("height", screen_rect.height()); | 230 description.SetInteger("height", screen_rect.height()); |
| 240 } | 231 } |
| 241 std::string json; | 232 std::string json; |
| 242 base::JSONWriter::Write(&description, &json); | 233 base::JSONWriter::Write(&description, &json); |
| 243 return json; | 234 return json; |
| 244 } | 235 } |
| 245 | 236 |
| 246 scoped_refptr<net::StreamListenSocket> | 237 scoped_refptr<net::StreamListenSocket> |
| 247 AwDevToolsDelegate::CreateSocketForTethering( | 238 AwDevToolsDelegate::CreateSocketForTethering( |
| 248 net::StreamListenSocket::Delegate* delegate, | 239 net::StreamListenSocket::Delegate* delegate, |
| 249 std::string* name) { | 240 std::string* name) { |
| 250 return NULL; | 241 return NULL; |
| 251 } | 242 } |
| 252 | 243 |
| 253 } // namespace android_webview | 244 } // namespace android_webview |
| OLD | NEW |