| 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 "content/browser/permissions/permission_service_impl.h" | 7 #include "content/browser/permissions/permission_service_impl.h" |
| 8 #include "content/public/browser/navigation_details.h" | 8 #include "content/public/browser/navigation_details.h" |
| 9 #include "content/public/browser/render_frame_host.h" | 9 #include "content/public/browser/render_frame_host.h" |
| 10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 void PermissionServiceContext::ServiceHadConnectionError( | 41 void PermissionServiceContext::ServiceHadConnectionError( |
| 42 PermissionServiceImpl* service) { | 42 PermissionServiceImpl* service) { |
| 43 auto it = std::find(services_.begin(), services_.end(), service); | 43 auto it = std::find(services_.begin(), services_.end(), service); |
| 44 DCHECK(it != services_.end()); | 44 DCHECK(it != services_.end()); |
| 45 services_.erase(it); | 45 services_.erase(it); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void PermissionServiceContext::RenderFrameDeleted( | 48 void PermissionServiceContext::RenderFrameDeleted( |
| 49 RenderFrameHost* render_frame_host) { | 49 RenderFrameHost* render_frame_host) { |
| 50 CancelPendingRequests(render_frame_host); | 50 CancelPendingOperations(render_frame_host); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void PermissionServiceContext::DidNavigateAnyFrame( | 53 void PermissionServiceContext::DidNavigateAnyFrame( |
| 54 RenderFrameHost* render_frame_host, | 54 RenderFrameHost* render_frame_host, |
| 55 const LoadCommittedDetails& details, | 55 const LoadCommittedDetails& details, |
| 56 const FrameNavigateParams& params) { | 56 const FrameNavigateParams& params) { |
| 57 if (details.is_in_page) | 57 if (details.is_in_page) |
| 58 return; | 58 return; |
| 59 | 59 |
| 60 CancelPendingRequests(render_frame_host); | 60 CancelPendingOperations(render_frame_host); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void PermissionServiceContext::CancelPendingRequests( | 63 void PermissionServiceContext::CancelPendingOperations( |
| 64 RenderFrameHost* render_frame_host) const { | 64 RenderFrameHost* render_frame_host) const { |
| 65 if (render_frame_host != render_frame_host_) | 65 if (render_frame_host != render_frame_host_) |
| 66 return; | 66 return; |
| 67 | 67 |
| 68 for (auto* service : services_) | 68 for (auto* service : services_) |
| 69 service->CancelPendingRequests(); | 69 service->CancelPendingOperations(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 BrowserContext* PermissionServiceContext::GetBrowserContext() const { | 72 BrowserContext* PermissionServiceContext::GetBrowserContext() const { |
| 73 if (!web_contents()) { | 73 if (!web_contents()) { |
| 74 DCHECK(render_process_host_); | 74 DCHECK(render_process_host_); |
| 75 return render_process_host_->GetBrowserContext(); | 75 return render_process_host_->GetBrowserContext(); |
| 76 } | 76 } |
| 77 return web_contents()->GetBrowserContext(); | 77 return web_contents()->GetBrowserContext(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 GURL PermissionServiceContext::GetEmbeddingOrigin() const { | 80 GURL PermissionServiceContext::GetEmbeddingOrigin() const { |
| 81 return web_contents() ? web_contents()->GetLastCommittedURL().GetOrigin() | 81 return web_contents() ? web_contents()->GetLastCommittedURL().GetOrigin() |
| 82 : GURL(); | 82 : GURL(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace content | 85 } // namespace content |
| OLD | NEW |