OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_dev_tools_manager_delegate.h" | 5 #include "android_webview/browser/aw_dev_tools_manager_delegate.h" |
6 | 6 |
7 #include "android_webview/native/aw_contents.h" | 7 #include "android_webview/browser/browser_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/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/devtools_agent_host.h" | 13 #include "content/public/browser/devtools_agent_host.h" |
14 #include "content/public/browser/devtools_target.h" | 14 #include "content/public/browser/devtools_target.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 | 16 |
17 using content::DevToolsAgentHost; | 17 using content::DevToolsAgentHost; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 Target::Target(scoped_refptr<DevToolsAgentHost> agent_host) | 66 Target::Target(scoped_refptr<DevToolsAgentHost> agent_host) |
67 : agent_host_(agent_host) { | 67 : agent_host_(agent_host) { |
68 if (WebContents* web_contents = agent_host->GetWebContents()) { | 68 if (WebContents* web_contents = agent_host->GetWebContents()) { |
69 description_ = GetViewDescription(web_contents); | 69 description_ = GetViewDescription(web_contents); |
70 last_activity_time_ = web_contents->GetLastActiveTime(); | 70 last_activity_time_ = web_contents->GetLastActiveTime(); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 std::string GetViewDescription(WebContents* web_contents) { | 74 std::string GetViewDescription(WebContents* web_contents) { |
75 const android_webview::BrowserViewRenderer* bvr = | 75 android_webview::BrowserViewRenderer* bvr = |
76 android_webview::AwContents::FromWebContents(web_contents) | 76 android_webview::BrowserViewRenderer::FromWebContents(web_contents); |
77 ->GetBrowserViewRenderer(); | |
78 if (!bvr) return ""; | 77 if (!bvr) return ""; |
79 base::DictionaryValue description; | 78 base::DictionaryValue description; |
80 description.SetBoolean("attached", bvr->attached_to_window()); | 79 description.SetBoolean("attached", bvr->attached_to_window()); |
81 description.SetBoolean("visible", bvr->IsVisible()); | 80 description.SetBoolean("visible", bvr->IsVisible()); |
82 gfx::Rect screen_rect = bvr->GetScreenRect(); | 81 gfx::Rect screen_rect = bvr->GetScreenRect(); |
83 description.SetInteger("screenX", screen_rect.x()); | 82 description.SetInteger("screenX", screen_rect.x()); |
84 description.SetInteger("screenY", screen_rect.y()); | 83 description.SetInteger("screenY", screen_rect.y()); |
85 description.SetBoolean("empty", screen_rect.size().IsEmpty()); | 84 description.SetBoolean("empty", screen_rect.size().IsEmpty()); |
86 if (!screen_rect.size().IsEmpty()) { | 85 if (!screen_rect.size().IsEmpty()) { |
87 description.SetInteger("width", screen_rect.width()); | 86 description.SetInteger("width", screen_rect.width()); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 std::string AwDevToolsManagerDelegate::GetPageThumbnailData(const GURL&) { | 120 std::string AwDevToolsManagerDelegate::GetPageThumbnailData(const GURL&) { |
122 return ""; | 121 return ""; |
123 } | 122 } |
124 | 123 |
125 scoped_ptr<content::DevToolsTarget> AwDevToolsManagerDelegate::CreateNewTarget( | 124 scoped_ptr<content::DevToolsTarget> AwDevToolsManagerDelegate::CreateNewTarget( |
126 const GURL&) { | 125 const GURL&) { |
127 return scoped_ptr<content::DevToolsTarget>(); | 126 return scoped_ptr<content::DevToolsTarget>(); |
128 } | 127 } |
129 | 128 |
130 } // namespace android_webview | 129 } // namespace android_webview |
OLD | NEW |