| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "android_webview/renderer/aw_render_view_ext.h" |
| 6 |
| 7 #include "android_webview/common/render_view_messages.h" |
| 8 #include "content/public/renderer/render_view.h" |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
| 14 |
| 15 namespace android_webview { |
| 16 |
| 17 namespace { |
| 18 |
| 19 } // namespace |
| 20 |
| 21 |
| 22 AwRenderViewExt::AwRenderViewExt(content::RenderView* render_view) |
| 23 : content::RenderViewObserver(render_view) { |
| 24 } |
| 25 |
| 26 AwRenderViewExt::~AwRenderViewExt() {} |
| 27 |
| 28 bool AwRenderViewExt::OnMessageReceived(const IPC::Message& message) { |
| 29 bool handled = true; |
| 30 IPC_BEGIN_MESSAGE_MAP(AwRenderViewExt, message) |
| 31 IPC_MESSAGE_HANDLER(AwViewMsg_DocumentHasImages, OnDocumentHasImagesRequest) |
| 32 IPC_MESSAGE_UNHANDLED(handled = false) |
| 33 IPC_END_MESSAGE_MAP() |
| 34 return handled; |
| 35 } |
| 36 |
| 37 |
| 38 void AwRenderViewExt::OnDocumentHasImagesRequest(int id) { |
| 39 bool hasImages = false; |
| 40 if (render_view()) { |
| 41 WebKit::WebView* webview = render_view()->GetWebView(); |
| 42 if (webview) { |
| 43 WebKit::WebVector<WebKit::WebElement> images; |
| 44 webview->mainFrame()->document().images(images); |
| 45 hasImages = !images.isEmpty(); |
| 46 } |
| 47 } |
| 48 Send(new AwViewHostMsg_DocumentHasImagesResponse(routing_id(), id, |
| 49 hasImages)); |
| 50 } |
| 51 |
| 52 } // namespace android_webview |
| OLD | NEW |