Chromium Code Reviews| 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/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 Loading... | |
| 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 && !frame->Parent()); |
|
Łukasz Anforowicz
2017/06/15 20:15:59
1) AwRenderFrameExt is a RenderFrameObserver
2) Aw
| |
| 193 const blink::WebElement child_img = GetImgChild(document); | 193 |
| 194 hasImages = !child_img.IsNull(); | 194 const blink::WebElement child_img = GetImgChild(frame->GetDocument()); |
| 195 } | 195 bool has_images = !child_img.IsNull(); |
| 196 Send( | 196 |
| 197 new AwViewHostMsg_DocumentHasImagesResponse(routing_id(), id, hasImages)); | 197 Send(new AwViewHostMsg_DocumentHasImagesResponse(routing_id(), id, |
| 198 has_images)); | |
| 198 } | 199 } |
| 199 | 200 |
| 200 void AwRenderFrameExt::FocusedNodeChanged(const blink::WebNode& node) { | 201 void AwRenderFrameExt::FocusedNodeChanged(const blink::WebNode& node) { |
| 201 if (node.IsNull() || !node.IsElementNode() || !render_frame() || | 202 if (node.IsNull() || !node.IsElementNode() || !render_frame() || |
| 202 !render_frame()->GetRenderView()) | 203 !render_frame()->GetRenderView()) |
| 203 return; | 204 return; |
| 204 | 205 |
| 205 const blink::WebElement element = node.ToConst<blink::WebElement>(); | 206 const blink::WebElement element = node.ToConst<blink::WebElement>(); |
| 206 AwHitTestData data; | 207 AwHitTestData data; |
| 207 | 208 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 return nullptr; | 306 return nullptr; |
| 306 | 307 |
| 307 return render_frame()->GetRenderView()->GetWebFrameWidget(); | 308 return render_frame()->GetRenderView()->GetWebFrameWidget(); |
| 308 } | 309 } |
| 309 | 310 |
| 310 void AwRenderFrameExt::OnDestruct() { | 311 void AwRenderFrameExt::OnDestruct() { |
| 311 delete this; | 312 delete this; |
| 312 } | 313 } |
| 313 | 314 |
| 314 } // namespace android_webview | 315 } // namespace android_webview |
| OLD | NEW |