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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/web_applications/web_app_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/aw_hit_test_data.h" 5 #include "android_webview/common/aw_hit_test_data.h"
6 #include "android_webview/common/render_view_messages.h" 6 #include "android_webview/common/render_view_messages.h"
7 #include "android_webview/renderer/aw_render_frame_ext.h" 7 #include "android_webview/renderer/aw_render_frame_ext.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "content/public/renderer/document_state.h" 9 #include "content/public/renderer/document_state.h"
10 #include "content/public/renderer/render_frame.h" 10 #include "content/public/renderer/render_frame.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 OnResetScrollAndScaleState) 179 OnResetScrollAndScaleState)
180 IPC_MESSAGE_HANDLER(AwViewMsg_SetInitialPageScale, OnSetInitialPageScale) 180 IPC_MESSAGE_HANDLER(AwViewMsg_SetInitialPageScale, OnSetInitialPageScale)
181 IPC_MESSAGE_HANDLER(AwViewMsg_SetBackgroundColor, OnSetBackgroundColor) 181 IPC_MESSAGE_HANDLER(AwViewMsg_SetBackgroundColor, OnSetBackgroundColor)
182 IPC_MESSAGE_HANDLER(AwViewMsg_SmoothScroll, OnSmoothScroll) 182 IPC_MESSAGE_HANDLER(AwViewMsg_SmoothScroll, OnSmoothScroll)
183 IPC_MESSAGE_UNHANDLED(handled = false) 183 IPC_MESSAGE_UNHANDLED(handled = false)
184 IPC_END_MESSAGE_MAP() 184 IPC_END_MESSAGE_MAP()
185 return handled; 185 return handled;
186 } 186 }
187 187
188 void AwRenderFrameExt::OnDocumentHasImagesRequest(uint32_t id) { 188 void AwRenderFrameExt::OnDocumentHasImagesRequest(uint32_t id) {
189 bool hasImages = false; 189 blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
190 blink::WebView* webview = GetWebView(); 190
191 if (webview) { 191 // AwViewMsg_DocumentHasImages should only be sent to the main frame.
192 blink::WebDocument document = webview->MainFrame()->GetDocument(); 192 DCHECK(frame);
193 const blink::WebElement child_img = GetImgChild(document); 193 DCHECK(!frame->Parent());
194 hasImages = !child_img.IsNull(); 194
195 } 195 const blink::WebElement child_img = GetImgChild(frame->GetDocument());
196 Send( 196 bool has_images = !child_img.IsNull();
197 new AwViewHostMsg_DocumentHasImagesResponse(routing_id(), id, hasImages)); 197
198 Send(new AwViewHostMsg_DocumentHasImagesResponse(routing_id(), id,
199 has_images));
198 } 200 }
199 201
200 void AwRenderFrameExt::FocusedNodeChanged(const blink::WebNode& node) { 202 void AwRenderFrameExt::FocusedNodeChanged(const blink::WebNode& node) {
201 if (node.IsNull() || !node.IsElementNode() || !render_frame() || 203 if (node.IsNull() || !node.IsElementNode() || !render_frame() ||
202 !render_frame()->GetRenderView()) 204 !render_frame()->GetRenderView())
203 return; 205 return;
204 206
205 const blink::WebElement element = node.ToConst<blink::WebElement>(); 207 const blink::WebElement element = node.ToConst<blink::WebElement>();
206 AwHitTestData data; 208 AwHitTestData data;
207 209
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 return nullptr; 307 return nullptr;
306 308
307 return render_frame()->GetRenderView()->GetWebFrameWidget(); 309 return render_frame()->GetRenderView()->GetWebFrameWidget();
308 } 310 }
309 311
310 void AwRenderFrameExt::OnDestruct() { 312 void AwRenderFrameExt::OnDestruct() {
311 delete this; 313 delete this;
312 } 314 }
313 315
314 } // namespace android_webview 316 } // namespace android_webview
OLDNEW
« 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