| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/permissions/permission_service_context.h" | 5 #include "content/browser/permissions/permission_service_context.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "content/browser/permissions/permission_service_impl.h" | 9 #include "content/browser/permissions/permission_service_impl.h" |
| 10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
| 11 #include "content/public/browser/navigation_details.h" | 11 #include "content/public/browser/navigation_handle.h" |
| 12 #include "content/public/browser/permission_manager.h" | 12 #include "content/public/browser/permission_manager.h" |
| 13 #include "content/public/browser/render_frame_host.h" | 13 #include "content/public/browser/render_frame_host.h" |
| 14 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
| 15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 16 | 16 |
| 17 using blink::mojom::PermissionObserverPtr; | 17 using blink::mojom::PermissionObserverPtr; |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 class PermissionServiceContext::PermissionSubscription { | 21 class PermissionServiceContext::PermissionSubscription { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 RenderFrameHost* old_host, | 122 RenderFrameHost* old_host, |
| 123 RenderFrameHost* new_host) { | 123 RenderFrameHost* new_host) { |
| 124 CancelPendingOperations(old_host); | 124 CancelPendingOperations(old_host); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void PermissionServiceContext::FrameDeleted( | 127 void PermissionServiceContext::FrameDeleted( |
| 128 RenderFrameHost* render_frame_host) { | 128 RenderFrameHost* render_frame_host) { |
| 129 CancelPendingOperations(render_frame_host); | 129 CancelPendingOperations(render_frame_host); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void PermissionServiceContext::DidNavigateAnyFrame( | 132 void PermissionServiceContext::DidFinishNavigation( |
| 133 RenderFrameHost* render_frame_host, | 133 NavigationHandle* navigation_handle) { |
| 134 const LoadCommittedDetails& details, | 134 if (!navigation_handle->HasCommitted() || navigation_handle->IsSamePage()) |
| 135 const FrameNavigateParams& params) { | |
| 136 if (details.is_in_page) | |
| 137 return; | 135 return; |
| 138 | 136 |
| 139 CancelPendingOperations(render_frame_host); | 137 CancelPendingOperations(navigation_handle->GetRenderFrameHost()); |
| 140 } | 138 } |
| 141 | 139 |
| 142 void PermissionServiceContext::CancelPendingOperations( | 140 void PermissionServiceContext::CancelPendingOperations( |
| 143 RenderFrameHost* render_frame_host) { | 141 RenderFrameHost* render_frame_host) { |
| 144 DCHECK(render_frame_host_); | 142 DCHECK(render_frame_host_); |
| 145 if (render_frame_host != render_frame_host_) | 143 if (render_frame_host != render_frame_host_) |
| 146 return; | 144 return; |
| 147 | 145 |
| 148 for (const auto& service : services_) | 146 for (const auto& service : services_) |
| 149 service->CancelPendingOperations(); | 147 service->CancelPendingOperations(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 162 GURL PermissionServiceContext::GetEmbeddingOrigin() const { | 160 GURL PermissionServiceContext::GetEmbeddingOrigin() const { |
| 163 return web_contents() ? web_contents()->GetLastCommittedURL().GetOrigin() | 161 return web_contents() ? web_contents()->GetLastCommittedURL().GetOrigin() |
| 164 : GURL(); | 162 : GURL(); |
| 165 } | 163 } |
| 166 | 164 |
| 167 RenderFrameHost* PermissionServiceContext::render_frame_host() const { | 165 RenderFrameHost* PermissionServiceContext::render_frame_host() const { |
| 168 return render_frame_host_; | 166 return render_frame_host_; |
| 169 } | 167 } |
| 170 | 168 |
| 171 } // namespace content | 169 } // namespace content |
| OLD | NEW |