| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 2315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2326 // can perform permissions checks once site isolation is complete. | 2326 // can perform permissions checks once site isolation is complete. |
| 2327 // crbug.com/426384 | 2327 // crbug.com/426384 |
| 2328 // NOTE: At shutdown, there is no guaranteed ordering between destruction of | 2328 // NOTE: At shutdown, there is no guaranteed ordering between destruction of |
| 2329 // this object and destruction of any GeolocationServicesImpls created via | 2329 // this object and destruction of any GeolocationServicesImpls created via |
| 2330 // the below service registry, the reason being that the destruction of the | 2330 // the below service registry, the reason being that the destruction of the |
| 2331 // latter is triggered by receiving a message that the pipe was closed from | 2331 // latter is triggered by receiving a message that the pipe was closed from |
| 2332 // the renderer side. Hence, supply the reference to this object as a weak | 2332 // the renderer side. Hence, supply the reference to this object as a weak |
| 2333 // pointer. | 2333 // pointer. |
| 2334 GetInterfaceRegistry()->AddInterface( | 2334 GetInterfaceRegistry()->AddInterface( |
| 2335 base::Bind(&device::GeolocationServiceContext::CreateService, | 2335 base::Bind(&device::GeolocationServiceContext::CreateService, |
| 2336 base::Unretained(geolocation_service_context), | 2336 base::Unretained(geolocation_service_context))); |
| 2337 base::Bind(&RenderFrameHostImpl::DidUseGeolocationPermission, | |
| 2338 weak_ptr_factory_.GetWeakPtr()))); | |
| 2339 } | 2337 } |
| 2340 | 2338 |
| 2341 device::WakeLockServiceContext* wake_lock_service_context = | 2339 device::WakeLockServiceContext* wake_lock_service_context = |
| 2342 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; | 2340 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; |
| 2343 if (wake_lock_service_context) { | 2341 if (wake_lock_service_context) { |
| 2344 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive | 2342 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive |
| 2345 // this RenderFrameHostImpl, hence a raw pointer can be bound to service | 2343 // this RenderFrameHostImpl, hence a raw pointer can be bound to service |
| 2346 // factory callback. | 2344 // factory callback. |
| 2347 GetInterfaceRegistry()->AddInterface<device::mojom::WakeLockService>( | 2345 GetInterfaceRegistry()->AddInterface<device::mojom::WakeLockService>( |
| 2348 base::Bind(&device::WakeLockServiceContext::CreateService, | 2346 base::Bind(&device::WakeLockServiceContext::CreateService, |
| (...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3178 void RenderFrameHostImpl::SendNavigateMessage( | 3176 void RenderFrameHostImpl::SendNavigateMessage( |
| 3179 const CommonNavigationParams& common_params, | 3177 const CommonNavigationParams& common_params, |
| 3180 const StartNavigationParams& start_params, | 3178 const StartNavigationParams& start_params, |
| 3181 const RequestNavigationParams& request_params) { | 3179 const RequestNavigationParams& request_params) { |
| 3182 RenderFrameDevToolsAgentHost::OnBeforeNavigation( | 3180 RenderFrameDevToolsAgentHost::OnBeforeNavigation( |
| 3183 frame_tree_node_->current_frame_host(), this); | 3181 frame_tree_node_->current_frame_host(), this); |
| 3184 Send(new FrameMsg_Navigate( | 3182 Send(new FrameMsg_Navigate( |
| 3185 routing_id_, common_params, start_params, request_params)); | 3183 routing_id_, common_params, start_params, request_params)); |
| 3186 } | 3184 } |
| 3187 | 3185 |
| 3188 void RenderFrameHostImpl::DidUseGeolocationPermission() { | |
| 3189 PermissionManager* permission_manager = | |
| 3190 GetSiteInstance()->GetBrowserContext()->GetPermissionManager(); | |
| 3191 if (!permission_manager) | |
| 3192 return; | |
| 3193 | |
| 3194 permission_manager->RegisterPermissionUsage( | |
| 3195 PermissionType::GEOLOCATION, | |
| 3196 last_committed_url().GetOrigin(), | |
| 3197 frame_tree_node()->frame_tree()->GetMainFrame() | |
| 3198 ->last_committed_url().GetOrigin()); | |
| 3199 } | |
| 3200 | |
| 3201 bool RenderFrameHostImpl::CanAccessFilesOfPageState(const PageState& state) { | 3186 bool RenderFrameHostImpl::CanAccessFilesOfPageState(const PageState& state) { |
| 3202 return ChildProcessSecurityPolicyImpl::GetInstance()->CanReadAllFiles( | 3187 return ChildProcessSecurityPolicyImpl::GetInstance()->CanReadAllFiles( |
| 3203 GetProcess()->GetID(), state.GetReferencedFiles()); | 3188 GetProcess()->GetID(), state.GetReferencedFiles()); |
| 3204 } | 3189 } |
| 3205 | 3190 |
| 3206 void RenderFrameHostImpl::GrantFileAccessFromPageState(const PageState& state) { | 3191 void RenderFrameHostImpl::GrantFileAccessFromPageState(const PageState& state) { |
| 3207 GrantFileAccess(GetProcess()->GetID(), state.GetReferencedFiles()); | 3192 GrantFileAccess(GetProcess()->GetID(), state.GetReferencedFiles()); |
| 3208 } | 3193 } |
| 3209 | 3194 |
| 3210 void RenderFrameHostImpl::GrantFileAccessFromResourceRequestBody( | 3195 void RenderFrameHostImpl::GrantFileAccessFromResourceRequestBody( |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3506 // There is no pending NavigationEntry in these cases, so pass 0 as the | 3491 // There is no pending NavigationEntry in these cases, so pass 0 as the |
| 3507 // pending_nav_entry_id. If the previous handle was a prematurely aborted | 3492 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
| 3508 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3493 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
| 3509 return NavigationHandleImpl::Create( | 3494 return NavigationHandleImpl::Create( |
| 3510 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, | 3495 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, |
| 3511 params.was_within_same_page, base::TimeTicks::Now(), | 3496 params.was_within_same_page, base::TimeTicks::Now(), |
| 3512 entry_id_for_data_nav, false); // started_from_context_menu | 3497 entry_id_for_data_nav, false); // started_from_context_menu |
| 3513 } | 3498 } |
| 3514 | 3499 |
| 3515 } // namespace content | 3500 } // namespace content |
| OLD | NEW |