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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "content/browser/frame_host/frame_tree.h" | 30 #include "content/browser/frame_host/frame_tree.h" |
31 #include "content/browser/frame_host/frame_tree_node.h" | 31 #include "content/browser/frame_host/frame_tree_node.h" |
32 #include "content/browser/frame_host/navigation_handle_impl.h" | 32 #include "content/browser/frame_host/navigation_handle_impl.h" |
33 #include "content/browser/frame_host/navigation_request.h" | 33 #include "content/browser/frame_host/navigation_request.h" |
34 #include "content/browser/frame_host/navigator.h" | 34 #include "content/browser/frame_host/navigator.h" |
35 #include "content/browser/frame_host/navigator_impl.h" | 35 #include "content/browser/frame_host/navigator_impl.h" |
36 #include "content/browser/frame_host/render_frame_host_delegate.h" | 36 #include "content/browser/frame_host/render_frame_host_delegate.h" |
37 #include "content/browser/frame_host/render_frame_proxy_host.h" | 37 #include "content/browser/frame_host/render_frame_proxy_host.h" |
38 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 38 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
39 #include "content/browser/geolocation/geolocation_service_context.h" | 39 #include "content/browser/geolocation/geolocation_service_context.h" |
| 40 #include "content/browser/host_zoom_map_impl.h" |
40 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 41 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
41 #include "content/browser/permissions/permission_service_context.h" | 42 #include "content/browser/permissions/permission_service_context.h" |
42 #include "content/browser/permissions/permission_service_impl.h" | 43 #include "content/browser/permissions/permission_service_impl.h" |
43 #include "content/browser/presentation/presentation_service_impl.h" | 44 #include "content/browser/presentation/presentation_service_impl.h" |
44 #include "content/browser/renderer_host/input/input_router_impl.h" | 45 #include "content/browser/renderer_host/input/input_router_impl.h" |
45 #include "content/browser/renderer_host/input/timeout_monitor.h" | 46 #include "content/browser/renderer_host/input/timeout_monitor.h" |
46 #include "content/browser/renderer_host/render_process_host_impl.h" | 47 #include "content/browser/renderer_host/render_process_host_impl.h" |
47 #include "content/browser/renderer_host/render_view_host_delegate.h" | 48 #include "content/browser/renderer_host/render_view_host_delegate.h" |
48 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 49 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
49 #include "content/browser/renderer_host/render_view_host_impl.h" | 50 #include "content/browser/renderer_host/render_view_host_impl.h" |
(...skipping 13 matching lines...) Expand all Loading... |
63 #include "content/public/browser/ax_event_notification_details.h" | 64 #include "content/public/browser/ax_event_notification_details.h" |
64 #include "content/public/browser/browser_accessibility_state.h" | 65 #include "content/public/browser/browser_accessibility_state.h" |
65 #include "content/public/browser/browser_context.h" | 66 #include "content/public/browser/browser_context.h" |
66 #include "content/public/browser/browser_plugin_guest_manager.h" | 67 #include "content/public/browser/browser_plugin_guest_manager.h" |
67 #include "content/public/browser/browser_thread.h" | 68 #include "content/public/browser/browser_thread.h" |
68 #include "content/public/browser/content_browser_client.h" | 69 #include "content/public/browser/content_browser_client.h" |
69 #include "content/public/browser/permission_manager.h" | 70 #include "content/public/browser/permission_manager.h" |
70 #include "content/public/browser/permission_type.h" | 71 #include "content/public/browser/permission_type.h" |
71 #include "content/public/browser/render_process_host.h" | 72 #include "content/public/browser/render_process_host.h" |
72 #include "content/public/browser/render_widget_host_view.h" | 73 #include "content/public/browser/render_widget_host_view.h" |
| 74 #include "content/public/browser/storage_partition.h" |
73 #include "content/public/browser/stream_handle.h" | 75 #include "content/public/browser/stream_handle.h" |
74 #include "content/public/browser/user_metrics.h" | 76 #include "content/public/browser/user_metrics.h" |
75 #include "content/public/common/browser_side_navigation_policy.h" | 77 #include "content/public/common/browser_side_navigation_policy.h" |
76 #include "content/public/common/content_constants.h" | 78 #include "content/public/common/content_constants.h" |
77 #include "content/public/common/content_switches.h" | 79 #include "content/public/common/content_switches.h" |
78 #include "content/public/common/isolated_world_ids.h" | 80 #include "content/public/common/isolated_world_ids.h" |
79 #include "content/public/common/url_constants.h" | 81 #include "content/public/common/url_constants.h" |
80 #include "content/public/common/url_utils.h" | 82 #include "content/public/common/url_utils.h" |
81 #include "device/vibration/vibration_manager_impl.h" | 83 #include "device/vibration/vibration_manager_impl.h" |
82 #include "ui/accessibility/ax_tree.h" | 84 #include "ui/accessibility/ax_tree.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 RenderViewHostImpl* render_view_host, | 203 RenderViewHostImpl* render_view_host, |
202 RenderFrameHostDelegate* delegate, | 204 RenderFrameHostDelegate* delegate, |
203 RenderWidgetHostDelegate* rwh_delegate, | 205 RenderWidgetHostDelegate* rwh_delegate, |
204 FrameTree* frame_tree, | 206 FrameTree* frame_tree, |
205 FrameTreeNode* frame_tree_node, | 207 FrameTreeNode* frame_tree_node, |
206 int32_t routing_id, | 208 int32_t routing_id, |
207 int32_t widget_routing_id, | 209 int32_t widget_routing_id, |
208 bool hidden) | 210 bool hidden) |
209 : render_view_host_(render_view_host), | 211 : render_view_host_(render_view_host), |
210 delegate_(delegate), | 212 delegate_(delegate), |
| 213 frame_host_binding_(this), |
211 site_instance_(static_cast<SiteInstanceImpl*>(site_instance)), | 214 site_instance_(static_cast<SiteInstanceImpl*>(site_instance)), |
212 process_(site_instance->GetProcess()), | 215 process_(site_instance->GetProcess()), |
213 cross_process_frame_connector_(NULL), | 216 cross_process_frame_connector_(NULL), |
214 render_frame_proxy_host_(NULL), | 217 render_frame_proxy_host_(NULL), |
215 frame_tree_(frame_tree), | 218 frame_tree_(frame_tree), |
216 frame_tree_node_(frame_tree_node), | 219 frame_tree_node_(frame_tree_node), |
217 render_widget_host_(nullptr), | 220 render_widget_host_(nullptr), |
218 routing_id_(routing_id), | 221 routing_id_(routing_id), |
219 is_waiting_for_swapout_ack_(false), | 222 is_waiting_for_swapout_ack_(false), |
220 render_frame_created_(false), | 223 render_frame_created_(false), |
(...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1980 #if defined(ENABLE_WEBVR) | 1983 #if defined(ENABLE_WEBVR) |
1981 const base::CommandLine& browser_command_line = | 1984 const base::CommandLine& browser_command_line = |
1982 *base::CommandLine::ForCurrentProcess(); | 1985 *base::CommandLine::ForCurrentProcess(); |
1983 | 1986 |
1984 if (browser_command_line.HasSwitch(switches::kEnableWebVR)) { | 1987 if (browser_command_line.HasSwitch(switches::kEnableWebVR)) { |
1985 GetServiceRegistry()->AddService<blink::mojom::VRService>( | 1988 GetServiceRegistry()->AddService<blink::mojom::VRService>( |
1986 base::Bind(&VRDeviceManager::BindRequest)); | 1989 base::Bind(&VRDeviceManager::BindRequest)); |
1987 } | 1990 } |
1988 #endif | 1991 #endif |
1989 | 1992 |
| 1993 GetServiceRegistry()->AddService<mojom::FrameHost>(base::Bind( |
| 1994 &RenderFrameHostImpl::BindFrameHostService, base::Unretained(this))); |
| 1995 |
1990 GetContentClient()->browser()->RegisterRenderFrameMojoServices( | 1996 GetContentClient()->browser()->RegisterRenderFrameMojoServices( |
1991 GetServiceRegistry(), this); | 1997 GetServiceRegistry(), this); |
1992 } | 1998 } |
1993 | 1999 |
1994 void RenderFrameHostImpl::ResetWaitingState() { | 2000 void RenderFrameHostImpl::ResetWaitingState() { |
1995 DCHECK(is_active()); | 2001 DCHECK(is_active()); |
1996 | 2002 |
1997 // The active state of the RVH is determined by its main frame, since | 2003 // The active state of the RVH is determined by its main frame, since |
1998 // subframes should have their own widgets. | 2004 // subframes should have their own widgets. |
1999 if (frame_tree_node_->IsMainFrame()) { | 2005 if (frame_tree_node_->IsMainFrame()) { |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2562 | 2568 |
2563 return is_live; | 2569 return is_live; |
2564 } | 2570 } |
2565 | 2571 |
2566 int RenderFrameHostImpl::GetProxyCount() { | 2572 int RenderFrameHostImpl::GetProxyCount() { |
2567 if (this != frame_tree_node_->current_frame_host()) | 2573 if (this != frame_tree_node_->current_frame_host()) |
2568 return 0; | 2574 return 0; |
2569 return frame_tree_node_->render_manager()->GetProxyCount(); | 2575 return frame_tree_node_->render_manager()->GetProxyCount(); |
2570 } | 2576 } |
2571 | 2577 |
| 2578 void RenderFrameHostImpl::GetHostZoomLevel( |
| 2579 const GURL& url, |
| 2580 const GetHostZoomLevelCallback& callback) { |
| 2581 RenderProcessHost* render_process_host = |
| 2582 RenderProcessHost::FromID(GetProcess()->GetID()); |
| 2583 double zoom_level = 0.0; |
| 2584 if (render_process_host) { |
| 2585 const HostZoomMapImpl* host_zoom_map = static_cast<const HostZoomMapImpl*>( |
| 2586 render_process_host->GetStoragePartition()->GetHostZoomMap()); |
| 2587 zoom_level = host_zoom_map->GetZoomLevelForView(url, GetProcess()->GetID(), |
| 2588 routing_id_); |
| 2589 } |
| 2590 callback.Run(zoom_level); |
| 2591 } |
| 2592 |
2572 #if defined(OS_MACOSX) | 2593 #if defined(OS_MACOSX) |
2573 | 2594 |
2574 void RenderFrameHostImpl::DidSelectPopupMenuItem(int selected_index) { | 2595 void RenderFrameHostImpl::DidSelectPopupMenuItem(int selected_index) { |
2575 Send(new FrameMsg_SelectPopupMenuItem(routing_id_, selected_index)); | 2596 Send(new FrameMsg_SelectPopupMenuItem(routing_id_, selected_index)); |
2576 } | 2597 } |
2577 | 2598 |
2578 void RenderFrameHostImpl::DidCancelPopupMenu() { | 2599 void RenderFrameHostImpl::DidCancelPopupMenu() { |
2579 Send(new FrameMsg_SelectPopupMenuItem(routing_id_, -1)); | 2600 Send(new FrameMsg_SelectPopupMenuItem(routing_id_, -1)); |
2580 } | 2601 } |
2581 | 2602 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2790 // For the root frame tree node, also store the AXTreeID of the focused frame. | 2811 // For the root frame tree node, also store the AXTreeID of the focused frame. |
2791 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame(); | 2812 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame(); |
2792 if (!focused_frame_tree_node) | 2813 if (!focused_frame_tree_node) |
2793 return; | 2814 return; |
2794 RenderFrameHostImpl* focused_frame = | 2815 RenderFrameHostImpl* focused_frame = |
2795 focused_frame_tree_node->current_frame_host(); | 2816 focused_frame_tree_node->current_frame_host(); |
2796 DCHECK(focused_frame); | 2817 DCHECK(focused_frame); |
2797 dst->focused_tree_id = focused_frame->GetAXTreeID(); | 2818 dst->focused_tree_id = focused_frame->GetAXTreeID(); |
2798 } | 2819 } |
2799 | 2820 |
| 2821 void RenderFrameHostImpl::BindFrameHostService( |
| 2822 mojom::FrameHostRequest request) { |
| 2823 frame_host_binding_.Bind(std::move(request)); |
| 2824 frame_host_binding_.set_connection_error_handler( |
| 2825 base::Bind(&mojo::Binding<mojom::FrameHost>::Unbind, |
| 2826 base::Unretained(&frame_host_binding_))); |
| 2827 } |
| 2828 |
2800 void RenderFrameHostImpl::CreateWebBluetoothService( | 2829 void RenderFrameHostImpl::CreateWebBluetoothService( |
2801 blink::mojom::WebBluetoothServiceRequest request) { | 2830 blink::mojom::WebBluetoothServiceRequest request) { |
2802 DCHECK(!web_bluetooth_service_); | 2831 DCHECK(!web_bluetooth_service_); |
2803 web_bluetooth_service_.reset( | 2832 web_bluetooth_service_.reset( |
2804 new WebBluetoothServiceImpl(this, std::move(request))); | 2833 new WebBluetoothServiceImpl(this, std::move(request))); |
2805 // RFHI owns web_bluetooth_service_ and web_bluetooth_service owns the | 2834 // RFHI owns web_bluetooth_service_ and web_bluetooth_service owns the |
2806 // binding_ which may run the error handler. binding_ can't run the error | 2835 // binding_ which may run the error handler. binding_ can't run the error |
2807 // handler after it's destroyed so it can't run after the RFHI is destroyed. | 2836 // handler after it's destroyed so it can't run after the RFHI is destroyed. |
2808 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 2837 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
2809 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 2838 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
2810 } | 2839 } |
2811 | 2840 |
2812 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 2841 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
2813 web_bluetooth_service_.reset(); | 2842 web_bluetooth_service_.reset(); |
2814 } | 2843 } |
2815 | 2844 |
2816 } // namespace content | 2845 } // namespace content |
OLD | NEW |