| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_CHILD_PERMISSIONS_PERMISSION_MANAGER_H_ | 5 #ifndef CONTENT_CHILD_PERMISSIONS_PERMISSION_DISPATCHER_H_ |
| 6 #define CONTENT_CHILD_PERMISSIONS_PERMISSION_MANAGER_H_ | 6 #define CONTENT_CHILD_PERMISSIONS_PERMISSION_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/id_map.h" | 11 #include "base/id_map.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "content/common/permission_service.mojom.h" | 14 #include "content/common/permission_service.mojom.h" |
| 15 #include "third_party/WebKit/public/platform/modules/permissions/WebPermissionCl
ient.h" | 15 #include "third_party/WebKit/public/platform/modules/permissions/WebPermissionCl
ient.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 class ServiceRegistry; | 19 class ServiceRegistry; |
| 20 | 20 |
| 21 // The PermissionManager is a layer between Blink and the Mojo PermissionService | 21 // The PermissionDispatcher is a layer between Blink and the Mojo |
| 22 // It implements blink::WebPermissionClient. It is being used from workers and | 22 // PermissionService. It implements blink::WebPermissionClient. It is being used |
| 23 // frames independently. When called outside of the main thread, | 23 // from workers and frames independently. When called outside of the main |
| 24 // QueryPermissionForWorker is meant to be called. It will handle the thread | 24 // thread, QueryPermissionForWorker is meant to be called. It will handle the |
| 25 // jumping. | 25 // thread jumping. |
| 26 class PermissionManager : public blink::WebPermissionClient { | 26 class PermissionDispatcher : public blink::WebPermissionClient { |
| 27 public: | 27 public: |
| 28 // The caller must guarantee that |service_registry| will have a lifetime | 28 // The caller must guarantee that |service_registry| will have a lifetime |
| 29 // larger than this instance of PermissionManager. | 29 // larger than this instance of PermissionDispatcher. |
| 30 explicit PermissionManager(ServiceRegistry* service_registry); | 30 explicit PermissionDispatcher(ServiceRegistry* service_registry); |
| 31 virtual ~PermissionManager(); | 31 virtual ~PermissionDispatcher(); |
| 32 | 32 |
| 33 // blink::WebPermissionClient implementation. | 33 // blink::WebPermissionClient implementation. |
| 34 virtual void queryPermission(blink::WebPermissionType type, | 34 virtual void queryPermission(blink::WebPermissionType type, |
| 35 const blink::WebURL& origin, | 35 const blink::WebURL& origin, |
| 36 blink::WebPermissionQueryCallback* callback); | 36 blink::WebPermissionQueryCallback* callback); |
| 37 | 37 |
| 38 void QueryPermissionForWorker(blink::WebPermissionType type, | 38 void QueryPermissionForWorker(blink::WebPermissionType type, |
| 39 const std::string& origin, | 39 const std::string& origin, |
| 40 blink::WebPermissionQueryCallback* callback, | 40 blink::WebPermissionQueryCallback* callback, |
| 41 int worker_thread_id); | 41 int worker_thread_id); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 72 int worker_thread_id_; | 72 int worker_thread_id_; |
| 73 | 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(CallbackInformation); | 74 DISALLOW_COPY_AND_ASSIGN(CallbackInformation); |
| 75 }; | 75 }; |
| 76 using CallbackMap = IDMap<CallbackInformation, IDMapOwnPointer>; | 76 using CallbackMap = IDMap<CallbackInformation, IDMapOwnPointer>; |
| 77 CallbackMap pending_callbacks_; | 77 CallbackMap pending_callbacks_; |
| 78 | 78 |
| 79 ServiceRegistry* service_registry_; | 79 ServiceRegistry* service_registry_; |
| 80 PermissionServicePtr permission_service_; | 80 PermissionServicePtr permission_service_; |
| 81 | 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(PermissionManager); | 82 DISALLOW_COPY_AND_ASSIGN(PermissionDispatcher); |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 } // namespace content | 85 } // namespace content |
| 86 | 86 |
| 87 #endif // CONTENT_CHILD_PERMISSIONS_PERMISSION_MANAGER_H_ | 87 #endif // CONTENT_CHILD_PERMISSIONS_PERMISSION_DISPATCHER_H_ |
| OLD | NEW |