mlamouri | 4e37202 | 2015-03-29 14:51:06 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
Clark DuVall | 6b73c74 | 2020-03-11 19:00:15 | [diff] [blame] | 5 | #ifndef COMPONENTS_PERMISSIONS_PERMISSION_MANAGER_H_ |
| 6 | #define COMPONENTS_PERMISSIONS_PERMISSION_MANAGER_H_ |
mlamouri | 4e37202 | 2015-03-29 14:51:06 | [diff] [blame] | 7 | |
Lei Zhang | 998100f | 2021-06-25 17:58:19 | [diff] [blame] | 8 | #include <map> |
raymes | e3afee6b | 2016-04-18 02:00:50 | [diff] [blame] | 9 | #include <unordered_map> |
| 10 | |
mlamouri | 4e37202 | 2015-03-29 14:51:06 | [diff] [blame] | 11 | #include "base/callback_forward.h" |
James Hollyer | d281a731 | 2021-04-29 21:07:59 | [diff] [blame] | 12 | #include "base/containers/flat_map.h" |
Brett Wilson | f976d3f | 2017-08-18 17:23:39 | [diff] [blame] | 13 | #include "base/containers/id_map.h" |
Keishi Hattori | 0e45c02 | 2021-11-27 09:25:52 | [diff] [blame] | 14 | #include "base/memory/raw_ptr.h" |
mlamouri | 23957a2 | 2015-04-01 10:37:56 | [diff] [blame] | 15 | #include "components/content_settings/core/browser/content_settings_observer.h" |
lalitm | 27583e9 | 2015-10-02 11:34:17 | [diff] [blame] | 16 | #include "components/content_settings/core/common/content_settings.h" |
mlamouri | 4e37202 | 2015-03-29 14:51:06 | [diff] [blame] | 17 | #include "components/keyed_service/core/keyed_service.h" |
James Hollyer | d281a731 | 2021-04-29 21:07:59 | [diff] [blame] | 18 | #include "components/permissions/permission_context_base.h" |
Balazs Engedy | e15473b | 2021-04-14 09:09:21 | [diff] [blame] | 19 | #include "components/permissions/permission_request_id.h" |
Clark DuVall | 732778e | 2020-01-27 18:13:58 | [diff] [blame] | 20 | #include "components/permissions/permission_util.h" |
Andrey Lushnikov | f350010 | 2018-07-16 19:55:22 | [diff] [blame] | 21 | #include "content/public/browser/permission_controller_delegate.h" |
Pavel Feldman | 73b2202 | 2018-11-02 02:55:30 | [diff] [blame] | 22 | #include "content/public/browser/permission_type.h" |
Rohan Pavone | faf6457 | 2019-07-30 17:50:20 | [diff] [blame] | 23 | #include "url/origin.h" |
mlamouri | 4e37202 | 2015-03-29 14:51:06 | [diff] [blame] | 24 | |
Clark DuVall | 6b73c74 | 2020-03-11 19:00:15 | [diff] [blame] | 25 | namespace content { |
| 26 | class BrowserContext; |
Robbie McElrath | 8d5602a | 2022-04-01 17:39:18 | [diff] [blame^] | 27 | class RenderFrameHost; |
| 28 | class RenderProcessHost; |
Clark DuVall | 6b73c74 | 2020-03-11 19:00:15 | [diff] [blame] | 29 | } |
| 30 | |
Clark DuVall | 484c256 | 2020-01-23 22:05:09 | [diff] [blame] | 31 | namespace permissions { |
Clark DuVall | a11361ad3 | 2020-02-20 22:14:27 | [diff] [blame] | 32 | class PermissionContextBase; |
timloh | c691180 | 2017-03-01 05:37:03 | [diff] [blame] | 33 | struct PermissionResult; |
mlamouri | 4e37202 | 2015-03-29 14:51:06 | [diff] [blame] | 34 | |
mlamouri | 4e37202 | 2015-03-29 14:51:06 | [diff] [blame] | 35 | class PermissionManager : public KeyedService, |
Andrey Lushnikov | f350010 | 2018-07-16 19:55:22 | [diff] [blame] | 36 | public content::PermissionControllerDelegate, |
James Hollyer | d281a731 | 2021-04-29 21:07:59 | [diff] [blame] | 37 | public permissions::Observer { |
mlamouri | 4e37202 | 2015-03-29 14:51:06 | [diff] [blame] | 38 | public: |
Clark DuVall | 6b73c74 | 2020-03-11 19:00:15 | [diff] [blame] | 39 | using PermissionContextMap = |
| 40 | std::unordered_map<ContentSettingsType, |
| 41 | std::unique_ptr<PermissionContextBase>, |
| 42 | ContentSettingsTypeHash>; |
| 43 | PermissionManager(content::BrowserContext* browser_context, |
| 44 | PermissionContextMap permission_contexts); |
Peter Boström | 09c0182 | 2021-09-20 22:43:27 | [diff] [blame] | 45 | |
| 46 | PermissionManager(const PermissionManager&) = delete; |
| 47 | PermissionManager& operator=(const PermissionManager&) = delete; |
| 48 | |
mlamouri | 4e37202 | 2015-03-29 14:51:06 | [diff] [blame] | 49 | ~PermissionManager() override; |
| 50 | |
Marc Treib | 9e4bd92 | 2017-09-25 08:32:13 | [diff] [blame] | 51 | // Converts from |url|'s actual origin to the "canonical origin" that should |
| 52 | // be used for the purpose of requesting/storing permissions. For example, the |
Raymes Khoury | b474c64 | 2018-02-28 06:16:28 | [diff] [blame] | 53 | // origin of the local NTP gets mapped to the Google base URL instead. With |
| 54 | // Permission Delegation it will transform the requesting origin into |
| 55 | // the embedding origin because all permission checks happen on the top level |
| 56 | // origin. |
| 57 | // |
| 58 | // All the public methods below, such as RequestPermission or |
| 59 | // GetPermissionStatus, take the actual origin and do the canonicalization |
| 60 | // internally. You only need to call this directly if you do something else |
| 61 | // with the origin, such as display it in the UI. |
Balazs Engedy | f39e22b | 2019-07-30 11:16:24 | [diff] [blame] | 62 | GURL GetCanonicalOrigin(ContentSettingsType permission, |
| 63 | const GURL& requesting_origin, |
Raymes Khoury | b474c64 | 2018-02-28 06:16:28 | [diff] [blame] | 64 | const GURL& embedding_origin) const; |
Marc Treib | 9e4bd92 | 2017-09-25 08:32:13 | [diff] [blame] | 65 | |
timloh | 9a180ad | 2017-02-20 07:15:23 | [diff] [blame] | 66 | // Callers from within chrome/ should use the methods which take the |
| 67 | // ContentSettingsType enum. The methods which take PermissionType values |
Andrey Lushnikov | f350010 | 2018-07-16 19:55:22 | [diff] [blame] | 68 | // are for the content::PermissionControllerDelegate overrides and shouldn't |
| 69 | // be used from chrome/. |
Illia Klimov | fa8fa51 | 2021-07-14 20:36:34 | [diff] [blame] | 70 | // Deprecated. Use `RequestPermissionFromCurrentDocument` instead. |
Balazs Engedy | e30e961 | 2021-04-02 10:37:29 | [diff] [blame] | 71 | void RequestPermission(ContentSettingsType permission, |
| 72 | content::RenderFrameHost* render_frame_host, |
| 73 | const GURL& requesting_origin, |
| 74 | bool user_gesture, |
| 75 | base::OnceCallback<void(ContentSetting)> callback); |
Illia Klimov | fa8fa51 | 2021-07-14 20:36:34 | [diff] [blame] | 76 | // Deprecated. Use `RequestPermissionsFromCurrentDocument` instead. |
Balazs Engedy | e30e961 | 2021-04-02 10:37:29 | [diff] [blame] | 77 | void RequestPermissions( |
timloh | 592d732 | 2017-02-23 07:23:54 | [diff] [blame] | 78 | const std::vector<ContentSettingsType>& permissions, |
| 79 | content::RenderFrameHost* render_frame_host, |
| 80 | const GURL& requesting_origin, |
| 81 | bool user_gesture, |
danakj | 47c8fb5 | 2019-05-02 16:34:36 | [diff] [blame] | 82 | base::OnceCallback<void(const std::vector<ContentSetting>&)> callback); |
Illia Klimov | fa8fa51 | 2021-07-14 20:36:34 | [diff] [blame] | 83 | void RequestPermissionFromCurrentDocument( |
| 84 | ContentSettingsType permission, |
| 85 | content::RenderFrameHost* render_frame_host, |
| 86 | bool user_gesture, |
| 87 | base::OnceCallback<void(ContentSetting)> callback); |
| 88 | // Requests the given `permission` on behalf of the last committed document in |
| 89 | // `render_frame_host`, also performing additional checks such as Permission |
| 90 | // Policy. |
| 91 | void RequestPermissionsFromCurrentDocument( |
| 92 | const std::vector<ContentSettingsType>& permissions, |
| 93 | content::RenderFrameHost* render_frame_host, |
| 94 | bool user_gesture, |
| 95 | base::OnceCallback<void(const std::vector<ContentSetting>&)> callback); |
timloh | 592d732 | 2017-02-23 07:23:54 | [diff] [blame] | 96 | |
Clark DuVall | 6b73c74 | 2020-03-11 19:00:15 | [diff] [blame] | 97 | PermissionResult GetPermissionStatus(ContentSettingsType permission, |
| 98 | const GURL& requesting_origin, |
| 99 | const GURL& embedding_origin); |
timloh | 9a180ad | 2017-02-20 07:15:23 | [diff] [blame] | 100 | |
Illia Klimov | 678d9fca | 2022-03-28 11:03:54 | [diff] [blame] | 101 | // Returns the permission status for a given `permission` and displayed, |
| 102 | // top-level `origin`. This should be used only for displaying on the |
| 103 | // browser's native UI (PageInfo, Settings, etc.). This method does not take |
| 104 | // context specific restrictions (e.g. permission policy) into consideration. |
| 105 | PermissionResult GetPermissionStatusForDisplayOnSettingsUI( |
| 106 | ContentSettingsType permission, |
| 107 | const GURL& origin); |
| 108 | |
raymes | f6104d49 | 2017-03-09 01:20:18 | [diff] [blame] | 109 | // Returns the permission status for a given frame. This should be preferred |
| 110 | // over GetPermissionStatus as additional checks can be performed when we know |
| 111 | // the exact context the request is coming from. |
raymes | 79f22a61 | 2017-03-13 05:28:10 | [diff] [blame] | 112 | // TODO(raymes): Currently we still pass the |requesting_origin| as a separate |
| 113 | // parameter because we can't yet guarantee that it matches the last committed |
| 114 | // origin of the RenderFrameHost. See crbug.com/698985. |
Illia Klimov | fa8fa51 | 2021-07-14 20:36:34 | [diff] [blame] | 115 | // Deprecated. Use `GetPermissionStatusForCurrentDocument` instead. |
Clark DuVall | 6b73c74 | 2020-03-11 19:00:15 | [diff] [blame] | 116 | PermissionResult GetPermissionStatusForFrame( |
raymes | f6104d49 | 2017-03-09 01:20:18 | [diff] [blame] | 117 | ContentSettingsType permission, |
raymes | 79f22a61 | 2017-03-13 05:28:10 | [diff] [blame] | 118 | content::RenderFrameHost* render_frame_host, |
| 119 | const GURL& requesting_origin); |
raymes | f6104d49 | 2017-03-09 01:20:18 | [diff] [blame] | 120 | |
Illia Klimov | fa8fa51 | 2021-07-14 20:36:34 | [diff] [blame] | 121 | // Returns the status for the given `permission` on behalf of the last |
| 122 | // committed document in `render_frame_host`, also performing additional |
| 123 | // checks such as Permission Policy. |
| 124 | PermissionResult GetPermissionStatusForCurrentDocument( |
| 125 | ContentSettingsType permission, |
| 126 | content::RenderFrameHost* render_frame_host); |
| 127 | |
Robbie McElrath | 8d5602a | 2022-04-01 17:39:18 | [diff] [blame^] | 128 | // Returns the status of the given `permission` for a worker on `origin` |
| 129 | // running in the renderer corresponding to `render_process_host`. |
| 130 | PermissionResult GetPermissionStatusForWorker( |
| 131 | ContentSettingsType permission, |
| 132 | content::RenderProcessHost* render_process_host, |
| 133 | const url::Origin& worker_origin); |
| 134 | |
Andrey Lushnikov | f350010 | 2018-07-16 19:55:22 | [diff] [blame] | 135 | // content::PermissionControllerDelegate implementation. |
Balazs Engedy | e30e961 | 2021-04-02 10:37:29 | [diff] [blame] | 136 | void RequestPermission( |
| 137 | content::PermissionType permission, |
| 138 | content::RenderFrameHost* render_frame_host, |
| 139 | const GURL& requesting_origin, |
| 140 | bool user_gesture, |
| 141 | base::OnceCallback<void(blink::mojom::PermissionStatus)> callback) |
| 142 | override; |
| 143 | void RequestPermissions( |
mlamouri | 8b5ec90 | 2015-10-24 00:52:03 | [diff] [blame] | 144 | const std::vector<content::PermissionType>& permissions, |
| 145 | content::RenderFrameHost* render_frame_host, |
| 146 | const GURL& requesting_origin, |
benwells | fd2b155 | 2016-07-05 04:26:53 | [diff] [blame] | 147 | bool user_gesture, |
danakj | 47c8fb5 | 2019-05-02 16:34:36 | [diff] [blame] | 148 | base::OnceCallback< |
| 149 | void(const std::vector<blink::mojom::PermissionStatus>&)> callback) |
leon.han | 06e5566 | 2016-03-26 17:19:42 | [diff] [blame] | 150 | override; |
mlamouri | 4e37202 | 2015-03-29 14:51:06 | [diff] [blame] | 151 | void ResetPermission(content::PermissionType permission, |
| 152 | const GURL& requesting_origin, |
| 153 | const GURL& embedding_origin) override; |
mathp | cc29ae5 | 2016-05-04 15:22:17 | [diff] [blame] | 154 | blink::mojom::PermissionStatus GetPermissionStatus( |
mlamouri | 4e37202 | 2015-03-29 14:51:06 | [diff] [blame] | 155 | content::PermissionType permission, |
| 156 | const GURL& requesting_origin, |
| 157 | const GURL& embedding_origin) override; |
Raymes Khoury | 4ead6c3 | 2018-03-07 04:43:48 | [diff] [blame] | 158 | blink::mojom::PermissionStatus GetPermissionStatusForFrame( |
| 159 | content::PermissionType permission, |
| 160 | content::RenderFrameHost* render_frame_host, |
| 161 | const GURL& requesting_origin) override; |
Illia Klimov | f284284 | 2022-03-22 11:33:39 | [diff] [blame] | 162 | blink::mojom::PermissionStatus GetPermissionStatusForCurrentDocument( |
| 163 | content::PermissionType permission, |
| 164 | content::RenderFrameHost* render_frame_host) override; |
Robbie McElrath | 8d5602a | 2022-04-01 17:39:18 | [diff] [blame^] | 165 | blink::mojom::PermissionStatus GetPermissionStatusForWorker( |
| 166 | content::PermissionType permission, |
| 167 | content::RenderProcessHost* render_process_host, |
| 168 | const GURL& worker_origin) override; |
Pavel Feldman | 446a91b | 2020-03-13 17:39:55 | [diff] [blame] | 169 | bool IsPermissionOverridableByDevTools( |
| 170 | content::PermissionType permission, |
Anton Bikineev | 1156b5f | 2021-05-15 22:35:36 | [diff] [blame] | 171 | const absl::optional<url::Origin>& origin) override; |
Balazs Engedy | ad1489b | 2021-03-31 07:47:19 | [diff] [blame] | 172 | SubscriptionId SubscribePermissionStatusChange( |
mlamouri | 23957a2 | 2015-04-01 10:37:56 | [diff] [blame] | 173 | content::PermissionType permission, |
Robbie McElrath | 8d5602a | 2022-04-01 17:39:18 | [diff] [blame^] | 174 | content::RenderProcessHost* render_process_host, |
Raymes Khoury | 3ef4f6e | 2018-08-09 09:34:48 | [diff] [blame] | 175 | content::RenderFrameHost* render_frame_host, |
mlamouri | 23957a2 | 2015-04-01 10:37:56 | [diff] [blame] | 176 | const GURL& requesting_origin, |
danakj | 47c8fb5 | 2019-05-02 16:34:36 | [diff] [blame] | 177 | base::RepeatingCallback<void(blink::mojom::PermissionStatus)> callback) |
mathp | cc29ae5 | 2016-05-04 15:22:17 | [diff] [blame] | 178 | override; |
Balazs Engedy | ad1489b | 2021-03-31 07:47:19 | [diff] [blame] | 179 | void UnsubscribePermissionStatusChange( |
| 180 | SubscriptionId subscription_id) override; |
mlamouri | 4e37202 | 2015-03-29 14:51:06 | [diff] [blame] | 181 | |
timloh | c691180 | 2017-03-01 05:37:03 | [diff] [blame] | 182 | // TODO(raymes): Rather than exposing this, use the denial reason from |
| 183 | // GetPermissionStatus in callers to determine whether a permission is |
raymes | 893dbdd60 | 2016-12-19 22:49:29 | [diff] [blame] | 184 | // denied due to the kill switch. |
timloh | 9a180ad | 2017-02-20 07:15:23 | [diff] [blame] | 185 | bool IsPermissionKillSwitchOn(ContentSettingsType); |
raymes | 893dbdd60 | 2016-12-19 22:49:29 | [diff] [blame] | 186 | |
Rohan Pavone | faf6457 | 2019-07-30 17:50:20 | [diff] [blame] | 187 | // For the given |origin|, overrides permissions that belong to |overrides|. |
| 188 | // These permissions are in-sync with the PermissionController. |
| 189 | void SetPermissionOverridesForDevTools( |
Anton Bikineev | 1156b5f | 2021-05-15 22:35:36 | [diff] [blame] | 190 | const absl::optional<url::Origin>& origin, |
Rohan Pavone | faf6457 | 2019-07-30 17:50:20 | [diff] [blame] | 191 | const PermissionOverrides& overrides) override; |
| 192 | void ResetPermissionOverridesForDevTools() override; |
Pavel Feldman | 73b2202 | 2018-11-02 02:55:30 | [diff] [blame] | 193 | |
Alexey Baskakov | 386f174 | 2019-09-03 04:08:47 | [diff] [blame] | 194 | // KeyedService implementation |
| 195 | void Shutdown() override; |
| 196 | |
Clark DuVall | 2c6c867 | 2020-03-18 18:41:20 | [diff] [blame] | 197 | // Helper method to convert PermissionType to ContentSettingType. |
| 198 | static ContentSettingsType PermissionTypeToContentSetting( |
| 199 | content::PermissionType permission); |
| 200 | |
Clark DuVall | 6b73c74 | 2020-03-11 19:00:15 | [diff] [blame] | 201 | PermissionContextBase* GetPermissionContextForTesting( |
| 202 | ContentSettingsType type); |
| 203 | |
mlamouri | 4e37202 | 2015-03-29 14:51:06 | [diff] [blame] | 204 | private: |
raymes | 158a8c1 | 2017-07-06 02:52:59 | [diff] [blame] | 205 | friend class PermissionManagerTest; |
raymes | e3afee6b | 2016-04-18 02:00:50 | [diff] [blame] | 206 | |
Balazs Engedy | e15473b | 2021-04-14 09:09:21 | [diff] [blame] | 207 | // The `PendingRequestLocalId` will be unique within the `PermissionManager` |
| 208 | // instance, thus within a `BrowserContext`, which overachieves the |
| 209 | // requirement from `PermissionRequestID` that the `RequestLocalId` be unique |
| 210 | // within each frame. |
mlamouri | 8b5ec90 | 2015-10-24 00:52:03 | [diff] [blame] | 211 | class PendingRequest; |
Balazs Engedy | e15473b | 2021-04-14 09:09:21 | [diff] [blame] | 212 | using PendingRequestLocalId = PermissionRequestID::RequestLocalId; |
| 213 | using PendingRequestsMap = |
| 214 | base::IDMap<std::unique_ptr<PendingRequest>, PendingRequestLocalId>; |
lalitm | 27583e9 | 2015-10-02 11:34:17 | [diff] [blame] | 215 | |
raymes | 158a8c1 | 2017-07-06 02:52:59 | [diff] [blame] | 216 | class PermissionResponseCallback; |
| 217 | |
mlamouri | 23957a2 | 2015-04-01 10:37:56 | [diff] [blame] | 218 | struct Subscription; |
Balazs Engedy | ad1489b | 2021-03-31 07:47:19 | [diff] [blame] | 219 | using SubscriptionsMap = |
| 220 | base::IDMap<std::unique_ptr<Subscription>, SubscriptionId>; |
James Hollyer | d281a731 | 2021-04-29 21:07:59 | [diff] [blame] | 221 | using SubscriptionTypeCounts = base::flat_map<ContentSettingsType, size_t>; |
mlamouri | 23957a2 | 2015-04-01 10:37:56 | [diff] [blame] | 222 | |
Clark DuVall | 6b73c74 | 2020-03-11 19:00:15 | [diff] [blame] | 223 | PermissionContextBase* GetPermissionContext(ContentSettingsType type); |
raymes | e3afee6b | 2016-04-18 02:00:50 | [diff] [blame] | 224 | |
mlamouri | 8b5ec90 | 2015-10-24 00:52:03 | [diff] [blame] | 225 | // Called when a permission was decided for a given PendingRequest. The |
Balazs Engedy | e15473b | 2021-04-14 09:09:21 | [diff] [blame] | 226 | // PendingRequest is identified by its |request_local_id| and the permission |
| 227 | // is identified by its |permission_id|. If the PendingRequest contains more |
| 228 | // than one permission, it will wait for the remaining permissions to be |
| 229 | // resolved. When all the permissions have been resolved, the PendingRequest's |
| 230 | // callback is run. |
| 231 | void OnPermissionsRequestResponseStatus( |
| 232 | PendingRequestLocalId request_local_id, |
| 233 | int permission_id, |
| 234 | ContentSetting status); |
lalitm | 27583e9 | 2015-10-02 11:34:17 | [diff] [blame] | 235 | |
James Hollyer | d281a731 | 2021-04-29 21:07:59 | [diff] [blame] | 236 | // permissions::Observer: |
| 237 | void OnPermissionChanged(const ContentSettingsPattern& primary_pattern, |
| 238 | const ContentSettingsPattern& secondary_pattern, |
Christian Dullweber | 2c4c71d | 2021-10-14 15:07:43 | [diff] [blame] | 239 | ContentSettingsTypeSet content_type_set) override; |
mlamouri | 23957a2 | 2015-04-01 10:37:56 | [diff] [blame] | 240 | |
Robbie McElrath | 8d5602a | 2022-04-01 17:39:18 | [diff] [blame^] | 241 | // Only one of |render_process_host| and |render_frame_host| should be set, |
| 242 | // or neither. RenderProcessHost will be inferred from |render_frame_host|. |
Clark DuVall | 6b73c74 | 2020-03-11 19:00:15 | [diff] [blame] | 243 | PermissionResult GetPermissionStatusHelper( |
raymes | f6104d49 | 2017-03-09 01:20:18 | [diff] [blame] | 244 | ContentSettingsType permission, |
Robbie McElrath | 8d5602a | 2022-04-01 17:39:18 | [diff] [blame^] | 245 | content::RenderProcessHost* render_process_host, |
raymes | f6104d49 | 2017-03-09 01:20:18 | [diff] [blame] | 246 | content::RenderFrameHost* render_frame_host, |
| 247 | const GURL& requesting_origin, |
| 248 | const GURL& embedding_origin); |
| 249 | |
Pavel Feldman | 73b2202 | 2018-11-02 02:55:30 | [diff] [blame] | 250 | ContentSetting GetPermissionOverrideForDevTools( |
Rohan Pavone | 8180cba6 | 2019-08-26 20:55:09 | [diff] [blame] | 251 | const url::Origin& origin, |
Pavel Feldman | 73b2202 | 2018-11-02 02:55:30 | [diff] [blame] | 252 | ContentSettingsType permission); |
| 253 | |
Keishi Hattori | 0e45c02 | 2021-11-27 09:25:52 | [diff] [blame] | 254 | raw_ptr<content::BrowserContext> browser_context_; |
Balazs Engedy | e15473b | 2021-04-14 09:09:21 | [diff] [blame] | 255 | |
lalitm | 27583e9 | 2015-10-02 11:34:17 | [diff] [blame] | 256 | PendingRequestsMap pending_requests_; |
Balazs Engedy | e15473b | 2021-04-14 09:09:21 | [diff] [blame] | 257 | PendingRequestLocalId::Generator request_local_id_generator_; |
| 258 | |
mlamouri | 23957a2 | 2015-04-01 10:37:56 | [diff] [blame] | 259 | SubscriptionsMap subscriptions_; |
Balazs Engedy | ad1489b | 2021-03-31 07:47:19 | [diff] [blame] | 260 | SubscriptionId::Generator subscription_id_generator_; |
mlamouri | 4e37202 | 2015-03-29 14:51:06 | [diff] [blame] | 261 | |
James Hollyer | d281a731 | 2021-04-29 21:07:59 | [diff] [blame] | 262 | // Tracks the number of Subscriptions in |subscriptions_| which have a |
| 263 | // certain ContentSettingsType. An entry for a given ContentSettingsType key |
| 264 | // is added on first use and never removed. This is done to utilize the |
| 265 | // flat_map's efficiency in accessing/editing items and minimize the use of |
| 266 | // the unefficient addition/removal of items. |
| 267 | SubscriptionTypeCounts subscription_type_counts_; |
| 268 | |
Clark DuVall | 6b73c74 | 2020-03-11 19:00:15 | [diff] [blame] | 269 | PermissionContextMap permission_contexts_; |
Rohan Pavone | faf6457 | 2019-07-30 17:50:20 | [diff] [blame] | 270 | using ContentSettingsTypeOverrides = |
| 271 | base::flat_map<ContentSettingsType, ContentSetting>; |
| 272 | std::map<url::Origin, ContentSettingsTypeOverrides> |
| 273 | devtools_permission_overrides_; |
Pavel Feldman | 446a91b | 2020-03-13 17:39:55 | [diff] [blame] | 274 | url::Origin devtools_global_overrides_origin_; |
raymes | e3afee6b | 2016-04-18 02:00:50 | [diff] [blame] | 275 | |
Alexey Baskakov | 386f174 | 2019-09-03 04:08:47 | [diff] [blame] | 276 | bool is_shutting_down_ = false; |
mlamouri | 4e37202 | 2015-03-29 14:51:06 | [diff] [blame] | 277 | }; |
| 278 | |
Clark DuVall | 6b73c74 | 2020-03-11 19:00:15 | [diff] [blame] | 279 | } // namespace permissions |
| 280 | |
| 281 | #endif // COMPONENTS_PERMISSIONS_PERMISSION_MANAGER_H_ |