| 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> |
| 8 |
| 7 #include "content/browser/permissions/permission_service_impl.h" | 9 #include "content/browser/permissions/permission_service_impl.h" |
| 8 #include "content/public/browser/navigation_details.h" | 10 #include "content/public/browser/navigation_details.h" |
| 9 #include "content/public/browser/render_frame_host.h" | 11 #include "content/public/browser/render_frame_host.h" |
| 10 #include "content/public/browser/render_process_host.h" | 12 #include "content/public/browser/render_process_host.h" |
| 11 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 12 | 14 |
| 13 namespace content { | 15 namespace content { |
| 14 | 16 |
| 15 PermissionServiceContext::PermissionServiceContext( | 17 PermissionServiceContext::PermissionServiceContext( |
| 16 RenderFrameHost* render_frame_host) | 18 RenderFrameHost* render_frame_host) |
| 17 : WebContentsObserver(WebContents::FromRenderFrameHost(render_frame_host)), | 19 : WebContentsObserver(WebContents::FromRenderFrameHost(render_frame_host)), |
| 18 render_frame_host_(render_frame_host), | 20 render_frame_host_(render_frame_host), |
| 19 render_process_host_(nullptr) { | 21 render_process_host_(nullptr) { |
| 20 } | 22 } |
| 21 | 23 |
| 22 PermissionServiceContext::PermissionServiceContext( | 24 PermissionServiceContext::PermissionServiceContext( |
| 23 RenderProcessHost* render_process_host) | 25 RenderProcessHost* render_process_host) |
| 24 : WebContentsObserver(nullptr), | 26 : WebContentsObserver(nullptr), |
| 25 render_frame_host_(nullptr), | 27 render_frame_host_(nullptr), |
| 26 render_process_host_(render_process_host) { | 28 render_process_host_(render_process_host) { |
| 27 } | 29 } |
| 28 | 30 |
| 29 PermissionServiceContext::~PermissionServiceContext() { | 31 PermissionServiceContext::~PermissionServiceContext() { |
| 30 } | 32 } |
| 31 | 33 |
| 32 void PermissionServiceContext::CreateService( | 34 void PermissionServiceContext::CreateService( |
| 33 mojo::InterfaceRequest<PermissionService> request) { | 35 mojo::InterfaceRequest<PermissionService> request) { |
| 34 services_.push_back(new PermissionServiceImpl(this, request.Pass())); | 36 services_.push_back(new PermissionServiceImpl(this, std::move(request))); |
| 35 } | 37 } |
| 36 | 38 |
| 37 void PermissionServiceContext::ServiceHadConnectionError( | 39 void PermissionServiceContext::ServiceHadConnectionError( |
| 38 PermissionServiceImpl* service) { | 40 PermissionServiceImpl* service) { |
| 39 auto it = std::find(services_.begin(), services_.end(), service); | 41 auto it = std::find(services_.begin(), services_.end(), service); |
| 40 DCHECK(it != services_.end()); | 42 DCHECK(it != services_.end()); |
| 41 services_.erase(it); | 43 services_.erase(it); |
| 42 } | 44 } |
| 43 | 45 |
| 44 void PermissionServiceContext::RenderFrameHostChanged( | 46 void PermissionServiceContext::RenderFrameHostChanged( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 GURL PermissionServiceContext::GetEmbeddingOrigin() const { | 85 GURL PermissionServiceContext::GetEmbeddingOrigin() const { |
| 84 return web_contents() ? web_contents()->GetLastCommittedURL().GetOrigin() | 86 return web_contents() ? web_contents()->GetLastCommittedURL().GetOrigin() |
| 85 : GURL(); | 87 : GURL(); |
| 86 } | 88 } |
| 87 | 89 |
| 88 RenderFrameHost* PermissionServiceContext::render_frame_host() const { | 90 RenderFrameHost* PermissionServiceContext::render_frame_host() const { |
| 89 return render_frame_host_; | 91 return render_frame_host_; |
| 90 } | 92 } |
| 91 | 93 |
| 92 } // namespace content | 94 } // namespace content |
| OLD | NEW |