| OLD | NEW |
| 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/browser/renderer_host/render_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 void RenderViewHostImpl::DesktopNotificationPostClose(int notification_id, | 604 void RenderViewHostImpl::DesktopNotificationPostClose(int notification_id, |
| 605 bool by_user) { | 605 bool by_user) { |
| 606 Send(new DesktopNotificationMsg_PostClose( | 606 Send(new DesktopNotificationMsg_PostClose( |
| 607 GetRoutingID(), notification_id, by_user)); | 607 GetRoutingID(), notification_id, by_user)); |
| 608 } | 608 } |
| 609 | 609 |
| 610 void RenderViewHostImpl::DesktopNotificationPostClick(int notification_id) { | 610 void RenderViewHostImpl::DesktopNotificationPostClick(int notification_id) { |
| 611 Send(new DesktopNotificationMsg_PostClick(GetRoutingID(), notification_id)); | 611 Send(new DesktopNotificationMsg_PostClick(GetRoutingID(), notification_id)); |
| 612 } | 612 } |
| 613 | 613 |
| 614 int RenderViewHostImpl::DocumentHasImages() { |
| 615 static int next_id = 1; |
| 616 Send(new ViewMsg_DocumentHasImages(GetRoutingID(), next_id)); |
| 617 return next_id++; |
| 618 } |
| 619 |
| 614 void RenderViewHostImpl::ExecuteJavascriptInWebFrame( | 620 void RenderViewHostImpl::ExecuteJavascriptInWebFrame( |
| 615 const string16& frame_xpath, | 621 const string16& frame_xpath, |
| 616 const string16& jscript) { | 622 const string16& jscript) { |
| 617 Send(new ViewMsg_ScriptEvalRequest(GetRoutingID(), frame_xpath, jscript, | 623 Send(new ViewMsg_ScriptEvalRequest(GetRoutingID(), frame_xpath, jscript, |
| 618 0, false)); | 624 0, false)); |
| 619 } | 625 } |
| 620 | 626 |
| 621 int RenderViewHostImpl::ExecuteJavascriptInWebFrameNotifyResult( | 627 int RenderViewHostImpl::ExecuteJavascriptInWebFrameNotifyResult( |
| 622 const string16& frame_xpath, | 628 const string16& frame_xpath, |
| 623 const string16& jscript) { | 629 const string16& jscript) { |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, | 924 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, |
| 919 OnCancelDesktopNotification) | 925 OnCancelDesktopNotification) |
| 920 #if defined(OS_MACOSX) | 926 #if defined(OS_MACOSX) |
| 921 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnMsgShowPopup) | 927 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnMsgShowPopup) |
| 922 #endif | 928 #endif |
| 923 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) | 929 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) |
| 924 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, | 930 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, |
| 925 OnDomOperationResponse) | 931 OnDomOperationResponse) |
| 926 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Notifications, | 932 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Notifications, |
| 927 OnAccessibilityNotifications) | 933 OnAccessibilityNotifications) |
| 934 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentHasImagesResponse, |
| 935 OnDocumentHasImagesResponse) |
| 928 // Have the super handle all other messages. | 936 // Have the super handle all other messages. |
| 929 IPC_MESSAGE_UNHANDLED( | 937 IPC_MESSAGE_UNHANDLED( |
| 930 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) | 938 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) |
| 931 IPC_END_MESSAGE_MAP_EX() | 939 IPC_END_MESSAGE_MAP_EX() |
| 932 | 940 |
| 933 if (!msg_is_ok) { | 941 if (!msg_is_ok) { |
| 934 // The message had a handler, but its de-serialization failed. | 942 // The message had a handler, but its de-serialization failed. |
| 935 // Kill the renderer. | 943 // Kill the renderer. |
| 936 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVH")); | 944 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVH")); |
| 937 GetProcess()->ReceivedBadMessage(); | 945 GetProcess()->ReceivedBadMessage(); |
| (...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1845 // beforeunload or unload acks. We clear them here to be safe, since they | 1853 // beforeunload or unload acks. We clear them here to be safe, since they |
| 1846 // can cause navigations to be ignored in OnMsgNavigate. | 1854 // can cause navigations to be ignored in OnMsgNavigate. |
| 1847 is_waiting_for_beforeunload_ack_ = false; | 1855 is_waiting_for_beforeunload_ack_ = false; |
| 1848 is_waiting_for_unload_ack_ = false; | 1856 is_waiting_for_unload_ack_ = false; |
| 1849 } | 1857 } |
| 1850 | 1858 |
| 1851 void RenderViewHostImpl::ClearPowerSaveBlockers() { | 1859 void RenderViewHostImpl::ClearPowerSaveBlockers() { |
| 1852 STLDeleteValues(&power_save_blockers_); | 1860 STLDeleteValues(&power_save_blockers_); |
| 1853 } | 1861 } |
| 1854 | 1862 |
| 1863 void RenderViewHostImpl::OnDocumentHasImagesResponse(int id, bool has_images) { |
| 1864 std::pair<int, bool> details(id, has_images); |
| 1865 content::NotificationService::current()->Notify( |
| 1866 content::NOTIFICATION_DOCUMENT_HAS_IMAGES_RESPONSE, |
| 1867 content::Source<RenderViewHost>(this), |
| 1868 content::Details<std::pair<int, bool> >(&details)); |
| 1869 } |
| 1870 |
| 1855 } // namespace content | 1871 } // namespace content |
| OLD | NEW |