| 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 "content/public/browser/permission_type.h" | 9 #include "content/public/browser/permission_type.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 #include "third_party/WebKit/public/platform/modules/permissions/permission.mojo
m.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace service_manager { |
| 14 namespace mojom { | 15 struct BindSourceInfo; |
| 15 class PermissionObserver; | |
| 16 class PermissionService; | |
| 17 } | |
| 18 } | 16 } |
| 19 | 17 |
| 20 namespace url { | 18 namespace url { |
| 21 class Origin; | 19 class Origin; |
| 22 } | 20 } |
| 23 | 21 |
| 24 namespace content { | 22 namespace content { |
| 25 | 23 |
| 26 class PermissionServiceImpl; | 24 class PermissionServiceImpl; |
| 27 class RenderFrameHost; | 25 class RenderFrameHost; |
| 28 class RenderProcessHost; | 26 class RenderProcessHost; |
| 29 | 27 |
| 30 // Provides information to a PermissionService. It is used by the | 28 // Provides information to a PermissionService. It is used by the |
| 31 // PermissionServiceImpl to handle request permission UI. | 29 // PermissionServiceImpl to handle request permission UI. |
| 32 // There is one PermissionServiceContext per RenderFrameHost/RenderProcessHost | 30 // There is one PermissionServiceContext per RenderFrameHost/RenderProcessHost |
| 33 // which owns it. It then owns all PermissionServiceImpl associated to their | 31 // which owns it. It then owns all PermissionServiceImpl associated to their |
| 34 // owner. | 32 // owner. |
| 35 class PermissionServiceContext : public WebContentsObserver { | 33 class PermissionServiceContext : public WebContentsObserver { |
| 36 public: | 34 public: |
| 37 explicit PermissionServiceContext(RenderFrameHost* render_frame_host); | 35 explicit PermissionServiceContext(RenderFrameHost* render_frame_host); |
| 38 explicit PermissionServiceContext(RenderProcessHost* render_process_host); | 36 explicit PermissionServiceContext(RenderProcessHost* render_process_host); |
| 39 ~PermissionServiceContext() override; | 37 ~PermissionServiceContext() override; |
| 40 | 38 |
| 41 void CreateService( | 39 void CreateService(const service_manager::BindSourceInfo& source_info, |
| 42 mojo::InterfaceRequest<blink::mojom::PermissionService> request); | 40 blink::mojom::PermissionServiceRequest request); |
| 43 | 41 |
| 44 void CreateSubscription( | 42 void CreateSubscription( |
| 45 PermissionType permission_type, | 43 PermissionType permission_type, |
| 46 const url::Origin& origin, | 44 const url::Origin& origin, |
| 47 mojo::InterfacePtr<blink::mojom::PermissionObserver> observer); | 45 mojo::InterfacePtr<blink::mojom::PermissionObserver> observer); |
| 48 | 46 |
| 49 // Called by a PermissionServiceImpl identified as |service| when it has a | 47 // Called by a PermissionServiceImpl identified as |service| when it has a |
| 50 // connection error in order to get unregistered and killed. | 48 // connection error in order to get unregistered and killed. |
| 51 void ServiceHadConnectionError(PermissionServiceImpl* service); | 49 void ServiceHadConnectionError(PermissionServiceImpl* service); |
| 52 | 50 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 74 std::vector<std::unique_ptr<PermissionServiceImpl>> services_; | 72 std::vector<std::unique_ptr<PermissionServiceImpl>> services_; |
| 75 std::unordered_map<int, std::unique_ptr<PermissionSubscription>> | 73 std::unordered_map<int, std::unique_ptr<PermissionSubscription>> |
| 76 subscriptions_; | 74 subscriptions_; |
| 77 | 75 |
| 78 DISALLOW_COPY_AND_ASSIGN(PermissionServiceContext); | 76 DISALLOW_COPY_AND_ASSIGN(PermissionServiceContext); |
| 79 }; | 77 }; |
| 80 | 78 |
| 81 } // namespace content | 79 } // namespace content |
| 82 | 80 |
| 83 #endif // CONTENT_BROWSER_PERMISSIONS_PERMISSION_SERVICE_CONTEXT_H_ | 81 #endif // CONTENT_BROWSER_PERMISSIONS_PERMISSION_SERVICE_CONTEXT_H_ |
| OLD | NEW |