Chromium Code Reviews| 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 "ui/accessibility/ax_tree.h" | 83 #include "ui/accessibility/ax_tree.h" |
| 82 #include "ui/accessibility/ax_tree_update.h" | 84 #include "ui/accessibility/ax_tree_update.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 RenderViewHostImpl* render_view_host, | 202 RenderViewHostImpl* render_view_host, |
| 201 RenderFrameHostDelegate* delegate, | 203 RenderFrameHostDelegate* delegate, |
| 202 RenderWidgetHostDelegate* rwh_delegate, | 204 RenderWidgetHostDelegate* rwh_delegate, |
| 203 FrameTree* frame_tree, | 205 FrameTree* frame_tree, |
| 204 FrameTreeNode* frame_tree_node, | 206 FrameTreeNode* frame_tree_node, |
| 205 int32_t routing_id, | 207 int32_t routing_id, |
| 206 int32_t widget_routing_id, | 208 int32_t widget_routing_id, |
| 207 bool hidden) | 209 bool hidden) |
| 208 : render_view_host_(render_view_host), | 210 : render_view_host_(render_view_host), |
| 209 delegate_(delegate), | 211 delegate_(delegate), |
| 212 frame_host_binding_(this), | |
| 210 site_instance_(static_cast<SiteInstanceImpl*>(site_instance)), | 213 site_instance_(static_cast<SiteInstanceImpl*>(site_instance)), |
| 211 process_(site_instance->GetProcess()), | 214 process_(site_instance->GetProcess()), |
| 212 cross_process_frame_connector_(NULL), | 215 cross_process_frame_connector_(NULL), |
| 213 render_frame_proxy_host_(NULL), | 216 render_frame_proxy_host_(NULL), |
| 214 frame_tree_(frame_tree), | 217 frame_tree_(frame_tree), |
| 215 frame_tree_node_(frame_tree_node), | 218 frame_tree_node_(frame_tree_node), |
| 216 render_widget_host_(nullptr), | 219 render_widget_host_(nullptr), |
| 217 routing_id_(routing_id), | 220 routing_id_(routing_id), |
| 218 is_waiting_for_swapout_ack_(false), | 221 is_waiting_for_swapout_ack_(false), |
| 219 render_frame_created_(false), | 222 render_frame_created_(false), |
| (...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1967 #if defined(ENABLE_WEBVR) | 1970 #if defined(ENABLE_WEBVR) |
| 1968 const base::CommandLine& browser_command_line = | 1971 const base::CommandLine& browser_command_line = |
| 1969 *base::CommandLine::ForCurrentProcess(); | 1972 *base::CommandLine::ForCurrentProcess(); |
| 1970 | 1973 |
| 1971 if (browser_command_line.HasSwitch(switches::kEnableWebVR)) { | 1974 if (browser_command_line.HasSwitch(switches::kEnableWebVR)) { |
| 1972 GetServiceRegistry()->AddService<blink::mojom::VRService>( | 1975 GetServiceRegistry()->AddService<blink::mojom::VRService>( |
| 1973 base::Bind(&VRDeviceManager::BindRequest)); | 1976 base::Bind(&VRDeviceManager::BindRequest)); |
| 1974 } | 1977 } |
| 1975 #endif | 1978 #endif |
| 1976 | 1979 |
| 1980 GetServiceRegistry()->AddService<mojom::FrameHost>(base::Bind( | |
| 1981 &RenderFrameHostImpl::BindFrameHostService, base::Unretained(this))); | |
| 1982 | |
| 1977 GetContentClient()->browser()->RegisterRenderFrameMojoServices( | 1983 GetContentClient()->browser()->RegisterRenderFrameMojoServices( |
| 1978 GetServiceRegistry(), this); | 1984 GetServiceRegistry(), this); |
| 1979 } | 1985 } |
| 1980 | 1986 |
| 1981 void RenderFrameHostImpl::ResetWaitingState() { | 1987 void RenderFrameHostImpl::ResetWaitingState() { |
| 1982 DCHECK(is_active()); | 1988 DCHECK(is_active()); |
| 1983 | 1989 |
| 1984 // The active state of the RVH is determined by its main frame, since | 1990 // The active state of the RVH is determined by its main frame, since |
| 1985 // subframes should have their own widgets. | 1991 // subframes should have their own widgets. |
| 1986 if (frame_tree_node_->IsMainFrame()) { | 1992 if (frame_tree_node_->IsMainFrame()) { |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2549 | 2555 |
| 2550 return is_live; | 2556 return is_live; |
| 2551 } | 2557 } |
| 2552 | 2558 |
| 2553 int RenderFrameHostImpl::GetProxyCount() { | 2559 int RenderFrameHostImpl::GetProxyCount() { |
| 2554 if (this != frame_tree_node_->current_frame_host()) | 2560 if (this != frame_tree_node_->current_frame_host()) |
| 2555 return 0; | 2561 return 0; |
| 2556 return frame_tree_node_->render_manager()->GetProxyCount(); | 2562 return frame_tree_node_->render_manager()->GetProxyCount(); |
| 2557 } | 2563 } |
| 2558 | 2564 |
| 2565 void RenderFrameHostImpl::GetHostZoomLevel( | |
| 2566 const GURL& url, | |
| 2567 const GetHostZoomLevelCallback& callback) { | |
| 2568 RenderProcessHost* render_process_host = | |
| 2569 RenderProcessHost::FromID(GetProcess()->GetID()); | |
| 2570 double zoom_level = 0.0; | |
| 2571 if (render_process_host) { | |
| 2572 const HostZoomMapImpl* host_zoom_map = static_cast<const HostZoomMapImpl*>( | |
| 2573 render_process_host->GetStoragePartition()->GetHostZoomMap()); | |
| 2574 zoom_level = host_zoom_map->GetZoomLevelForView(url, GetProcess()->GetID(), | |
| 2575 routing_id_); | |
| 2576 } | |
| 2577 callback.Run(std::move(url), zoom_level); | |
|
dcheng
2016/05/18 04:46:17
std::move() here is a no-op, since |url| is a cons
scottmg
2016/05/18 18:31:44
Oops, it used to be something more complicated bef
| |
| 2578 } | |
| 2579 | |
| 2559 #if defined(OS_MACOSX) | 2580 #if defined(OS_MACOSX) |
| 2560 | 2581 |
| 2561 void RenderFrameHostImpl::DidSelectPopupMenuItem(int selected_index) { | 2582 void RenderFrameHostImpl::DidSelectPopupMenuItem(int selected_index) { |
| 2562 Send(new FrameMsg_SelectPopupMenuItem(routing_id_, selected_index)); | 2583 Send(new FrameMsg_SelectPopupMenuItem(routing_id_, selected_index)); |
| 2563 } | 2584 } |
| 2564 | 2585 |
| 2565 void RenderFrameHostImpl::DidCancelPopupMenu() { | 2586 void RenderFrameHostImpl::DidCancelPopupMenu() { |
| 2566 Send(new FrameMsg_SelectPopupMenuItem(routing_id_, -1)); | 2587 Send(new FrameMsg_SelectPopupMenuItem(routing_id_, -1)); |
| 2567 } | 2588 } |
| 2568 | 2589 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2777 // For the root frame tree node, also store the AXTreeID of the focused frame. | 2798 // For the root frame tree node, also store the AXTreeID of the focused frame. |
| 2778 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame(); | 2799 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame(); |
| 2779 if (!focused_frame_tree_node) | 2800 if (!focused_frame_tree_node) |
| 2780 return; | 2801 return; |
| 2781 RenderFrameHostImpl* focused_frame = | 2802 RenderFrameHostImpl* focused_frame = |
| 2782 focused_frame_tree_node->current_frame_host(); | 2803 focused_frame_tree_node->current_frame_host(); |
| 2783 DCHECK(focused_frame); | 2804 DCHECK(focused_frame); |
| 2784 dst->focused_tree_id = focused_frame->GetAXTreeID(); | 2805 dst->focused_tree_id = focused_frame->GetAXTreeID(); |
| 2785 } | 2806 } |
| 2786 | 2807 |
| 2808 void RenderFrameHostImpl::BindFrameHostService( | |
| 2809 mojom::FrameHostRequest request) { | |
| 2810 frame_host_binding_.Bind(std::move(request)); | |
| 2811 frame_host_binding_.set_connection_error_handler( | |
| 2812 base::Bind(&mojo::Binding<mojom::FrameHost>::Unbind, | |
| 2813 base::Unretained(&frame_host_binding_))); | |
| 2814 } | |
| 2815 | |
| 2787 void RenderFrameHostImpl::CreateWebBluetoothService( | 2816 void RenderFrameHostImpl::CreateWebBluetoothService( |
| 2788 blink::mojom::WebBluetoothServiceRequest request) { | 2817 blink::mojom::WebBluetoothServiceRequest request) { |
| 2789 DCHECK(!web_bluetooth_service_); | 2818 DCHECK(!web_bluetooth_service_); |
| 2790 web_bluetooth_service_.reset( | 2819 web_bluetooth_service_.reset( |
| 2791 new WebBluetoothServiceImpl(this, std::move(request))); | 2820 new WebBluetoothServiceImpl(this, std::move(request))); |
| 2792 // RFHI owns web_bluetooth_service_ and web_bluetooth_service owns the | 2821 // RFHI owns web_bluetooth_service_ and web_bluetooth_service owns the |
| 2793 // binding_ which may run the error handler. binding_ can't run the error | 2822 // binding_ which may run the error handler. binding_ can't run the error |
| 2794 // handler after it's destroyed so it can't run after the RFHI is destroyed. | 2823 // handler after it's destroyed so it can't run after the RFHI is destroyed. |
| 2795 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 2824 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
| 2796 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 2825 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
| 2797 } | 2826 } |
| 2798 | 2827 |
| 2799 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 2828 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
| 2800 web_bluetooth_service_.reset(); | 2829 web_bluetooth_service_.reset(); |
| 2801 } | 2830 } |
| 2802 | 2831 |
| 2803 } // namespace content | 2832 } // namespace content |
| OLD | NEW |