| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "content/common/navigation_params.h" | 49 #include "content/common/navigation_params.h" |
| 50 #include "content/common/render_frame_setup.mojom.h" | 50 #include "content/common/render_frame_setup.mojom.h" |
| 51 #include "content/common/site_isolation_policy.h" | 51 #include "content/common/site_isolation_policy.h" |
| 52 #include "content/common/swapped_out_messages.h" | 52 #include "content/common/swapped_out_messages.h" |
| 53 #include "content/public/browser/ax_event_notification_details.h" | 53 #include "content/public/browser/ax_event_notification_details.h" |
| 54 #include "content/public/browser/browser_accessibility_state.h" | 54 #include "content/public/browser/browser_accessibility_state.h" |
| 55 #include "content/public/browser/browser_context.h" | 55 #include "content/public/browser/browser_context.h" |
| 56 #include "content/public/browser/browser_plugin_guest_manager.h" | 56 #include "content/public/browser/browser_plugin_guest_manager.h" |
| 57 #include "content/public/browser/browser_thread.h" | 57 #include "content/public/browser/browser_thread.h" |
| 58 #include "content/public/browser/content_browser_client.h" | 58 #include "content/public/browser/content_browser_client.h" |
| 59 #include "content/public/browser/permission_manager.h" | |
| 60 #include "content/public/browser/permission_type.h" | |
| 61 #include "content/public/browser/render_process_host.h" | 59 #include "content/public/browser/render_process_host.h" |
| 62 #include "content/public/browser/render_widget_host_view.h" | 60 #include "content/public/browser/render_widget_host_view.h" |
| 63 #include "content/public/browser/stream_handle.h" | 61 #include "content/public/browser/stream_handle.h" |
| 64 #include "content/public/browser/user_metrics.h" | 62 #include "content/public/browser/user_metrics.h" |
| 65 #include "content/public/common/content_constants.h" | 63 #include "content/public/common/content_constants.h" |
| 66 #include "content/public/common/content_switches.h" | 64 #include "content/public/common/content_switches.h" |
| 67 #include "content/public/common/isolated_world_ids.h" | 65 #include "content/public/common/isolated_world_ids.h" |
| 68 #include "content/public/common/url_constants.h" | 66 #include "content/public/common/url_constants.h" |
| 69 #include "content/public/common/url_utils.h" | 67 #include "content/public/common/url_utils.h" |
| 70 #include "ui/accessibility/ax_tree.h" | 68 #include "ui/accessibility/ax_tree.h" |
| (...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1661 | 1659 |
| 1662 void RenderFrameHostImpl::OnHidePopup() { | 1660 void RenderFrameHostImpl::OnHidePopup() { |
| 1663 RenderViewHostDelegateView* view = | 1661 RenderViewHostDelegateView* view = |
| 1664 render_view_host_->delegate_->GetDelegateView(); | 1662 render_view_host_->delegate_->GetDelegateView(); |
| 1665 if (view) | 1663 if (view) |
| 1666 view->HidePopupMenu(); | 1664 view->HidePopupMenu(); |
| 1667 } | 1665 } |
| 1668 #endif | 1666 #endif |
| 1669 | 1667 |
| 1670 void RenderFrameHostImpl::RegisterMojoServices() { | 1668 void RenderFrameHostImpl::RegisterMojoServices() { |
| 1671 GeolocationServiceContext* geolocation_service_context = | 1669 // TODO(creis): Bind process ID here so that GeolocationServiceImpl |
| 1672 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; | 1670 // can perform permissions checks once site isolation is complete. |
| 1673 if (geolocation_service_context) { | 1671 // crbug.com/426384 |
| 1674 // TODO(creis): Bind process ID here so that GeolocationServiceImpl | 1672 GetServiceRegistry()->AddService( |
| 1675 // can perform permissions checks once site isolation is complete. | 1673 base::Bind(&GeolocationServiceContext::CreateService, this)); |
| 1676 // crbug.com/426384 | |
| 1677 GetServiceRegistry()->AddService<GeolocationService>( | |
| 1678 base::Bind(&GeolocationServiceContext::CreateService, | |
| 1679 base::Unretained(geolocation_service_context), | |
| 1680 base::Bind(&RenderFrameHostImpl::DidUseGeolocationPermission, | |
| 1681 base::Unretained(this)))); | |
| 1682 } | |
| 1683 | 1674 |
| 1684 WakeLockServiceContext* wake_lock_service_context = | 1675 WakeLockServiceContext* wake_lock_service_context = |
| 1685 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; | 1676 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; |
| 1686 if (wake_lock_service_context) { | 1677 if (wake_lock_service_context) { |
| 1687 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive | 1678 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive |
| 1688 // this RenderFrameHostImpl, hence a raw pointer can be bound to service | 1679 // this RenderFrameHostImpl, hence a raw pointer can be bound to service |
| 1689 // factory callback. | 1680 // factory callback. |
| 1690 GetServiceRegistry()->AddService<WakeLockService>( | 1681 GetServiceRegistry()->AddService<WakeLockService>( |
| 1691 base::Bind(&WakeLockServiceContext::CreateService, | 1682 base::Bind(&WakeLockServiceContext::CreateService, |
| 1692 base::Unretained(wake_lock_service_context), | 1683 base::Unretained(wake_lock_service_context), |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2222 void RenderFrameHostImpl::SendNavigateMessage( | 2213 void RenderFrameHostImpl::SendNavigateMessage( |
| 2223 const CommonNavigationParams& common_params, | 2214 const CommonNavigationParams& common_params, |
| 2224 const StartNavigationParams& start_params, | 2215 const StartNavigationParams& start_params, |
| 2225 const RequestNavigationParams& request_params) { | 2216 const RequestNavigationParams& request_params) { |
| 2226 RenderFrameDevToolsAgentHost::OnBeforeNavigation( | 2217 RenderFrameDevToolsAgentHost::OnBeforeNavigation( |
| 2227 frame_tree_node_->current_frame_host(), this); | 2218 frame_tree_node_->current_frame_host(), this); |
| 2228 Send(new FrameMsg_Navigate( | 2219 Send(new FrameMsg_Navigate( |
| 2229 routing_id_, common_params, start_params, request_params)); | 2220 routing_id_, common_params, start_params, request_params)); |
| 2230 } | 2221 } |
| 2231 | 2222 |
| 2232 void RenderFrameHostImpl::DidUseGeolocationPermission() { | |
| 2233 PermissionManager* permission_manager = | |
| 2234 GetSiteInstance()->GetBrowserContext()->GetPermissionManager(); | |
| 2235 if (!permission_manager) | |
| 2236 return; | |
| 2237 | |
| 2238 permission_manager->RegisterPermissionUsage( | |
| 2239 PermissionType::GEOLOCATION, | |
| 2240 GetLastCommittedURL().GetOrigin(), | |
| 2241 frame_tree_node()->frame_tree()->GetMainFrame() | |
| 2242 ->GetLastCommittedURL().GetOrigin()); | |
| 2243 } | |
| 2244 | |
| 2245 void RenderFrameHostImpl::UpdatePermissionsForNavigation( | 2223 void RenderFrameHostImpl::UpdatePermissionsForNavigation( |
| 2246 const CommonNavigationParams& common_params, | 2224 const CommonNavigationParams& common_params, |
| 2247 const RequestNavigationParams& request_params) { | 2225 const RequestNavigationParams& request_params) { |
| 2248 // Browser plugin guests are not allowed to navigate outside web-safe schemes, | 2226 // Browser plugin guests are not allowed to navigate outside web-safe schemes, |
| 2249 // so do not grant them the ability to request additional URLs. | 2227 // so do not grant them the ability to request additional URLs. |
| 2250 if (!GetProcess()->IsForGuestsOnly()) { | 2228 if (!GetProcess()->IsForGuestsOnly()) { |
| 2251 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( | 2229 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( |
| 2252 GetProcess()->GetID(), common_params.url); | 2230 GetProcess()->GetID(), common_params.url); |
| 2253 if (common_params.url.SchemeIs(url::kDataScheme) && | 2231 if (common_params.url.SchemeIs(url::kDataScheme) && |
| 2254 common_params.base_url_for_data_url.SchemeIs(url::kFileScheme)) { | 2232 common_params.base_url_for_data_url.SchemeIs(url::kFileScheme)) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2354 *dst = src; | 2332 *dst = src; |
| 2355 | 2333 |
| 2356 if (src.routing_id != -1) | 2334 if (src.routing_id != -1) |
| 2357 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); | 2335 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); |
| 2358 | 2336 |
| 2359 if (src.parent_routing_id != -1) | 2337 if (src.parent_routing_id != -1) |
| 2360 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); | 2338 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); |
| 2361 } | 2339 } |
| 2362 | 2340 |
| 2363 } // namespace content | 2341 } // namespace content |
| OLD | NEW |