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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 10553014: Added RenderView.DocumentHasImages query method (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Updated comments on RenderViewHost.DocumentHasImages Created 8 years, 5 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 | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) 955 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed)
956 // TODO(viettrungluu): Move to a separate message filter. 956 // TODO(viettrungluu): Move to a separate message filter.
957 #if defined(OS_MACOSX) 957 #if defined(OS_MACOSX)
958 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) 958 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize)
959 #endif 959 #endif
960 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, 960 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune,
961 OnSetHistoryLengthAndPrune) 961 OnSetHistoryLengthAndPrune)
962 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) 962 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode)
963 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) 963 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit)
964 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode) 964 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode)
965 IPC_MESSAGE_HANDLER(ViewMsg_DocumentHasImages, OnDocumentHasImagesRequest)
965 966
966 // Have the super handle all other messages. 967 // Have the super handle all other messages.
967 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) 968 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message))
968 IPC_END_MESSAGE_MAP() 969 IPC_END_MESSAGE_MAP()
969 970
970 if (!msg_is_ok) { 971 if (!msg_is_ok) {
971 // The message had a handler, but its deserialization failed. 972 // The message had a handler, but its deserialization failed.
972 // Kill the renderer to avoid potential spoofing attacks. 973 // Kill the renderer to avoid potential spoofing attacks.
973 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; 974 CHECK(false) << "Unable to deserialize message in RenderViewImpl.";
974 } 975 }
(...skipping 3503 matching lines...) Expand 10 before | Expand all | Expand 10 after
4478 // We must pass in the target_origin to do the security check on this side, 4479 // We must pass in the target_origin to do the security check on this side,
4479 // since it may have changed since the original postMessage call was made. 4480 // since it may have changed since the original postMessage call was made.
4480 WebSecurityOrigin target_origin; 4481 WebSecurityOrigin target_origin;
4481 if (!params.target_origin.empty()) { 4482 if (!params.target_origin.empty()) {
4482 target_origin = 4483 target_origin =
4483 WebSecurityOrigin::createFromString(WebString(params.target_origin)); 4484 WebSecurityOrigin::createFromString(WebString(params.target_origin));
4484 } 4485 }
4485 frame->dispatchMessageEventWithOriginCheck(target_origin, msg_event); 4486 frame->dispatchMessageEventWithOriginCheck(target_origin, msg_event);
4486 } 4487 }
4487 4488
4489 void RenderViewImpl::OnDocumentHasImagesRequest(int id) {
4490 bool hasImages = false;
4491 if (webview()) {
4492 WebVector<WebElement> images;
4493 webview()->mainFrame()->document().images(images);
4494 hasImages = !images.isEmpty();
4495 }
4496 Send(new ViewHostMsg_DocumentHasImagesResponse(routing_id_, id, hasImages));
4497 }
4498
4488 void RenderViewImpl::OnCSSInsertRequest(const string16& frame_xpath, 4499 void RenderViewImpl::OnCSSInsertRequest(const string16& frame_xpath,
4489 const std::string& css) { 4500 const std::string& css) {
4490 WebFrame* frame = GetChildFrame(frame_xpath); 4501 WebFrame* frame = GetChildFrame(frame_xpath);
4491 if (!frame) 4502 if (!frame)
4492 return; 4503 return;
4493 4504
4494 frame->document().insertUserStyleSheet( 4505 frame->document().insertUserStyleSheet(
4495 WebString::fromUTF8(css), 4506 WebString::fromUTF8(css),
4496 WebDocument::UserStyleAuthorLevel); 4507 WebDocument::UserStyleAuthorLevel);
4497 } 4508 }
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
5671 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { 5682 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const {
5672 return !!RenderThreadImpl::current()->compositor_thread(); 5683 return !!RenderThreadImpl::current()->compositor_thread();
5673 } 5684 }
5674 5685
5675 void RenderViewImpl::OnJavaBridgeInit() { 5686 void RenderViewImpl::OnJavaBridgeInit() {
5676 DCHECK(!java_bridge_dispatcher_); 5687 DCHECK(!java_bridge_dispatcher_);
5677 #if defined(ENABLE_JAVA_BRIDGE) 5688 #if defined(ENABLE_JAVA_BRIDGE)
5678 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); 5689 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this);
5679 #endif 5690 #endif
5680 } 5691 }
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698