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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "content/common/mojo/service_registry_for_route.h" | 52 #include "content/common/mojo/service_registry_for_route.h" |
53 #include "content/common/navigation_params.h" | 53 #include "content/common/navigation_params.h" |
54 #include "content/common/site_isolation_policy.h" | 54 #include "content/common/site_isolation_policy.h" |
55 #include "content/common/swapped_out_messages.h" | 55 #include "content/common/swapped_out_messages.h" |
56 #include "content/public/browser/ax_event_notification_details.h" | 56 #include "content/public/browser/ax_event_notification_details.h" |
57 #include "content/public/browser/browser_accessibility_state.h" | 57 #include "content/public/browser/browser_accessibility_state.h" |
58 #include "content/public/browser/browser_context.h" | 58 #include "content/public/browser/browser_context.h" |
59 #include "content/public/browser/browser_plugin_guest_manager.h" | 59 #include "content/public/browser/browser_plugin_guest_manager.h" |
60 #include "content/public/browser/browser_thread.h" | 60 #include "content/public/browser/browser_thread.h" |
61 #include "content/public/browser/content_browser_client.h" | 61 #include "content/public/browser/content_browser_client.h" |
62 #include "content/public/browser/permission_manager.h" | |
63 #include "content/public/browser/permission_type.h" | |
64 #include "content/public/browser/render_process_host.h" | 62 #include "content/public/browser/render_process_host.h" |
65 #include "content/public/browser/render_widget_host_view.h" | 63 #include "content/public/browser/render_widget_host_view.h" |
66 #include "content/public/browser/stream_handle.h" | 64 #include "content/public/browser/stream_handle.h" |
67 #include "content/public/browser/user_metrics.h" | 65 #include "content/public/browser/user_metrics.h" |
68 #include "content/public/common/content_constants.h" | 66 #include "content/public/common/content_constants.h" |
69 #include "content/public/common/content_switches.h" | 67 #include "content/public/common/content_switches.h" |
70 #include "content/public/common/isolated_world_ids.h" | 68 #include "content/public/common/isolated_world_ids.h" |
71 #include "content/public/common/url_constants.h" | 69 #include "content/public/common/url_constants.h" |
72 #include "content/public/common/url_utils.h" | 70 #include "content/public/common/url_utils.h" |
73 #include "ui/accessibility/ax_tree.h" | 71 #include "ui/accessibility/ax_tree.h" |
(...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1702 | 1700 |
1703 void RenderFrameHostImpl::OnHidePopup() { | 1701 void RenderFrameHostImpl::OnHidePopup() { |
1704 RenderViewHostDelegateView* view = | 1702 RenderViewHostDelegateView* view = |
1705 render_view_host_->delegate_->GetDelegateView(); | 1703 render_view_host_->delegate_->GetDelegateView(); |
1706 if (view) | 1704 if (view) |
1707 view->HidePopupMenu(); | 1705 view->HidePopupMenu(); |
1708 } | 1706 } |
1709 #endif | 1707 #endif |
1710 | 1708 |
1711 void RenderFrameHostImpl::RegisterMojoServices() { | 1709 void RenderFrameHostImpl::RegisterMojoServices() { |
1712 GeolocationServiceContext* geolocation_service_context = | 1710 // TODO(creis): Bind process ID here so that GeolocationServiceImpl |
1713 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; | 1711 // can perform permissions checks once site isolation is complete. |
1714 if (geolocation_service_context) { | 1712 // crbug.com/426384 |
1715 // TODO(creis): Bind process ID here so that GeolocationServiceImpl | 1713 GetServiceRegistry()->AddService( |
1716 // can perform permissions checks once site isolation is complete. | 1714 base::Bind(&GeolocationServiceContext::CreateService, this)); |
1717 // crbug.com/426384 | |
1718 GetServiceRegistry()->AddService<GeolocationService>( | |
1719 base::Bind(&GeolocationServiceContext::CreateService, | |
1720 base::Unretained(geolocation_service_context), | |
1721 base::Bind(&RenderFrameHostImpl::DidUseGeolocationPermission, | |
1722 base::Unretained(this)))); | |
1723 } | |
1724 | 1715 |
1725 WakeLockServiceContext* wake_lock_service_context = | 1716 WakeLockServiceContext* wake_lock_service_context = |
1726 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; | 1717 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; |
1727 if (wake_lock_service_context) { | 1718 if (wake_lock_service_context) { |
1728 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive | 1719 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive |
1729 // this RenderFrameHostImpl, hence a raw pointer can be bound to service | 1720 // this RenderFrameHostImpl, hence a raw pointer can be bound to service |
1730 // factory callback. | 1721 // factory callback. |
1731 GetServiceRegistry()->AddService<WakeLockService>( | 1722 GetServiceRegistry()->AddService<WakeLockService>( |
1732 base::Bind(&WakeLockServiceContext::CreateService, | 1723 base::Bind(&WakeLockServiceContext::CreateService, |
1733 base::Unretained(wake_lock_service_context), | 1724 base::Unretained(wake_lock_service_context), |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2259 void RenderFrameHostImpl::SendNavigateMessage( | 2250 void RenderFrameHostImpl::SendNavigateMessage( |
2260 const CommonNavigationParams& common_params, | 2251 const CommonNavigationParams& common_params, |
2261 const StartNavigationParams& start_params, | 2252 const StartNavigationParams& start_params, |
2262 const RequestNavigationParams& request_params) { | 2253 const RequestNavigationParams& request_params) { |
2263 RenderFrameDevToolsAgentHost::OnBeforeNavigation( | 2254 RenderFrameDevToolsAgentHost::OnBeforeNavigation( |
2264 frame_tree_node_->current_frame_host(), this); | 2255 frame_tree_node_->current_frame_host(), this); |
2265 Send(new FrameMsg_Navigate( | 2256 Send(new FrameMsg_Navigate( |
2266 routing_id_, common_params, start_params, request_params)); | 2257 routing_id_, common_params, start_params, request_params)); |
2267 } | 2258 } |
2268 | 2259 |
2269 void RenderFrameHostImpl::DidUseGeolocationPermission() { | |
2270 PermissionManager* permission_manager = | |
2271 GetSiteInstance()->GetBrowserContext()->GetPermissionManager(); | |
2272 if (!permission_manager) | |
2273 return; | |
2274 | |
2275 permission_manager->RegisterPermissionUsage( | |
2276 PermissionType::GEOLOCATION, | |
2277 GetLastCommittedURL().GetOrigin(), | |
2278 frame_tree_node()->frame_tree()->GetMainFrame() | |
2279 ->GetLastCommittedURL().GetOrigin()); | |
2280 } | |
2281 | |
2282 void RenderFrameHostImpl::UpdatePermissionsForNavigation( | 2260 void RenderFrameHostImpl::UpdatePermissionsForNavigation( |
2283 const CommonNavigationParams& common_params, | 2261 const CommonNavigationParams& common_params, |
2284 const RequestNavigationParams& request_params) { | 2262 const RequestNavigationParams& request_params) { |
2285 // Browser plugin guests are not allowed to navigate outside web-safe schemes, | 2263 // Browser plugin guests are not allowed to navigate outside web-safe schemes, |
2286 // so do not grant them the ability to request additional URLs. | 2264 // so do not grant them the ability to request additional URLs. |
2287 if (!GetProcess()->IsForGuestsOnly()) { | 2265 if (!GetProcess()->IsForGuestsOnly()) { |
2288 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( | 2266 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( |
2289 GetProcess()->GetID(), common_params.url); | 2267 GetProcess()->GetID(), common_params.url); |
2290 if (common_params.url.SchemeIs(url::kDataScheme) && | 2268 if (common_params.url.SchemeIs(url::kDataScheme) && |
2291 common_params.base_url_for_data_url.SchemeIs(url::kFileScheme)) { | 2269 common_params.base_url_for_data_url.SchemeIs(url::kFileScheme)) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2391 *dst = src; | 2369 *dst = src; |
2392 | 2370 |
2393 if (src.routing_id != -1) | 2371 if (src.routing_id != -1) |
2394 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); | 2372 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); |
2395 | 2373 |
2396 if (src.parent_routing_id != -1) | 2374 if (src.parent_routing_id != -1) |
2397 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); | 2375 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); |
2398 } | 2376 } |
2399 | 2377 |
2400 } // namespace content | 2378 } // namespace content |
OLD | NEW |