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 blink { |
14 | |
15 namespace mojom { | 14 namespace mojom { |
16 class PermissionService; | 15 class PermissionService; |
17 } | 16 } |
| 17 } |
| 18 |
| 19 namespace content { |
18 | 20 |
19 class PermissionServiceImpl; | 21 class PermissionServiceImpl; |
20 class RenderFrameHost; | 22 class RenderFrameHost; |
21 class RenderProcessHost; | 23 class RenderProcessHost; |
22 | 24 |
23 // Provides information to a PermissionService. It is used by the | 25 // Provides information to a PermissionService. It is used by the |
24 // mojom::PermissionService to handle request permission UI. | 26 // PermissionServiceImpl to handle request permission UI. |
25 // There is one PermissionServiceContext per RenderFrameHost/RenderProcessHost | 27 // There is one PermissionServiceContext per RenderFrameHost/RenderProcessHost |
26 // which owns it. It then owns all mojom::PermissionService associated to their | 28 // which owns it. It then owns all PermissionServiceImpl associated to their |
27 // owner. | 29 // owner. |
28 class PermissionServiceContext : public WebContentsObserver { | 30 class PermissionServiceContext : public WebContentsObserver { |
29 public: | 31 public: |
30 explicit PermissionServiceContext(RenderFrameHost* render_frame_host); | 32 explicit PermissionServiceContext(RenderFrameHost* render_frame_host); |
31 explicit PermissionServiceContext(RenderProcessHost* render_process_host); | 33 explicit PermissionServiceContext(RenderProcessHost* render_process_host); |
32 ~PermissionServiceContext() override; | 34 ~PermissionServiceContext() override; |
33 | 35 |
34 void CreateService(mojo::InterfaceRequest<mojom::PermissionService> request); | 36 void CreateService( |
| 37 mojo::InterfaceRequest<blink::mojom::PermissionService> request); |
35 | 38 |
36 // Called by a mojom::PermissionService identified as |service| when it has a | 39 // Called by a PermissionServiceImpl identified as |service| when it has a |
37 // connection error in order to get unregistered and killed. | 40 // connection error in order to get unregistered and killed. |
38 void ServiceHadConnectionError(PermissionServiceImpl* service); | 41 void ServiceHadConnectionError(PermissionServiceImpl* service); |
39 | 42 |
40 BrowserContext* GetBrowserContext() const; | 43 BrowserContext* GetBrowserContext() const; |
41 GURL GetEmbeddingOrigin() const; | 44 GURL GetEmbeddingOrigin() const; |
42 | 45 |
43 RenderFrameHost* render_frame_host() const; | 46 RenderFrameHost* render_frame_host() const; |
44 | 47 |
45 private: | 48 private: |
46 // WebContentsObserver | 49 // WebContentsObserver |
47 void RenderFrameHostChanged(RenderFrameHost* old_host, | 50 void RenderFrameHostChanged(RenderFrameHost* old_host, |
48 RenderFrameHost* new_host) override; | 51 RenderFrameHost* new_host) override; |
49 void FrameDeleted(RenderFrameHost* render_frame_host) override; | 52 void FrameDeleted(RenderFrameHost* render_frame_host) override; |
50 void DidNavigateAnyFrame(RenderFrameHost* render_frame_host, | 53 void DidNavigateAnyFrame(RenderFrameHost* render_frame_host, |
51 const LoadCommittedDetails& details, | 54 const LoadCommittedDetails& details, |
52 const FrameNavigateParams& params) override; | 55 const FrameNavigateParams& params) override; |
53 | 56 |
54 void CancelPendingOperations(RenderFrameHost*) const; | 57 void CancelPendingOperations(RenderFrameHost*) const; |
55 | 58 |
56 RenderFrameHost* render_frame_host_; | 59 RenderFrameHost* render_frame_host_; |
57 RenderProcessHost* render_process_host_; | 60 RenderProcessHost* render_process_host_; |
58 ScopedVector<PermissionServiceImpl> services_; | 61 ScopedVector<PermissionServiceImpl> services_; |
59 | 62 |
60 DISALLOW_COPY_AND_ASSIGN(PermissionServiceContext); | 63 DISALLOW_COPY_AND_ASSIGN(PermissionServiceContext); |
61 }; | 64 }; |
62 | 65 |
63 } // namespace content | 66 } // namespace content |
64 | 67 |
65 #endif // CONTENT_BROWSER_PERMISSIONS_PERMISSION_SERVICE_CONTEXT_H_ | 68 #endif // CONTENT_BROWSER_PERMISSIONS_PERMISSION_SERVICE_CONTEXT_H_ |
OLD | NEW |