Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(596)

Unified Diff: android_webview/renderer/aw_render_frame_ext.cc

Issue 2928033002: Move GetDocument method from WebFrame to WebLocalFrame. (Closed)
Patch Set: Split a DCHECK in two as suggested by boliu@. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/web_applications/web_app_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/renderer/aw_render_frame_ext.cc
diff --git a/android_webview/renderer/aw_render_frame_ext.cc b/android_webview/renderer/aw_render_frame_ext.cc
index 36449ae5b95c544fb5f9f811792c242c682d9842..c870868dbf1f2b5eeb41d57c2f718a58dfd64b72 100644
--- a/android_webview/renderer/aw_render_frame_ext.cc
+++ b/android_webview/renderer/aw_render_frame_ext.cc
@@ -186,15 +186,17 @@ bool AwRenderFrameExt::OnMessageReceived(const IPC::Message& message) {
}
void AwRenderFrameExt::OnDocumentHasImagesRequest(uint32_t id) {
- bool hasImages = false;
- blink::WebView* webview = GetWebView();
- if (webview) {
- blink::WebDocument document = webview->MainFrame()->GetDocument();
- const blink::WebElement child_img = GetImgChild(document);
- hasImages = !child_img.IsNull();
- }
- Send(
- new AwViewHostMsg_DocumentHasImagesResponse(routing_id(), id, hasImages));
+ blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
+
+ // AwViewMsg_DocumentHasImages should only be sent to the main frame.
+ DCHECK(frame);
+ DCHECK(!frame->Parent());
+
+ const blink::WebElement child_img = GetImgChild(frame->GetDocument());
+ bool has_images = !child_img.IsNull();
+
+ Send(new AwViewHostMsg_DocumentHasImagesResponse(routing_id(), id,
+ has_images));
}
void AwRenderFrameExt::FocusedNodeChanged(const blink::WebNode& node) {
« no previous file with comments | « no previous file | chrome/browser/web_applications/web_app_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698