| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/metrics/user_metrics_action.h" | 10 #include "base/metrics/user_metrics_action.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "content/browser/renderer_host/render_process_host_impl.h" | 25 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 26 #include "content/browser/renderer_host/render_view_host_impl.h" | 26 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 27 #include "content/browser/renderer_host/render_widget_host_impl.h" | 27 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 28 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 28 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 29 #include "content/browser/transition_request_manager.h" | 29 #include "content/browser/transition_request_manager.h" |
| 30 #include "content/common/accessibility_messages.h" | 30 #include "content/common/accessibility_messages.h" |
| 31 #include "content/common/desktop_notification_messages.h" | 31 #include "content/common/desktop_notification_messages.h" |
| 32 #include "content/common/frame_messages.h" | 32 #include "content/common/frame_messages.h" |
| 33 #include "content/common/input_messages.h" | 33 #include "content/common/input_messages.h" |
| 34 #include "content/common/inter_process_time_ticks_converter.h" | 34 #include "content/common/inter_process_time_ticks_converter.h" |
| 35 #include "content/common/platform_notification_messages.h" |
| 35 #include "content/common/render_frame_setup.mojom.h" | 36 #include "content/common/render_frame_setup.mojom.h" |
| 36 #include "content/common/swapped_out_messages.h" | 37 #include "content/common/swapped_out_messages.h" |
| 37 #include "content/public/browser/ax_event_notification_details.h" | 38 #include "content/public/browser/ax_event_notification_details.h" |
| 38 #include "content/public/browser/browser_accessibility_state.h" | 39 #include "content/public/browser/browser_accessibility_state.h" |
| 39 #include "content/public/browser/browser_thread.h" | 40 #include "content/public/browser/browser_thread.h" |
| 40 #include "content/public/browser/content_browser_client.h" | 41 #include "content/public/browser/content_browser_client.h" |
| 41 #include "content/public/browser/desktop_notification_delegate.h" | 42 #include "content/public/browser/desktop_notification_delegate.h" |
| 42 #include "content/public/browser/render_process_host.h" | 43 #include "content/public/browser/render_process_host.h" |
| 43 #include "content/public/browser/render_widget_host_view.h" | 44 #include "content/public/browser/render_widget_host_view.h" |
| 44 #include "content/public/browser/user_metrics.h" | 45 #include "content/public/browser/user_metrics.h" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 OnRunJavaScriptMessage) | 340 OnRunJavaScriptMessage) |
| 340 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, | 341 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, |
| 341 OnRunBeforeUnloadConfirm) | 342 OnRunBeforeUnloadConfirm) |
| 342 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, | 343 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, |
| 343 OnDidAccessInitialDocument) | 344 OnDidAccessInitialDocument) |
| 344 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisownOpener, OnDidDisownOpener) | 345 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisownOpener, OnDidDisownOpener) |
| 345 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) | 346 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) |
| 346 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) | 347 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) |
| 347 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, | 348 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, |
| 348 OnBeginNavigation) | 349 OnBeginNavigation) |
| 350 IPC_MESSAGE_HANDLER(PlatformNotificationHostMsg_RequestPermission, |
| 351 OnRequestPlatformNotificationPermission) |
| 349 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission, | 352 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission, |
| 350 OnRequestDesktopNotificationPermission) | 353 OnRequestDesktopNotificationPermission) |
| 351 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show, | 354 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show, |
| 352 OnShowDesktopNotification) | 355 OnShowDesktopNotification) |
| 353 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, | 356 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, |
| 354 OnCancelDesktopNotification) | 357 OnCancelDesktopNotification) |
| 355 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, | 358 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, |
| 356 OnTextSurroundingSelectionResponse) | 359 OnTextSurroundingSelectionResponse) |
| 357 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) | 360 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) |
| 358 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, | 361 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 const base::string16& message, | 796 const base::string16& message, |
| 794 bool is_reload, | 797 bool is_reload, |
| 795 IPC::Message* reply_msg) { | 798 IPC::Message* reply_msg) { |
| 796 // While a JS before unload dialog is showing, tabs in the same process | 799 // While a JS before unload dialog is showing, tabs in the same process |
| 797 // shouldn't process input events. | 800 // shouldn't process input events. |
| 798 GetProcess()->SetIgnoreInputEvents(true); | 801 GetProcess()->SetIgnoreInputEvents(true); |
| 799 render_view_host_->StopHangMonitorTimeout(); | 802 render_view_host_->StopHangMonitorTimeout(); |
| 800 delegate_->RunBeforeUnloadConfirm(this, message, is_reload, reply_msg); | 803 delegate_->RunBeforeUnloadConfirm(this, message, is_reload, reply_msg); |
| 801 } | 804 } |
| 802 | 805 |
| 806 void RenderFrameHostImpl::OnRequestPlatformNotificationPermission( |
| 807 const GURL& origin, int request_id) { |
| 808 base::Callback<void(blink::WebNotificationPermission)> done_callback = |
| 809 base::Bind( |
| 810 &RenderFrameHostImpl::PlatformNotificationPermissionRequestDone, |
| 811 weak_ptr_factory_.GetWeakPtr(), |
| 812 request_id); |
| 813 |
| 814 GetContentClient()->browser()->RequestDesktopNotificationPermission( |
| 815 origin, this, done_callback); |
| 816 } |
| 817 |
| 818 // TODO(peter): Remove this call and the associated IPC messages when Blink |
| 819 // has switched to the new Web Notification permission code-path. |
| 803 void RenderFrameHostImpl::OnRequestDesktopNotificationPermission( | 820 void RenderFrameHostImpl::OnRequestDesktopNotificationPermission( |
| 804 const GURL& source_origin, int callback_context) { | 821 const GURL& source_origin, int callback_context) { |
| 805 base::Callback<void(blink::WebNotificationPermission)> done_callback = | 822 base::Callback<void(blink::WebNotificationPermission)> done_callback = |
| 806 base::Bind(&RenderFrameHostImpl::DesktopNotificationPermissionRequestDone, | 823 base::Bind(&RenderFrameHostImpl::DesktopNotificationPermissionRequestDone, |
| 807 weak_ptr_factory_.GetWeakPtr(), | 824 weak_ptr_factory_.GetWeakPtr(), |
| 808 callback_context); | 825 callback_context); |
| 809 | 826 |
| 810 GetContentClient()->browser()->RequestDesktopNotificationPermission( | 827 GetContentClient()->browser()->RequestDesktopNotificationPermission( |
| 811 source_origin, this, done_callback); | 828 source_origin, this, done_callback); |
| 812 } | 829 } |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 render_view_host_->delegate_->RendererUnresponsive( | 1122 render_view_host_->delegate_->RendererUnresponsive( |
| 1106 render_view_host_, | 1123 render_view_host_, |
| 1107 render_view_host_->is_waiting_for_beforeunload_ack(), | 1124 render_view_host_->is_waiting_for_beforeunload_ack(), |
| 1108 render_view_host_->IsWaitingForUnloadACK()); | 1125 render_view_host_->IsWaitingForUnloadACK()); |
| 1109 } | 1126 } |
| 1110 | 1127 |
| 1111 void RenderFrameHostImpl::NotificationClosed(int notification_id) { | 1128 void RenderFrameHostImpl::NotificationClosed(int notification_id) { |
| 1112 cancel_notification_callbacks_.erase(notification_id); | 1129 cancel_notification_callbacks_.erase(notification_id); |
| 1113 } | 1130 } |
| 1114 | 1131 |
| 1132 void RenderFrameHostImpl::PlatformNotificationPermissionRequestDone( |
| 1133 int request_id, blink::WebNotificationPermission permission) { |
| 1134 Send(new PlatformNotificationMsg_PermissionRequestComplete( |
| 1135 routing_id_, request_id, permission)); |
| 1136 } |
| 1137 |
| 1138 // TODO(peter): Remove this method when Blink uses the new code-path. |
| 1115 void RenderFrameHostImpl::DesktopNotificationPermissionRequestDone( | 1139 void RenderFrameHostImpl::DesktopNotificationPermissionRequestDone( |
| 1116 int callback_context, blink::WebNotificationPermission permission) { | 1140 int callback_context, blink::WebNotificationPermission permission) { |
| 1117 Send(new DesktopNotificationMsg_PermissionRequestDone( | 1141 Send(new DesktopNotificationMsg_PermissionRequestDone( |
| 1118 routing_id_, callback_context)); | 1142 routing_id_, callback_context)); |
| 1119 } | 1143 } |
| 1120 | 1144 |
| 1121 void RenderFrameHostImpl::SetAccessibilityMode(AccessibilityMode mode) { | 1145 void RenderFrameHostImpl::SetAccessibilityMode(AccessibilityMode mode) { |
| 1122 Send(new FrameMsg_SetAccessibilityMode(routing_id_, mode)); | 1146 Send(new FrameMsg_SetAccessibilityMode(routing_id_, mode)); |
| 1123 } | 1147 } |
| 1124 | 1148 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1165 FROM_HERE, | 1189 FROM_HERE, |
| 1166 base::Bind( | 1190 base::Bind( |
| 1167 &TransitionRequestManager::SetHasPendingTransitionRequest, | 1191 &TransitionRequestManager::SetHasPendingTransitionRequest, |
| 1168 base::Unretained(TransitionRequestManager::GetInstance()), | 1192 base::Unretained(TransitionRequestManager::GetInstance()), |
| 1169 GetProcess()->GetID(), | 1193 GetProcess()->GetID(), |
| 1170 routing_id_, | 1194 routing_id_, |
| 1171 has_pending_request)); | 1195 has_pending_request)); |
| 1172 } | 1196 } |
| 1173 | 1197 |
| 1174 } // namespace content | 1198 } // namespace content |
| OLD | NEW |