OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_ | 5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_ |
6 #define EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_ | 6 #define EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 16 matching lines...) Expand all Loading... |
27 class ChromeAPIPermissions; | 27 class ChromeAPIPermissions; |
28 | 28 |
29 // APIPermission is for handling some complex permissions. Please refer to | 29 // APIPermission is for handling some complex permissions. Please refer to |
30 // extensions::SocketPermission as an example. | 30 // extensions::SocketPermission as an example. |
31 // There is one instance per permission per loaded extension. | 31 // There is one instance per permission per loaded extension. |
32 class APIPermission { | 32 class APIPermission { |
33 public: | 33 public: |
34 // The IDs of all permissions available to apps. Add as many permissions here | 34 // The IDs of all permissions available to apps. Add as many permissions here |
35 // as needed to generate meaningful permission messages. Add the rules for the | 35 // as needed to generate meaningful permission messages. Add the rules for the |
36 // messages to ChromePermissionMessageProvider. | 36 // messages to ChromePermissionMessageProvider. |
37 // Remove permissions from this list if they have no longer have a | 37 // Do not reorder this enumeration or remove any entries. If you need to add a |
38 // corresponding API permission and no permission message. | 38 // new entry, add it just prior to kEnumBoundary, and ensure to update the |
| 39 // "ExtensionPermission3" enum in tools/metrics/histograms/histograms.xml |
| 40 // (by running update_extension_permission.py). |
39 // TODO(sashab): Move this to a more central location, and rename it to | 41 // TODO(sashab): Move this to a more central location, and rename it to |
40 // PermissionID. | 42 // PermissionID. |
41 enum ID { | 43 enum ID { |
42 // Error codes. | 44 // Error codes. |
43 kInvalid = -2, | 45 kInvalid, |
44 kUnknown = -1, | 46 kUnknown, |
45 | 47 |
46 // Real permissions. | 48 // Actual permission IDs. Not all of these are valid permissions on their |
| 49 // own; some are just needed by various manifest permissions to represent |
| 50 // their permission message rule combinations. |
47 kAccessibilityFeaturesModify, | 51 kAccessibilityFeaturesModify, |
48 kAccessibilityFeaturesRead, | 52 kAccessibilityFeaturesRead, |
49 kAccessibilityPrivate, | 53 kAccessibilityPrivate, |
50 kActiveTab, | 54 kActiveTab, |
51 kActivityLogPrivate, | 55 kActivityLogPrivate, |
52 kAlarms, | 56 kAlarms, |
53 kAlphaEnabled, | 57 kAlphaEnabled, |
54 kAlwaysOnTopWindows, | 58 kAlwaysOnTopWindows, |
55 kAppView, | 59 kAppView, |
56 kAudio, | 60 kAudio, |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 kWebrtcLoggingPrivate, | 210 kWebrtcLoggingPrivate, |
207 kWebstorePrivate, | 211 kWebstorePrivate, |
208 kWebView, | 212 kWebView, |
209 kWindowShape, | 213 kWindowShape, |
210 kScreenlockPrivate, | 214 kScreenlockPrivate, |
211 kSystemCpu, | 215 kSystemCpu, |
212 kSystemMemory, | 216 kSystemMemory, |
213 kSystemNetwork, | 217 kSystemNetwork, |
214 kSystemInfoCpu, | 218 kSystemInfoCpu, |
215 kSystemInfoMemory, | 219 kSystemInfoMemory, |
216 | |
217 // Permission message IDs that are not currently valid permissions on their | |
218 // own, but are needed by various manifest permissions to represent their | |
219 // permission message rule combinations. | |
220 // TODO(sashab): Move these in-line with the other permission IDs. | |
221 kBluetooth, | 220 kBluetooth, |
222 kBluetoothDevices, | 221 kBluetoothDevices, |
223 kFavicon, | 222 kFavicon, |
224 kFullAccess, | 223 kFullAccess, |
225 kHostReadOnly, | 224 kHostReadOnly, |
226 kHostReadWrite, | 225 kHostReadWrite, |
227 kHostsAll, | 226 kHostsAll, |
228 kHostsAllReadOnly, | 227 kHostsAllReadOnly, |
229 kMediaGalleriesAllGalleriesCopyTo, | 228 kMediaGalleriesAllGalleriesCopyTo, |
230 kMediaGalleriesAllGalleriesDelete, | 229 kMediaGalleriesAllGalleriesDelete, |
231 kMediaGalleriesAllGalleriesRead, | 230 kMediaGalleriesAllGalleriesRead, |
232 kNetworkState, | 231 kNetworkState, |
233 kOverrideBookmarksUI, | 232 kOverrideBookmarksUI, |
234 kShouldWarnAllHosts, | 233 kShouldWarnAllHosts, |
235 kSocketAnyHost, | 234 kSocketAnyHost, |
236 kSocketDomainHosts, | 235 kSocketDomainHosts, |
237 kSocketSpecificHosts, | 236 kSocketSpecificHosts, |
238 kUsbDeviceList, | 237 kUsbDeviceList, |
239 kUsbDeviceUnknownProduct, | 238 kUsbDeviceUnknownProduct, |
240 kUsbDeviceUnknownVendor, | 239 kUsbDeviceUnknownVendor, |
241 | 240 // Last entry: Add new entries above and ensure to update the |
| 241 // "ExtensionPermission3" enum in tools/metrics/histograms/histograms.xml |
| 242 // (by running update_extension_permission.py). |
242 kEnumBoundary | 243 kEnumBoundary |
243 }; | 244 }; |
244 | 245 |
245 struct CheckParam { | 246 struct CheckParam { |
246 }; | 247 }; |
247 | 248 |
248 explicit APIPermission(const APIPermissionInfo* info); | 249 explicit APIPermission(const APIPermissionInfo* info); |
249 | 250 |
250 virtual ~APIPermission(); | 251 virtual ~APIPermission(); |
251 | 252 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 const char* const name_; | 449 const char* const name_; |
449 const int flags_; | 450 const int flags_; |
450 const int l10n_message_id_; | 451 const int l10n_message_id_; |
451 const PermissionMessage::ID message_id_; | 452 const PermissionMessage::ID message_id_; |
452 const APIPermissionConstructor api_permission_constructor_; | 453 const APIPermissionConstructor api_permission_constructor_; |
453 }; | 454 }; |
454 | 455 |
455 } // namespace extensions | 456 } // namespace extensions |
456 | 457 |
457 #endif // EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_ | 458 #endif // EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_ |
OLD | NEW |