| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include "content/common/navigation_params.h" | 50 #include "content/common/navigation_params.h" |
| 51 #include "content/common/render_frame_setup.mojom.h" | 51 #include "content/common/render_frame_setup.mojom.h" |
| 52 #include "content/common/site_isolation_policy.h" | 52 #include "content/common/site_isolation_policy.h" |
| 53 #include "content/common/swapped_out_messages.h" | 53 #include "content/common/swapped_out_messages.h" |
| 54 #include "content/public/browser/ax_event_notification_details.h" | 54 #include "content/public/browser/ax_event_notification_details.h" |
| 55 #include "content/public/browser/browser_accessibility_state.h" | 55 #include "content/public/browser/browser_accessibility_state.h" |
| 56 #include "content/public/browser/browser_context.h" | 56 #include "content/public/browser/browser_context.h" |
| 57 #include "content/public/browser/browser_plugin_guest_manager.h" | 57 #include "content/public/browser/browser_plugin_guest_manager.h" |
| 58 #include "content/public/browser/browser_thread.h" | 58 #include "content/public/browser/browser_thread.h" |
| 59 #include "content/public/browser/content_browser_client.h" | 59 #include "content/public/browser/content_browser_client.h" |
| 60 #include "content/public/browser/permission_manager.h" | |
| 61 #include "content/public/browser/permission_type.h" | |
| 62 #include "content/public/browser/render_process_host.h" | 60 #include "content/public/browser/render_process_host.h" |
| 63 #include "content/public/browser/render_widget_host_view.h" | 61 #include "content/public/browser/render_widget_host_view.h" |
| 64 #include "content/public/browser/stream_handle.h" | 62 #include "content/public/browser/stream_handle.h" |
| 65 #include "content/public/browser/user_metrics.h" | 63 #include "content/public/browser/user_metrics.h" |
| 66 #include "content/public/common/content_constants.h" | 64 #include "content/public/common/content_constants.h" |
| 67 #include "content/public/common/content_switches.h" | 65 #include "content/public/common/content_switches.h" |
| 68 #include "content/public/common/isolated_world_ids.h" | 66 #include "content/public/common/isolated_world_ids.h" |
| 69 #include "content/public/common/url_constants.h" | 67 #include "content/public/common/url_constants.h" |
| 70 #include "content/public/common/url_utils.h" | 68 #include "content/public/common/url_utils.h" |
| 71 #include "ui/accessibility/ax_tree.h" | 69 #include "ui/accessibility/ax_tree.h" |
| (...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1683 | 1681 |
| 1684 void RenderFrameHostImpl::OnHidePopup() { | 1682 void RenderFrameHostImpl::OnHidePopup() { |
| 1685 RenderViewHostDelegateView* view = | 1683 RenderViewHostDelegateView* view = |
| 1686 render_view_host_->delegate_->GetDelegateView(); | 1684 render_view_host_->delegate_->GetDelegateView(); |
| 1687 if (view) | 1685 if (view) |
| 1688 view->HidePopupMenu(); | 1686 view->HidePopupMenu(); |
| 1689 } | 1687 } |
| 1690 #endif | 1688 #endif |
| 1691 | 1689 |
| 1692 void RenderFrameHostImpl::RegisterMojoServices() { | 1690 void RenderFrameHostImpl::RegisterMojoServices() { |
| 1693 GeolocationServiceContext* geolocation_service_context = | 1691 // TODO(creis): Bind process ID here so that GeolocationServiceImpl |
| 1694 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; | 1692 // can perform permissions checks once site isolation is complete. |
| 1695 if (geolocation_service_context) { | 1693 // crbug.com/426384 |
| 1696 // TODO(creis): Bind process ID here so that GeolocationServiceImpl | 1694 GetServiceRegistry()->AddService( |
| 1697 // can perform permissions checks once site isolation is complete. | 1695 base::Bind(&GeolocationServiceContext::CreateService, this)); |
| 1698 // crbug.com/426384 | |
| 1699 GetServiceRegistry()->AddService<GeolocationService>( | |
| 1700 base::Bind(&GeolocationServiceContext::CreateService, | |
| 1701 base::Unretained(geolocation_service_context), | |
| 1702 base::Bind(&RenderFrameHostImpl::DidUseGeolocationPermission, | |
| 1703 base::Unretained(this)))); | |
| 1704 } | |
| 1705 | 1696 |
| 1706 WakeLockServiceContext* wake_lock_service_context = | 1697 WakeLockServiceContext* wake_lock_service_context = |
| 1707 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; | 1698 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; |
| 1708 if (wake_lock_service_context) { | 1699 if (wake_lock_service_context) { |
| 1709 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive | 1700 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive |
| 1710 // this RenderFrameHostImpl, hence a raw pointer can be bound to service | 1701 // this RenderFrameHostImpl, hence a raw pointer can be bound to service |
| 1711 // factory callback. | 1702 // factory callback. |
| 1712 GetServiceRegistry()->AddService<WakeLockService>( | 1703 GetServiceRegistry()->AddService<WakeLockService>( |
| 1713 base::Bind(&WakeLockServiceContext::CreateService, | 1704 base::Bind(&WakeLockServiceContext::CreateService, |
| 1714 base::Unretained(wake_lock_service_context), | 1705 base::Unretained(wake_lock_service_context), |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2246 void RenderFrameHostImpl::SendNavigateMessage( | 2237 void RenderFrameHostImpl::SendNavigateMessage( |
| 2247 const CommonNavigationParams& common_params, | 2238 const CommonNavigationParams& common_params, |
| 2248 const StartNavigationParams& start_params, | 2239 const StartNavigationParams& start_params, |
| 2249 const RequestNavigationParams& request_params) { | 2240 const RequestNavigationParams& request_params) { |
| 2250 RenderFrameDevToolsAgentHost::OnBeforeNavigation( | 2241 RenderFrameDevToolsAgentHost::OnBeforeNavigation( |
| 2251 frame_tree_node_->current_frame_host(), this); | 2242 frame_tree_node_->current_frame_host(), this); |
| 2252 Send(new FrameMsg_Navigate( | 2243 Send(new FrameMsg_Navigate( |
| 2253 routing_id_, common_params, start_params, request_params)); | 2244 routing_id_, common_params, start_params, request_params)); |
| 2254 } | 2245 } |
| 2255 | 2246 |
| 2256 void RenderFrameHostImpl::DidUseGeolocationPermission() { | |
| 2257 PermissionManager* permission_manager = | |
| 2258 GetSiteInstance()->GetBrowserContext()->GetPermissionManager(); | |
| 2259 if (!permission_manager) | |
| 2260 return; | |
| 2261 | |
| 2262 permission_manager->RegisterPermissionUsage( | |
| 2263 PermissionType::GEOLOCATION, | |
| 2264 GetLastCommittedURL().GetOrigin(), | |
| 2265 frame_tree_node()->frame_tree()->GetMainFrame() | |
| 2266 ->GetLastCommittedURL().GetOrigin()); | |
| 2267 } | |
| 2268 | |
| 2269 void RenderFrameHostImpl::UpdatePermissionsForNavigation( | 2247 void RenderFrameHostImpl::UpdatePermissionsForNavigation( |
| 2270 const CommonNavigationParams& common_params, | 2248 const CommonNavigationParams& common_params, |
| 2271 const RequestNavigationParams& request_params) { | 2249 const RequestNavigationParams& request_params) { |
| 2272 // Browser plugin guests are not allowed to navigate outside web-safe schemes, | 2250 // Browser plugin guests are not allowed to navigate outside web-safe schemes, |
| 2273 // so do not grant them the ability to request additional URLs. | 2251 // so do not grant them the ability to request additional URLs. |
| 2274 if (!GetProcess()->IsForGuestsOnly()) { | 2252 if (!GetProcess()->IsForGuestsOnly()) { |
| 2275 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( | 2253 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( |
| 2276 GetProcess()->GetID(), common_params.url); | 2254 GetProcess()->GetID(), common_params.url); |
| 2277 if (common_params.url.SchemeIs(url::kDataScheme) && | 2255 if (common_params.url.SchemeIs(url::kDataScheme) && |
| 2278 common_params.base_url_for_data_url.SchemeIs(url::kFileScheme)) { | 2256 common_params.base_url_for_data_url.SchemeIs(url::kFileScheme)) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2378 *dst = src; | 2356 *dst = src; |
| 2379 | 2357 |
| 2380 if (src.routing_id != -1) | 2358 if (src.routing_id != -1) |
| 2381 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); | 2359 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); |
| 2382 | 2360 |
| 2383 if (src.parent_routing_id != -1) | 2361 if (src.parent_routing_id != -1) |
| 2384 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); | 2362 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); |
| 2385 } | 2363 } |
| 2386 | 2364 |
| 2387 } // namespace content | 2365 } // namespace content |
| OLD | NEW |