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 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 | 1661 |
1662 void RenderFrameHostImpl::OnHidePopup() { | 1662 void RenderFrameHostImpl::OnHidePopup() { |
1663 RenderViewHostDelegateView* view = | 1663 RenderViewHostDelegateView* view = |
1664 render_view_host_->delegate_->GetDelegateView(); | 1664 render_view_host_->delegate_->GetDelegateView(); |
1665 if (view) | 1665 if (view) |
1666 view->HidePopupMenu(); | 1666 view->HidePopupMenu(); |
1667 } | 1667 } |
1668 #endif | 1668 #endif |
1669 | 1669 |
1670 void RenderFrameHostImpl::RegisterMojoServices() { | 1670 void RenderFrameHostImpl::RegisterMojoServices() { |
1671 GeolocationServiceContext* geolocation_service_context = | 1671 // TODO(creis): Bind process ID here so that GeolocationServiceImpl |
1672 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; | 1672 // can perform permissions checks once site isolation is complete. |
1673 if (geolocation_service_context) { | 1673 // crbug.com/426384 |
1674 // TODO(creis): Bind process ID here so that GeolocationServiceImpl | 1674 GetServiceRegistry()->AddService( |
1675 // can perform permissions checks once site isolation is complete. | 1675 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 | 1676 |
1684 WakeLockServiceContext* wake_lock_service_context = | 1677 WakeLockServiceContext* wake_lock_service_context = |
1685 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; | 1678 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; |
1686 if (wake_lock_service_context) { | 1679 if (wake_lock_service_context) { |
1687 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive | 1680 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive |
1688 // this RenderFrameHostImpl, hence a raw pointer can be bound to service | 1681 // this RenderFrameHostImpl, hence a raw pointer can be bound to service |
1689 // factory callback. | 1682 // factory callback. |
1690 GetServiceRegistry()->AddService<WakeLockService>( | 1683 GetServiceRegistry()->AddService<WakeLockService>( |
1691 base::Bind(&WakeLockServiceContext::CreateService, | 1684 base::Bind(&WakeLockServiceContext::CreateService, |
1692 base::Unretained(wake_lock_service_context), | 1685 base::Unretained(wake_lock_service_context), |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2222 void RenderFrameHostImpl::SendNavigateMessage( | 2215 void RenderFrameHostImpl::SendNavigateMessage( |
2223 const CommonNavigationParams& common_params, | 2216 const CommonNavigationParams& common_params, |
2224 const StartNavigationParams& start_params, | 2217 const StartNavigationParams& start_params, |
2225 const RequestNavigationParams& request_params) { | 2218 const RequestNavigationParams& request_params) { |
2226 RenderFrameDevToolsAgentHost::OnBeforeNavigation( | 2219 RenderFrameDevToolsAgentHost::OnBeforeNavigation( |
2227 frame_tree_node_->current_frame_host(), this); | 2220 frame_tree_node_->current_frame_host(), this); |
2228 Send(new FrameMsg_Navigate( | 2221 Send(new FrameMsg_Navigate( |
2229 routing_id_, common_params, start_params, request_params)); | 2222 routing_id_, common_params, start_params, request_params)); |
2230 } | 2223 } |
2231 | 2224 |
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( | 2225 void RenderFrameHostImpl::UpdatePermissionsForNavigation( |
2246 const CommonNavigationParams& common_params, | 2226 const CommonNavigationParams& common_params, |
2247 const RequestNavigationParams& request_params) { | 2227 const RequestNavigationParams& request_params) { |
2248 // Browser plugin guests are not allowed to navigate outside web-safe schemes, | 2228 // Browser plugin guests are not allowed to navigate outside web-safe schemes, |
2249 // so do not grant them the ability to request additional URLs. | 2229 // so do not grant them the ability to request additional URLs. |
2250 if (!GetProcess()->IsForGuestsOnly()) { | 2230 if (!GetProcess()->IsForGuestsOnly()) { |
2251 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( | 2231 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( |
2252 GetProcess()->GetID(), common_params.url); | 2232 GetProcess()->GetID(), common_params.url); |
2253 if (common_params.url.SchemeIs(url::kDataScheme) && | 2233 if (common_params.url.SchemeIs(url::kDataScheme) && |
2254 common_params.base_url_for_data_url.SchemeIs(url::kFileScheme)) { | 2234 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; | 2334 *dst = src; |
2355 | 2335 |
2356 if (src.routing_id != -1) | 2336 if (src.routing_id != -1) |
2357 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); | 2337 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); |
2358 | 2338 |
2359 if (src.parent_routing_id != -1) | 2339 if (src.parent_routing_id != -1) |
2360 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); | 2340 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); |
2361 } | 2341 } |
2362 | 2342 |
2363 } // namespace content | 2343 } // namespace content |
OLD | NEW |