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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 34 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
35 #include "content/browser/renderer_host/render_view_host_impl.h" | 35 #include "content/browser/renderer_host/render_view_host_impl.h" |
36 #include "content/browser/renderer_host/render_widget_host_impl.h" | 36 #include "content/browser/renderer_host/render_widget_host_impl.h" |
37 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 37 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
38 #include "content/browser/transition_request_manager.h" | 38 #include "content/browser/transition_request_manager.h" |
39 #include "content/common/accessibility_messages.h" | 39 #include "content/common/accessibility_messages.h" |
40 #include "content/common/frame_messages.h" | 40 #include "content/common/frame_messages.h" |
41 #include "content/common/input_messages.h" | 41 #include "content/common/input_messages.h" |
42 #include "content/common/inter_process_time_ticks_converter.h" | 42 #include "content/common/inter_process_time_ticks_converter.h" |
43 #include "content/common/navigation_params.h" | 43 #include "content/common/navigation_params.h" |
44 #include "content/common/platform_notification_messages.h" | |
45 #include "content/common/render_frame_setup.mojom.h" | 44 #include "content/common/render_frame_setup.mojom.h" |
46 #include "content/common/swapped_out_messages.h" | 45 #include "content/common/swapped_out_messages.h" |
47 #include "content/public/browser/ax_event_notification_details.h" | 46 #include "content/public/browser/ax_event_notification_details.h" |
48 #include "content/public/browser/browser_accessibility_state.h" | 47 #include "content/public/browser/browser_accessibility_state.h" |
49 #include "content/public/browser/browser_context.h" | 48 #include "content/public/browser/browser_context.h" |
50 #include "content/public/browser/browser_plugin_guest_manager.h" | 49 #include "content/public/browser/browser_plugin_guest_manager.h" |
51 #include "content/public/browser/browser_thread.h" | 50 #include "content/public/browser/browser_thread.h" |
52 #include "content/public/browser/content_browser_client.h" | 51 #include "content/public/browser/content_browser_client.h" |
53 #include "content/public/browser/desktop_notification_delegate.h" | |
54 #include "content/public/browser/render_process_host.h" | 52 #include "content/public/browser/render_process_host.h" |
55 #include "content/public/browser/render_widget_host_view.h" | 53 #include "content/public/browser/render_widget_host_view.h" |
56 #include "content/public/browser/stream_handle.h" | 54 #include "content/public/browser/stream_handle.h" |
57 #include "content/public/browser/user_metrics.h" | 55 #include "content/public/browser/user_metrics.h" |
58 #include "content/public/common/content_constants.h" | 56 #include "content/public/common/content_constants.h" |
59 #include "content/public/common/content_switches.h" | 57 #include "content/public/common/content_switches.h" |
60 #include "content/public/common/url_constants.h" | 58 #include "content/public/common/url_constants.h" |
61 #include "content/public/common/url_utils.h" | 59 #include "content/public/common/url_utils.h" |
62 #include "ui/accessibility/ax_tree.h" | 60 #include "ui/accessibility/ax_tree.h" |
63 #include "url/gurl.h" | 61 #include "url/gurl.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, | 316 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, |
319 OnRunBeforeUnloadConfirm) | 317 OnRunBeforeUnloadConfirm) |
320 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, | 318 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, |
321 OnDidAccessInitialDocument) | 319 OnDidAccessInitialDocument) |
322 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisownOpener, OnDidDisownOpener) | 320 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisownOpener, OnDidDisownOpener) |
323 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAssignPageId, OnDidAssignPageId) | 321 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAssignPageId, OnDidAssignPageId) |
324 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) | 322 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) |
325 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) | 323 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) |
326 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, | 324 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, |
327 OnBeginNavigation) | 325 OnBeginNavigation) |
328 IPC_MESSAGE_HANDLER(PlatformNotificationHostMsg_RequestPermission, | |
329 OnRequestPlatformNotificationPermission) | |
330 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, | 326 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, |
331 OnTextSurroundingSelectionResponse) | 327 OnTextSurroundingSelectionResponse) |
332 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) | 328 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) |
333 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, | 329 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, |
334 OnAccessibilityLocationChanges) | 330 OnAccessibilityLocationChanges) |
335 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, | 331 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, |
336 OnAccessibilityFindInPageResult) | 332 OnAccessibilityFindInPageResult) |
337 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 333 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
338 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) | 334 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) |
339 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) | 335 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 const base::string16& message, | 925 const base::string16& message, |
930 bool is_reload, | 926 bool is_reload, |
931 IPC::Message* reply_msg) { | 927 IPC::Message* reply_msg) { |
932 // While a JS beforeunload dialog is showing, tabs in the same process | 928 // While a JS beforeunload dialog is showing, tabs in the same process |
933 // shouldn't process input events. | 929 // shouldn't process input events. |
934 GetProcess()->SetIgnoreInputEvents(true); | 930 GetProcess()->SetIgnoreInputEvents(true); |
935 render_view_host_->StopHangMonitorTimeout(); | 931 render_view_host_->StopHangMonitorTimeout(); |
936 delegate_->RunBeforeUnloadConfirm(this, message, is_reload, reply_msg); | 932 delegate_->RunBeforeUnloadConfirm(this, message, is_reload, reply_msg); |
937 } | 933 } |
938 | 934 |
939 void RenderFrameHostImpl::OnRequestPlatformNotificationPermission( | |
940 const GURL& origin, int request_id) { | |
941 base::Callback<void(bool)> done_callback = base::Bind( | |
942 &RenderFrameHostImpl::PlatformNotificationPermissionRequestDone, | |
943 weak_ptr_factory_.GetWeakPtr(), | |
944 request_id); | |
945 | |
946 if (!delegate()->GetAsWebContents()) | |
947 return; | |
948 | |
949 // TODO(peter): plumb user_gesture and bridge_id. | |
950 GetContentClient()->browser()->RequestPermission( | |
951 content::PERMISSION_NOTIFICATIONS, | |
952 delegate()->GetAsWebContents(), | |
953 routing_id_, | |
954 origin, | |
955 true, // user_gesture, | |
956 done_callback); | |
957 } | |
958 | |
959 void RenderFrameHostImpl::OnTextSurroundingSelectionResponse( | 935 void RenderFrameHostImpl::OnTextSurroundingSelectionResponse( |
960 const base::string16& content, | 936 const base::string16& content, |
961 size_t start_offset, | 937 size_t start_offset, |
962 size_t end_offset) { | 938 size_t end_offset) { |
963 render_view_host_->OnTextSurroundingSelectionResponse( | 939 render_view_host_->OnTextSurroundingSelectionResponse( |
964 content, start_offset, end_offset); | 940 content, start_offset, end_offset); |
965 } | 941 } |
966 | 942 |
967 void RenderFrameHostImpl::OnDidAccessInitialDocument() { | 943 void RenderFrameHostImpl::OnDidAccessInitialDocument() { |
968 delegate_->DidAccessInitialDocument(); | 944 delegate_->DidAccessInitialDocument(); |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 void RenderFrameHostImpl::InvalidateMojoConnection() { | 1389 void RenderFrameHostImpl::InvalidateMojoConnection() { |
1414 #if defined(OS_ANDROID) | 1390 #if defined(OS_ANDROID) |
1415 // The Android-specific service registry has a reference to | 1391 // The Android-specific service registry has a reference to |
1416 // |service_registry_| and thus must be torn down first. | 1392 // |service_registry_| and thus must be torn down first. |
1417 service_registry_android_.reset(); | 1393 service_registry_android_.reset(); |
1418 #endif | 1394 #endif |
1419 | 1395 |
1420 service_registry_.reset(); | 1396 service_registry_.reset(); |
1421 } | 1397 } |
1422 | 1398 |
1423 void RenderFrameHostImpl::PlatformNotificationPermissionRequestDone( | |
1424 int request_id, | |
1425 bool granted) { | |
1426 blink::WebNotificationPermission permission = | |
1427 granted ? blink::WebNotificationPermissionAllowed | |
1428 : blink::WebNotificationPermissionDenied; | |
1429 | |
1430 Send(new PlatformNotificationMsg_PermissionRequestComplete( | |
1431 routing_id_, request_id, permission)); | |
1432 } | |
1433 | |
1434 void RenderFrameHostImpl::UpdateCrossProcessIframeAccessibility( | 1399 void RenderFrameHostImpl::UpdateCrossProcessIframeAccessibility( |
1435 const std::map<int32, int>& node_to_frame_routing_id_map) { | 1400 const std::map<int32, int>& node_to_frame_routing_id_map) { |
1436 for (const auto& iter : node_to_frame_routing_id_map) { | 1401 for (const auto& iter : node_to_frame_routing_id_map) { |
1437 // This is the id of the accessibility node that has a child frame. | 1402 // This is the id of the accessibility node that has a child frame. |
1438 int32 node_id = iter.first; | 1403 int32 node_id = iter.first; |
1439 // The routing id from either a RenderFrame or a RenderFrameProxy. | 1404 // The routing id from either a RenderFrame or a RenderFrameProxy. |
1440 int frame_routing_id = iter.second; | 1405 int frame_routing_id = iter.second; |
1441 | 1406 |
1442 FrameTree* frame_tree = frame_tree_node()->frame_tree(); | 1407 FrameTree* frame_tree = frame_tree_node()->frame_tree(); |
1443 FrameTreeNode* child_frame_tree_node = frame_tree->FindByRoutingID( | 1408 FrameTreeNode* child_frame_tree_node = frame_tree->FindByRoutingID( |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 void RenderFrameHostImpl::DidUseGeolocationPermission() { | 1559 void RenderFrameHostImpl::DidUseGeolocationPermission() { |
1595 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); | 1560 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); |
1596 GetContentClient()->browser()->RegisterPermissionUsage( | 1561 GetContentClient()->browser()->RegisterPermissionUsage( |
1597 PERMISSION_GEOLOCATION, | 1562 PERMISSION_GEOLOCATION, |
1598 delegate_->GetAsWebContents(), | 1563 delegate_->GetAsWebContents(), |
1599 GetLastCommittedURL().GetOrigin(), | 1564 GetLastCommittedURL().GetOrigin(), |
1600 top_frame->GetLastCommittedURL().GetOrigin()); | 1565 top_frame->GetLastCommittedURL().GetOrigin()); |
1601 } | 1566 } |
1602 | 1567 |
1603 } // namespace content | 1568 } // namespace content |
OLD | NEW |