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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 kWebstorePrivate, | 212 kWebstorePrivate, |
209 kWebstoreWidgetPrivate, | 213 kWebstoreWidgetPrivate, |
210 kWebView, | 214 kWebView, |
211 kWindowShape, | 215 kWindowShape, |
212 kScreenlockPrivate, | 216 kScreenlockPrivate, |
213 kSystemCpu, | 217 kSystemCpu, |
214 kSystemMemory, | 218 kSystemMemory, |
215 kSystemNetwork, | 219 kSystemNetwork, |
216 kSystemInfoCpu, | 220 kSystemInfoCpu, |
217 kSystemInfoMemory, | 221 kSystemInfoMemory, |
218 | |
219 // Permission message IDs that are not currently valid permissions on their | |
220 // own, but are needed by various manifest permissions to represent their | |
221 // permission message rule combinations. | |
222 // TODO(sashab): Move these in-line with the other permission IDs. | |
223 kBluetooth, | 222 kBluetooth, |
224 kBluetoothDevices, | 223 kBluetoothDevices, |
225 kFavicon, | 224 kFavicon, |
226 kFullAccess, | 225 kFullAccess, |
227 kHostReadOnly, | 226 kHostReadOnly, |
228 kHostReadWrite, | 227 kHostReadWrite, |
229 kHostsAll, | 228 kHostsAll, |
230 kHostsAllReadOnly, | 229 kHostsAllReadOnly, |
231 kMediaGalleriesAllGalleriesCopyTo, | 230 kMediaGalleriesAllGalleriesCopyTo, |
232 kMediaGalleriesAllGalleriesDelete, | 231 kMediaGalleriesAllGalleriesDelete, |
233 kMediaGalleriesAllGalleriesRead, | 232 kMediaGalleriesAllGalleriesRead, |
234 kNetworkState, | 233 kNetworkState, |
235 kOverrideBookmarksUI, | 234 kOverrideBookmarksUI, |
236 kShouldWarnAllHosts, | 235 kShouldWarnAllHosts, |
237 kSocketAnyHost, | 236 kSocketAnyHost, |
238 kSocketDomainHosts, | 237 kSocketDomainHosts, |
239 kSocketSpecificHosts, | 238 kSocketSpecificHosts, |
240 kUsbDeviceList, | 239 kUsbDeviceList, |
241 kUsbDeviceUnknownProduct, | 240 kUsbDeviceUnknownProduct, |
242 kUsbDeviceUnknownVendor, | 241 kUsbDeviceUnknownVendor, |
243 | 242 // Last entry: Add new entries above and ensure to update the |
| 243 // "ExtensionPermission3" enum in tools/metrics/histograms/histograms.xml |
| 244 // (by running update_extension_permission.py). |
244 kEnumBoundary | 245 kEnumBoundary |
245 }; | 246 }; |
246 | 247 |
247 struct CheckParam { | 248 struct CheckParam { |
248 }; | 249 }; |
249 | 250 |
250 explicit APIPermission(const APIPermissionInfo* info); | 251 explicit APIPermission(const APIPermissionInfo* info); |
251 | 252 |
252 virtual ~APIPermission(); | 253 virtual ~APIPermission(); |
253 | 254 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 const char* const name_; | 451 const char* const name_; |
451 const int flags_; | 452 const int flags_; |
452 const int l10n_message_id_; | 453 const int l10n_message_id_; |
453 const PermissionMessage::ID message_id_; | 454 const PermissionMessage::ID message_id_; |
454 const APIPermissionConstructor api_permission_constructor_; | 455 const APIPermissionConstructor api_permission_constructor_; |
455 }; | 456 }; |
456 | 457 |
457 } // namespace extensions | 458 } // namespace extensions |
458 | 459 |
459 #endif // EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_ | 460 #endif // EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_ |
OLD | NEW |