| 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 CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ |
| 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ | 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <unordered_map> | 8 #include <unordered_map> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.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/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "chrome/browser/permissions/permission_util.h" |
| 14 #include "components/content_settings/core/browser/content_settings_observer.h" | 15 #include "components/content_settings/core/browser/content_settings_observer.h" |
| 15 #include "components/content_settings/core/common/content_settings.h" | 16 #include "components/content_settings/core/common/content_settings.h" |
| 16 #include "components/keyed_service/core/keyed_service.h" | 17 #include "components/keyed_service/core/keyed_service.h" |
| 17 #include "content/public/browser/permission_manager.h" | 18 #include "content/public/browser/permission_manager.h" |
| 18 | 19 |
| 19 class PermissionContextBase; | 20 class PermissionContextBase; |
| 20 class Profile; | 21 class Profile; |
| 21 | 22 |
| 22 namespace content { | 23 namespace content { |
| 23 enum class PermissionType; | 24 enum class PermissionType; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // TODO(raymes): Refactor MediaPermission to not call GetPermissionContext. | 72 // TODO(raymes): Refactor MediaPermission to not call GetPermissionContext. |
| 72 // See crbug.com/596786. | 73 // See crbug.com/596786. |
| 73 friend class MediaPermission; | 74 friend class MediaPermission; |
| 74 | 75 |
| 75 class PendingRequest; | 76 class PendingRequest; |
| 76 using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>; | 77 using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>; |
| 77 | 78 |
| 78 struct Subscription; | 79 struct Subscription; |
| 79 using SubscriptionsMap = IDMap<Subscription, IDMapOwnPointer>; | 80 using SubscriptionsMap = IDMap<Subscription, IDMapOwnPointer>; |
| 80 | 81 |
| 81 struct PermissionTypeHash { | |
| 82 std::size_t operator()(const content::PermissionType& type) const; | |
| 83 }; | |
| 84 | |
| 85 PermissionContextBase* GetPermissionContext(content::PermissionType type); | 82 PermissionContextBase* GetPermissionContext(content::PermissionType type); |
| 86 | 83 |
| 87 // Called when a permission was decided for a given PendingRequest. The | 84 // Called when a permission was decided for a given PendingRequest. The |
| 88 // PendingRequest is identified by its |request_id| and the permission is | 85 // PendingRequest is identified by its |request_id| and the permission is |
| 89 // identified by its |permission_id|. If the PendingRequest contains more than | 86 // identified by its |permission_id|. If the PendingRequest contains more than |
| 90 // one permission, it will wait for the remaining permissions to be resolved. | 87 // one permission, it will wait for the remaining permissions to be resolved. |
| 91 // When all the permissions have been resolved, the PendingRequest's callback | 88 // When all the permissions have been resolved, the PendingRequest's callback |
| 92 // is run. | 89 // is run. |
| 93 void OnPermissionsRequestResponseStatus( | 90 void OnPermissionsRequestResponseStatus( |
| 94 int request_id, | 91 int request_id, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 109 std::unique_ptr<PermissionContextBase>, | 106 std::unique_ptr<PermissionContextBase>, |
| 110 PermissionTypeHash> | 107 PermissionTypeHash> |
| 111 permission_contexts_; | 108 permission_contexts_; |
| 112 | 109 |
| 113 base::WeakPtrFactory<PermissionManager> weak_ptr_factory_; | 110 base::WeakPtrFactory<PermissionManager> weak_ptr_factory_; |
| 114 | 111 |
| 115 DISALLOW_COPY_AND_ASSIGN(PermissionManager); | 112 DISALLOW_COPY_AND_ASSIGN(PermissionManager); |
| 116 }; | 113 }; |
| 117 | 114 |
| 118 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ | 115 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ |
| OLD | NEW |