| 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 #ifndef CONTENT_BROWSER_PERMISSIONS_PERMISSION_SERVICE_CONTEXT_H_ | 5 #ifndef CONTENT_BROWSER_PERMISSIONS_PERMISSION_SERVICE_CONTEXT_H_ |
| 6 #define CONTENT_BROWSER_PERMISSIONS_PERMISSION_SERVICE_CONTEXT_H_ | 6 #define CONTENT_BROWSER_PERMISSIONS_PERMISSION_SERVICE_CONTEXT_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
| 11 #include "mojo/public/cpp/bindings/interface_request.h" | 11 #include "mojo/public/cpp/bindings/interface_request.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 class PermissionService; | 15 class PermissionService; |
| 16 class PermissionServiceImpl; | 16 class PermissionServiceImpl; |
| 17 class RenderFrameHost; | 17 class RenderFrameHost; |
| 18 class RenderProcessHost; | |
| 19 | 18 |
| 20 // Provides information to a PermissionService. It is used by the | 19 // Provides information to a PermissionService. It is used by the |
| 21 // PermissionService to handle request permission UI. | 20 // PermissionService to handle request permission UI. |
| 22 // There is one PermissionServiceContext per RenderFrameHost/RenderProcessHost | 21 // There is one PermissionServiceContext per RenderFrameHost/RenderProcessHost |
| 23 // which owns it. It then owns all PermissionService associated to their owner. | 22 // which owns it. It then owns all PermissionService associated to their owner. |
| 24 class PermissionServiceContext : public WebContentsObserver { | 23 class PermissionServiceContext : public WebContentsObserver { |
| 25 public: | 24 public: |
| 26 explicit PermissionServiceContext(RenderFrameHost* render_frame_host); | 25 explicit PermissionServiceContext(RenderFrameHost* render_frame_host); |
| 27 explicit PermissionServiceContext(RenderProcessHost* render_process_host); | |
| 28 virtual ~PermissionServiceContext(); | 26 virtual ~PermissionServiceContext(); |
| 29 | 27 |
| 30 void CreateService(mojo::InterfaceRequest<PermissionService> request); | 28 void CreateService(mojo::InterfaceRequest<PermissionService> request); |
| 31 | 29 |
| 32 // Called by a PermissionService identified as |service| when it has a | 30 // Called by a PermissionService identified as |service| when it has a |
| 33 // connection error in order to get unregistered and killed. | 31 // connection error in order to get unregistered and killed. |
| 34 void ServiceHadConnectionError(PermissionServiceImpl* service); | 32 void ServiceHadConnectionError(PermissionServiceImpl* service); |
| 35 | 33 |
| 36 BrowserContext* GetBrowserContext() const; | |
| 37 GURL GetEmbeddingOrigin() const; | |
| 38 | |
| 39 private: | 34 private: |
| 40 // WebContentsObserver | 35 // WebContentsObserver |
| 41 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; | 36 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; |
| 42 void DidNavigateAnyFrame(RenderFrameHost* render_frame_host, | 37 void DidNavigateAnyFrame(RenderFrameHost* render_frame_host, |
| 43 const LoadCommittedDetails& details, | 38 const LoadCommittedDetails& details, |
| 44 const FrameNavigateParams& params) override; | 39 const FrameNavigateParams& params) override; |
| 45 | 40 |
| 46 void CancelPendingRequests(RenderFrameHost*) const; | 41 void CancelPendingRequests(RenderFrameHost*) const; |
| 47 | 42 |
| 48 RenderFrameHost* render_frame_host_; | 43 RenderFrameHost* render_frame_host_; |
| 49 RenderProcessHost* render_process_host_; | |
| 50 ScopedVector<PermissionServiceImpl> services_; | 44 ScopedVector<PermissionServiceImpl> services_; |
| 51 | 45 |
| 52 DISALLOW_COPY_AND_ASSIGN(PermissionServiceContext); | 46 DISALLOW_COPY_AND_ASSIGN(PermissionServiceContext); |
| 53 }; | 47 }; |
| 54 | 48 |
| 55 } // namespace content | 49 } // namespace content |
| 56 | 50 |
| 57 #endif // CONTENT_BROWSER_PERMISSIONS_PERMISSION_SERVICE_CONTEXT_H_ | 51 #endif // CONTENT_BROWSER_PERMISSIONS_PERMISSION_SERVICE_CONTEXT_H_ |
| OLD | NEW |