OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/common/extensions/permissions/api_permission_set.h" | 5 #include "chrome/common/extensions/permissions/api_permission_set.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/common/extensions/extension_manifest_constants.h" | |
12 #include "chrome/common/extensions/permissions/permissions_info.h" | 11 #include "chrome/common/extensions/permissions/permissions_info.h" |
13 #include "extensions/common/error_utils.h" | 12 #include "extensions/common/error_utils.h" |
| 13 #include "extensions/common/manifest_constants.h" |
14 | 14 |
15 namespace errors = extension_manifest_errors; | 15 namespace extensions { |
| 16 |
| 17 namespace errors = manifest_errors; |
16 | 18 |
17 namespace { | 19 namespace { |
18 | 20 |
19 using extensions::APIPermission; | |
20 using extensions::APIPermissionInfo; | |
21 using extensions::APIPermissionSet; | |
22 using extensions::ErrorUtils; | |
23 using extensions::PermissionsInfo; | |
24 | |
25 bool CreateAPIPermission( | 21 bool CreateAPIPermission( |
26 const std::string& permission_str, | 22 const std::string& permission_str, |
27 const base::Value* permission_value, | 23 const base::Value* permission_value, |
28 APIPermissionSet::ParseSource source, | 24 APIPermissionSet::ParseSource source, |
29 APIPermissionSet* api_permissions, | 25 APIPermissionSet* api_permissions, |
30 string16* error, | 26 string16* error, |
31 std::vector<std::string>* unhandled_permissions) { | 27 std::vector<std::string>* unhandled_permissions) { |
32 | 28 |
33 const APIPermissionInfo* permission_info = | 29 const APIPermissionInfo* permission_info = |
34 PermissionsInfo::GetInstance()->GetByName(permission_str); | 30 PermissionsInfo::GetInstance()->GetByName(permission_str); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 return false; | 102 return false; |
107 } | 103 } |
108 } | 104 } |
109 | 105 |
110 return CreateAPIPermission(base_name, NULL, source, | 106 return CreateAPIPermission(base_name, NULL, source, |
111 api_permissions, error, NULL); | 107 api_permissions, error, NULL); |
112 } | 108 } |
113 | 109 |
114 } // namespace | 110 } // namespace |
115 | 111 |
116 namespace extensions { | |
117 | |
118 APIPermissionSet::APIPermissionSet() { | 112 APIPermissionSet::APIPermissionSet() { |
119 } | 113 } |
120 | 114 |
121 APIPermissionSet::APIPermissionSet(const APIPermissionSet& set) { | 115 APIPermissionSet::APIPermissionSet(const APIPermissionSet& set) { |
122 this->operator=(set); | 116 this->operator=(set); |
123 } | 117 } |
124 | 118 |
125 APIPermissionSet::~APIPermissionSet() { | 119 APIPermissionSet::~APIPermissionSet() { |
126 } | 120 } |
127 | 121 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 // The fileSystem.write and fileSystem.directory permissions imply | 334 // The fileSystem.write and fileSystem.directory permissions imply |
341 // fileSystem.writeDirectory. | 335 // fileSystem.writeDirectory. |
342 // TODO(sammc): Remove this. See http://crbug.com/284849. | 336 // TODO(sammc): Remove this. See http://crbug.com/284849. |
343 if (ContainsKey(map_, APIPermission::kFileSystemWrite) && | 337 if (ContainsKey(map_, APIPermission::kFileSystemWrite) && |
344 ContainsKey(map_, APIPermission::kFileSystemDirectory)) { | 338 ContainsKey(map_, APIPermission::kFileSystemDirectory)) { |
345 insert(APIPermission::kFileSystemWriteDirectory); | 339 insert(APIPermission::kFileSystemWriteDirectory); |
346 } | 340 } |
347 } | 341 } |
348 | 342 |
349 } // namespace extensions | 343 } // namespace extensions |
OLD | NEW |