| 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 OnRunBeforeUnloadConfirm) | 343 OnRunBeforeUnloadConfirm) |
| 344 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, | 344 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, |
| 345 OnDidAccessInitialDocument) | 345 OnDidAccessInitialDocument) |
| 346 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisownOpener, OnDidDisownOpener) | 346 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisownOpener, OnDidDisownOpener) |
| 347 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) | 347 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) |
| 348 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) | 348 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) |
| 349 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, | 349 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, |
| 350 OnBeginNavigation) | 350 OnBeginNavigation) |
| 351 IPC_MESSAGE_HANDLER(PlatformNotificationHostMsg_RequestPermission, | 351 IPC_MESSAGE_HANDLER(PlatformNotificationHostMsg_RequestPermission, |
| 352 OnRequestPlatformNotificationPermission) | 352 OnRequestPlatformNotificationPermission) |
| 353 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission, | |
| 354 OnRequestDesktopNotificationPermission) | |
| 355 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show, | 353 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show, |
| 356 OnShowDesktopNotification) | 354 OnShowDesktopNotification) |
| 357 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, | 355 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, |
| 358 OnCancelDesktopNotification) | 356 OnCancelDesktopNotification) |
| 359 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, | 357 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, |
| 360 OnTextSurroundingSelectionResponse) | 358 OnTextSurroundingSelectionResponse) |
| 361 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) | 359 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) |
| 362 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, | 360 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, |
| 363 OnAccessibilityLocationChanges) | 361 OnAccessibilityLocationChanges) |
| 364 IPC_END_MESSAGE_MAP() | 362 IPC_END_MESSAGE_MAP() |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 base::Callback<void(blink::WebNotificationPermission)> done_callback = | 832 base::Callback<void(blink::WebNotificationPermission)> done_callback = |
| 835 base::Bind( | 833 base::Bind( |
| 836 &RenderFrameHostImpl::PlatformNotificationPermissionRequestDone, | 834 &RenderFrameHostImpl::PlatformNotificationPermissionRequestDone, |
| 837 weak_ptr_factory_.GetWeakPtr(), | 835 weak_ptr_factory_.GetWeakPtr(), |
| 838 request_id); | 836 request_id); |
| 839 | 837 |
| 840 GetContentClient()->browser()->RequestDesktopNotificationPermission( | 838 GetContentClient()->browser()->RequestDesktopNotificationPermission( |
| 841 origin, this, done_callback); | 839 origin, this, done_callback); |
| 842 } | 840 } |
| 843 | 841 |
| 844 // TODO(peter): Remove this call and the associated IPC messages when Blink | |
| 845 // has switched to the new Web Notification permission code-path. | |
| 846 void RenderFrameHostImpl::OnRequestDesktopNotificationPermission( | |
| 847 const GURL& source_origin, int callback_context) { | |
| 848 base::Callback<void(blink::WebNotificationPermission)> done_callback = | |
| 849 base::Bind(&RenderFrameHostImpl::DesktopNotificationPermissionRequestDone, | |
| 850 weak_ptr_factory_.GetWeakPtr(), | |
| 851 callback_context); | |
| 852 | |
| 853 GetContentClient()->browser()->RequestDesktopNotificationPermission( | |
| 854 source_origin, this, done_callback); | |
| 855 } | |
| 856 | |
| 857 void RenderFrameHostImpl::OnShowDesktopNotification( | 842 void RenderFrameHostImpl::OnShowDesktopNotification( |
| 858 int notification_id, | 843 int notification_id, |
| 859 const ShowDesktopNotificationHostMsgParams& params) { | 844 const ShowDesktopNotificationHostMsgParams& params) { |
| 860 scoped_ptr<DesktopNotificationDelegateImpl> delegate( | 845 scoped_ptr<DesktopNotificationDelegateImpl> delegate( |
| 861 new DesktopNotificationDelegateImpl(this, notification_id)); | 846 new DesktopNotificationDelegateImpl(this, notification_id)); |
| 862 | 847 |
| 863 base::Closure cancel_callback; | 848 base::Closure cancel_callback; |
| 864 GetContentClient()->browser()->ShowDesktopNotification( | 849 GetContentClient()->browser()->ShowDesktopNotification( |
| 865 params, | 850 params, |
| 866 this, | 851 this, |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 void RenderFrameHostImpl::NotificationClosed(int notification_id) { | 1141 void RenderFrameHostImpl::NotificationClosed(int notification_id) { |
| 1157 cancel_notification_callbacks_.erase(notification_id); | 1142 cancel_notification_callbacks_.erase(notification_id); |
| 1158 } | 1143 } |
| 1159 | 1144 |
| 1160 void RenderFrameHostImpl::PlatformNotificationPermissionRequestDone( | 1145 void RenderFrameHostImpl::PlatformNotificationPermissionRequestDone( |
| 1161 int request_id, blink::WebNotificationPermission permission) { | 1146 int request_id, blink::WebNotificationPermission permission) { |
| 1162 Send(new PlatformNotificationMsg_PermissionRequestComplete( | 1147 Send(new PlatformNotificationMsg_PermissionRequestComplete( |
| 1163 routing_id_, request_id, permission)); | 1148 routing_id_, request_id, permission)); |
| 1164 } | 1149 } |
| 1165 | 1150 |
| 1166 // TODO(peter): Remove this method when Blink uses the new code-path. | |
| 1167 void RenderFrameHostImpl::DesktopNotificationPermissionRequestDone( | |
| 1168 int callback_context, blink::WebNotificationPermission permission) { | |
| 1169 Send(new DesktopNotificationMsg_PermissionRequestDone( | |
| 1170 routing_id_, callback_context)); | |
| 1171 } | |
| 1172 | |
| 1173 void RenderFrameHostImpl::SetAccessibilityMode(AccessibilityMode mode) { | 1151 void RenderFrameHostImpl::SetAccessibilityMode(AccessibilityMode mode) { |
| 1174 Send(new FrameMsg_SetAccessibilityMode(routing_id_, mode)); | 1152 Send(new FrameMsg_SetAccessibilityMode(routing_id_, mode)); |
| 1175 } | 1153 } |
| 1176 | 1154 |
| 1177 void RenderFrameHostImpl::SetAccessibilityCallbackForTesting( | 1155 void RenderFrameHostImpl::SetAccessibilityCallbackForTesting( |
| 1178 const base::Callback<void(ui::AXEvent, int)>& callback) { | 1156 const base::Callback<void(ui::AXEvent, int)>& callback) { |
| 1179 accessibility_testing_callback_ = callback; | 1157 accessibility_testing_callback_ = callback; |
| 1180 } | 1158 } |
| 1181 | 1159 |
| 1182 const ui::AXTree* RenderFrameHostImpl::GetAXTreeForTesting() { | 1160 const ui::AXTree* RenderFrameHostImpl::GetAXTreeForTesting() { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1217 FROM_HERE, | 1195 FROM_HERE, |
| 1218 base::Bind( | 1196 base::Bind( |
| 1219 &TransitionRequestManager::SetHasPendingTransitionRequest, | 1197 &TransitionRequestManager::SetHasPendingTransitionRequest, |
| 1220 base::Unretained(TransitionRequestManager::GetInstance()), | 1198 base::Unretained(TransitionRequestManager::GetInstance()), |
| 1221 GetProcess()->GetID(), | 1199 GetProcess()->GetID(), |
| 1222 routing_id_, | 1200 routing_id_, |
| 1223 has_pending_request)); | 1201 has_pending_request)); |
| 1224 } | 1202 } |
| 1225 | 1203 |
| 1226 } // namespace content | 1204 } // namespace content |
| OLD | NEW |