Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(960)

Side by Side Diff: extensions/common/permissions/api_permission.h

Issue 1094873002: Extensions: Switch to new permission message system, part V (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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.
39 // TODO(sashab): Move this to a more central location, and rename it to 39 // TODO(sashab): Move this to a more central location, and rename it to
40 // PermissionID. 40 // PermissionID.
41 enum ID { 41 enum ID {
42 // Error codes. 42 // Error codes.
43 kInvalid = -2, 43 kInvalid,
44 kUnknown = -1, 44 kUnknown,
45
46 // For use in histograms.
47 kNone,
Marc Treib 2015/04/17 13:09:33 Not quite sure about this: The existing histograms
Devlin 2015/04/27 17:58:03 I agree - it's weird to have "None" as a unique pe
Marc Treib 2015/04/28 12:31:32 I've removed the "None" type for the new histogram
45 48
46 // Real permissions. 49 // Real permissions.
47 kAccessibilityFeaturesModify, 50 kAccessibilityFeaturesModify,
48 kAccessibilityFeaturesRead, 51 kAccessibilityFeaturesRead,
49 kAccessibilityPrivate, 52 kAccessibilityPrivate,
50 kActiveTab, 53 kActiveTab,
51 kActivityLogPrivate, 54 kActivityLogPrivate,
52 kAlarms, 55 kAlarms,
53 kAlphaEnabled, 56 kAlphaEnabled,
54 kAlwaysOnTopWindows, 57 kAlwaysOnTopWindows,
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 kScreenlockPrivate, 211 kScreenlockPrivate,
209 kSystemCpu, 212 kSystemCpu,
210 kSystemMemory, 213 kSystemMemory,
211 kSystemNetwork, 214 kSystemNetwork,
212 kSystemInfoCpu, 215 kSystemInfoCpu,
213 kSystemInfoMemory, 216 kSystemInfoMemory,
214 217
215 // Permission message IDs that are not currently valid permissions on their 218 // Permission message IDs that are not currently valid permissions on their
216 // own, but are needed by various manifest permissions to represent their 219 // own, but are needed by various manifest permissions to represent their
217 // permission message rule combinations. 220 // permission message rule combinations.
218 // TODO(sashab): Move these in-line with the other permission IDs. 221 // TODO(sashab): Move these in-line with the other permission IDs.
Marc Treib 2015/04/17 13:09:33 We'd have to do this reordering right now, before
Devlin 2015/04/27 17:58:03 Yeah, there's no way we can keep them in order - b
Marc Treib 2015/04/28 12:31:32 I'm a bit concerned that when a developer sees an
Devlin 2015/04/28 16:16:36 I was actually toying with the same idea... and it
Marc Treib 2015/04/29 11:24:02 Good idea! I've added a presubmit check for extens
219 kBluetooth, 222 kBluetooth,
220 kBluetoothDevices, 223 kBluetoothDevices,
221 kFavicon, 224 kFavicon,
222 kFullAccess, 225 kFullAccess,
223 kHostReadOnly, 226 kHostReadOnly,
224 kHostReadWrite, 227 kHostReadWrite,
225 kHostsAll, 228 kHostsAll,
226 kHostsAllReadOnly, 229 kHostsAllReadOnly,
227 kMediaGalleriesAllGalleriesCopyTo, 230 kMediaGalleriesAllGalleriesCopyTo,
228 kMediaGalleriesAllGalleriesDelete, 231 kMediaGalleriesAllGalleriesDelete,
229 kMediaGalleriesAllGalleriesRead, 232 kMediaGalleriesAllGalleriesRead,
230 kNetworkState, 233 kNetworkState,
231 kOverrideBookmarksUI, 234 kOverrideBookmarksUI,
232 kShouldWarnAllHosts, 235 kShouldWarnAllHosts,
233 kSocketAnyHost, 236 kSocketAnyHost,
234 kSocketDomainHosts, 237 kSocketDomainHosts,
235 kSocketSpecificHosts, 238 kSocketSpecificHosts,
236 kUsbDeviceList, 239 kUsbDeviceList,
237 kUsbDeviceUnknownProduct, 240 kUsbDeviceUnknownProduct,
238 kUsbDeviceUnknownVendor, 241 kUsbDeviceUnknownVendor,
239 242
243 // Last entry: Add new entries above and ensure to update the
244 // "ExtensionPermission3" enum in tools/metrics/histograms/histograms.xml
245 // (by running update_extension_functions.py).
240 kEnumBoundary 246 kEnumBoundary
241 }; 247 };
242 248
243 struct CheckParam { 249 struct CheckParam {
244 }; 250 };
245 251
246 explicit APIPermission(const APIPermissionInfo* info); 252 explicit APIPermission(const APIPermissionInfo* info);
247 253
248 virtual ~APIPermission(); 254 virtual ~APIPermission();
249 255
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 const char* const name_; 452 const char* const name_;
447 const int flags_; 453 const int flags_;
448 const int l10n_message_id_; 454 const int l10n_message_id_;
449 const PermissionMessage::ID message_id_; 455 const PermissionMessage::ID message_id_;
450 const APIPermissionConstructor api_permission_constructor_; 456 const APIPermissionConstructor api_permission_constructor_;
451 }; 457 };
452 458
453 } // namespace extensions 459 } // namespace extensions
454 460
455 #endif // EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_ 461 #endif // EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698