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

Unified Diff: android_webview/renderer/aw_render_frame_ext.cc

Issue 2928033002: Move GetDocument method from WebFrame to WebLocalFrame. (Closed)
Patch Set: Rebasing... 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
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..2f03e7d2a6b52f6b43cb2f818487961630fb003c 100644
--- a/android_webview/renderer/aw_render_frame_ext.cc
+++ b/android_webview/renderer/aw_render_frame_ext.cc
@@ -186,15 +186,16 @@ 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 && !frame->Parent());
Łukasz Anforowicz 2017/06/15 20:15:59 1) AwRenderFrameExt is a RenderFrameObserver 2) Aw
+
+ 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) {

Powered by Google App Engine
This is Rietveld 408576698