| 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 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2312 // can perform permissions checks once site isolation is complete. | 2312 // can perform permissions checks once site isolation is complete. |
| 2313 // crbug.com/426384 | 2313 // crbug.com/426384 |
| 2314 // NOTE: At shutdown, there is no guaranteed ordering between destruction of | 2314 // NOTE: At shutdown, there is no guaranteed ordering between destruction of |
| 2315 // this object and destruction of any GeolocationServicesImpls created via | 2315 // this object and destruction of any GeolocationServicesImpls created via |
| 2316 // the below service registry, the reason being that the destruction of the | 2316 // the below service registry, the reason being that the destruction of the |
| 2317 // latter is triggered by receiving a message that the pipe was closed from | 2317 // latter is triggered by receiving a message that the pipe was closed from |
| 2318 // the renderer side. Hence, supply the reference to this object as a weak | 2318 // the renderer side. Hence, supply the reference to this object as a weak |
| 2319 // pointer. | 2319 // pointer. |
| 2320 GetInterfaceRegistry()->AddInterface( | 2320 GetInterfaceRegistry()->AddInterface( |
| 2321 base::Bind(&device::GeolocationServiceContext::CreateService, | 2321 base::Bind(&device::GeolocationServiceContext::CreateService, |
| 2322 base::Unretained(geolocation_service_context), | 2322 base::Unretained(geolocation_service_context))); |
| 2323 base::Bind(&RenderFrameHostImpl::DidUseGeolocationPermission, | |
| 2324 weak_ptr_factory_.GetWeakPtr()))); | |
| 2325 } | 2323 } |
| 2326 | 2324 |
| 2327 device::WakeLockServiceContext* wake_lock_service_context = | 2325 device::WakeLockServiceContext* wake_lock_service_context = |
| 2328 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; | 2326 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; |
| 2329 if (wake_lock_service_context) { | 2327 if (wake_lock_service_context) { |
| 2330 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive | 2328 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive |
| 2331 // this RenderFrameHostImpl, hence a raw pointer can be bound to service | 2329 // this RenderFrameHostImpl, hence a raw pointer can be bound to service |
| 2332 // factory callback. | 2330 // factory callback. |
| 2333 GetInterfaceRegistry()->AddInterface<device::mojom::WakeLockService>( | 2331 GetInterfaceRegistry()->AddInterface<device::mojom::WakeLockService>( |
| 2334 base::Bind(&device::WakeLockServiceContext::CreateService, | 2332 base::Bind(&device::WakeLockServiceContext::CreateService, |
| (...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3164 void RenderFrameHostImpl::SendNavigateMessage( | 3162 void RenderFrameHostImpl::SendNavigateMessage( |
| 3165 const CommonNavigationParams& common_params, | 3163 const CommonNavigationParams& common_params, |
| 3166 const StartNavigationParams& start_params, | 3164 const StartNavigationParams& start_params, |
| 3167 const RequestNavigationParams& request_params) { | 3165 const RequestNavigationParams& request_params) { |
| 3168 RenderFrameDevToolsAgentHost::OnBeforeNavigation( | 3166 RenderFrameDevToolsAgentHost::OnBeforeNavigation( |
| 3169 frame_tree_node_->current_frame_host(), this); | 3167 frame_tree_node_->current_frame_host(), this); |
| 3170 Send(new FrameMsg_Navigate( | 3168 Send(new FrameMsg_Navigate( |
| 3171 routing_id_, common_params, start_params, request_params)); | 3169 routing_id_, common_params, start_params, request_params)); |
| 3172 } | 3170 } |
| 3173 | 3171 |
| 3174 void RenderFrameHostImpl::DidUseGeolocationPermission() { | |
| 3175 PermissionManager* permission_manager = | |
| 3176 GetSiteInstance()->GetBrowserContext()->GetPermissionManager(); | |
| 3177 if (!permission_manager) | |
| 3178 return; | |
| 3179 | |
| 3180 permission_manager->RegisterPermissionUsage( | |
| 3181 PermissionType::GEOLOCATION, | |
| 3182 last_committed_url().GetOrigin(), | |
| 3183 frame_tree_node()->frame_tree()->GetMainFrame() | |
| 3184 ->last_committed_url().GetOrigin()); | |
| 3185 } | |
| 3186 | |
| 3187 bool RenderFrameHostImpl::CanAccessFilesOfPageState(const PageState& state) { | 3172 bool RenderFrameHostImpl::CanAccessFilesOfPageState(const PageState& state) { |
| 3188 return ChildProcessSecurityPolicyImpl::GetInstance()->CanReadAllFiles( | 3173 return ChildProcessSecurityPolicyImpl::GetInstance()->CanReadAllFiles( |
| 3189 GetProcess()->GetID(), state.GetReferencedFiles()); | 3174 GetProcess()->GetID(), state.GetReferencedFiles()); |
| 3190 } | 3175 } |
| 3191 | 3176 |
| 3192 void RenderFrameHostImpl::GrantFileAccessFromPageState(const PageState& state) { | 3177 void RenderFrameHostImpl::GrantFileAccessFromPageState(const PageState& state) { |
| 3193 GrantFileAccess(GetProcess()->GetID(), state.GetReferencedFiles()); | 3178 GrantFileAccess(GetProcess()->GetID(), state.GetReferencedFiles()); |
| 3194 } | 3179 } |
| 3195 | 3180 |
| 3196 void RenderFrameHostImpl::GrantFileAccessFromResourceRequestBody( | 3181 void RenderFrameHostImpl::GrantFileAccessFromResourceRequestBody( |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3492 // There is no pending NavigationEntry in these cases, so pass 0 as the | 3477 // There is no pending NavigationEntry in these cases, so pass 0 as the |
| 3493 // pending_nav_entry_id. If the previous handle was a prematurely aborted | 3478 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
| 3494 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3479 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
| 3495 return NavigationHandleImpl::Create( | 3480 return NavigationHandleImpl::Create( |
| 3496 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, | 3481 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, |
| 3497 params.was_within_same_page, base::TimeTicks::Now(), | 3482 params.was_within_same_page, base::TimeTicks::Now(), |
| 3498 entry_id_for_data_nav, false); // started_from_context_menu | 3483 entry_id_for_data_nav, false); // started_from_context_menu |
| 3499 } | 3484 } |
| 3500 | 3485 |
| 3501 } // namespace content | 3486 } // namespace content |
| OLD | NEW |