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

Side by Side Diff: extensions/common/permissions/extensions_api_permissions.cc

Issue 339953002: Move usbDevices permission out to //extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/permissions/chrome_api_permissions.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "extensions/common/permissions/extensions_api_permissions.h" 5 #include "extensions/common/permissions/extensions_api_permissions.h"
6 6
7 #include "extensions/common/permissions/api_permission.h" 7 #include "extensions/common/permissions/api_permission.h"
8 #include "extensions/common/permissions/permission_message.h" 8 #include "extensions/common/permissions/permission_message.h"
9 #include "extensions/common/permissions/socket_permission.h" 9 #include "extensions/common/permissions/socket_permission.h"
10 #include "extensions/common/permissions/usb_device_permission.h"
10 #include "grit/extensions_strings.h" 11 #include "grit/extensions_strings.h"
11 12
12 namespace extensions { 13 namespace extensions {
13 14
14 namespace { 15 namespace {
15 16
16 template <typename T> 17 template <typename T>
17 APIPermission* CreateAPIPermission(const APIPermissionInfo* permission) { 18 APIPermission* CreateAPIPermission(const APIPermissionInfo* permission) {
18 return new T(permission); 19 return new T(permission);
19 } 20 }
20 21
21 } // namespace 22 } // namespace
22 23
23 std::vector<APIPermissionInfo*> ExtensionsAPIPermissions::GetAllPermissions() 24 std::vector<APIPermissionInfo*> ExtensionsAPIPermissions::GetAllPermissions()
24 const { 25 const {
25 APIPermissionInfo::InitInfo permissions_to_register[] = { 26 APIPermissionInfo::InitInfo permissions_to_register[] = {
26 {APIPermission::kDns, "dns"}, 27 {APIPermission::kDns, "dns"},
27 // Because warning messages for the "socket" permission vary based 28 // Because warning messages for the "socket" permission vary based
28 // on the permissions parameters, no message ID or message text is 29 // on the permissions parameters, no message ID or message text is
29 // specified here. The message ID and text used will be 30 // specified here. The message ID and text used will be
30 // determined at run-time in the |SocketPermission| class. 31 // determined at run-time in the |SocketPermission| class.
31 {APIPermission::kSocket, "socket", 32 {APIPermission::kSocket, "socket",
32 APIPermissionInfo::kFlagCannotBeOptional, 0, PermissionMessage::kNone, 33 APIPermissionInfo::kFlagCannotBeOptional, 0, PermissionMessage::kNone,
33 &CreateAPIPermission<SocketPermission>}, 34 &CreateAPIPermission<SocketPermission>},
34 {APIPermission::kStorage, "storage"}, 35 {APIPermission::kStorage, "storage"},
35 {APIPermission::kUsb, "usb", APIPermissionInfo::kFlagNone, 36 {APIPermission::kUsb, "usb", APIPermissionInfo::kFlagNone,
36 IDS_EXTENSION_PROMPT_WARNING_USB, PermissionMessage::kUsb}, 37 IDS_EXTENSION_PROMPT_WARNING_USB, PermissionMessage::kUsb},
38 {APIPermission::kUsbDevice, "usbDevices", APIPermissionInfo::kFlagNone, 0,
39 PermissionMessage::kNone, &CreateAPIPermission<UsbDevicePermission>},
37 }; 40 };
38 41
39 std::vector<APIPermissionInfo*> permissions; 42 std::vector<APIPermissionInfo*> permissions;
40 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(permissions_to_register); ++i) 43 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(permissions_to_register); ++i)
41 permissions.push_back(new APIPermissionInfo(permissions_to_register[i])); 44 permissions.push_back(new APIPermissionInfo(permissions_to_register[i]));
42 return permissions; 45 return permissions;
43 } 46 }
44 47
45 std::vector<PermissionsProvider::AliasInfo> 48 std::vector<PermissionsProvider::AliasInfo>
46 ExtensionsAPIPermissions::GetAllAliases() const { 49 ExtensionsAPIPermissions::GetAllAliases() const {
47 return std::vector<PermissionsProvider::AliasInfo>(); 50 return std::vector<PermissionsProvider::AliasInfo>();
48 } 51 }
49 52
50 } // namespace extensions 53 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/permissions/chrome_api_permissions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698