| 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" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) | 97 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) |
| 98 override; | 98 override; |
| 99 void UnsubscribePermissionStatusChange(int subscription_id) override; | 99 void UnsubscribePermissionStatusChange(int subscription_id) override; |
| 100 | 100 |
| 101 // TODO(raymes): Rather than exposing this, use the denial reason from | 101 // TODO(raymes): Rather than exposing this, use the denial reason from |
| 102 // GetPermissionStatus in callers to determine whether a permission is | 102 // GetPermissionStatus in callers to determine whether a permission is |
| 103 // denied due to the kill switch. | 103 // denied due to the kill switch. |
| 104 bool IsPermissionKillSwitchOn(ContentSettingsType); | 104 bool IsPermissionKillSwitchOn(ContentSettingsType); |
| 105 | 105 |
| 106 private: | 106 private: |
| 107 friend class PermissionManagerTest; |
| 107 friend class GeolocationPermissionContextTests; | 108 friend class GeolocationPermissionContextTests; |
| 108 | 109 |
| 109 class PendingRequest; | 110 class PendingRequest; |
| 110 using PendingRequestsMap = IDMap<std::unique_ptr<PendingRequest>>; | 111 using PendingRequestsMap = IDMap<std::unique_ptr<PendingRequest>>; |
| 111 | 112 |
| 113 class PermissionResponseCallback; |
| 114 |
| 112 struct Subscription; | 115 struct Subscription; |
| 113 using SubscriptionsMap = IDMap<std::unique_ptr<Subscription>>; | 116 using SubscriptionsMap = IDMap<std::unique_ptr<Subscription>>; |
| 114 | 117 |
| 115 // KeyedService implementation | 118 // KeyedService implementation |
| 116 void Shutdown() override; | 119 void Shutdown() override; |
| 117 | 120 |
| 118 PermissionContextBase* GetPermissionContext(ContentSettingsType type); | 121 PermissionContextBase* GetPermissionContext(ContentSettingsType type); |
| 119 | 122 |
| 120 // Called when a permission was decided for a given PendingRequest. The | 123 // Called when a permission was decided for a given PendingRequest. The |
| 121 // PendingRequest is identified by its |request_id| and the permission is | 124 // PendingRequest is identified by its |request_id| and the permission is |
| (...skipping 25 matching lines...) Expand all Loading... |
| 147 std::unique_ptr<PermissionContextBase>, | 150 std::unique_ptr<PermissionContextBase>, |
| 148 ContentSettingsTypeHash> | 151 ContentSettingsTypeHash> |
| 149 permission_contexts_; | 152 permission_contexts_; |
| 150 | 153 |
| 151 base::WeakPtrFactory<PermissionManager> weak_ptr_factory_; | 154 base::WeakPtrFactory<PermissionManager> weak_ptr_factory_; |
| 152 | 155 |
| 153 DISALLOW_COPY_AND_ASSIGN(PermissionManager); | 156 DISALLOW_COPY_AND_ASSIGN(PermissionManager); |
| 154 }; | 157 }; |
| 155 | 158 |
| 156 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ | 159 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ |
| OLD | NEW |