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 #include "extensions/common/permissions/api_permission_set.h" | 5 #include "extensions/common/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" |
(...skipping 24 matching lines...) Expand all Loading... |
35 permission_info->is_internal()) { | 35 permission_info->is_internal()) { |
36 // An internal permission specified in permissions list is an error. | 36 // An internal permission specified in permissions list is an error. |
37 if (error) { | 37 if (error) { |
38 *error = ErrorUtils::FormatErrorMessageUTF16( | 38 *error = ErrorUtils::FormatErrorMessageUTF16( |
39 errors::kPermissionNotAllowedInManifest, permission_str); | 39 errors::kPermissionNotAllowedInManifest, permission_str); |
40 } | 40 } |
41 return false; | 41 return false; |
42 } | 42 } |
43 | 43 |
44 std::string error_details; | 44 std::string error_details; |
45 if (!permission->FromValue(permission_value, &error_details)) { | 45 if (!permission->FromValue(permission_value, &error_details, |
| 46 unhandled_permissions)) { |
46 if (error) { | 47 if (error) { |
47 if (error_details.empty()) { | 48 if (error_details.empty()) { |
48 *error = ErrorUtils::FormatErrorMessageUTF16( | 49 *error = ErrorUtils::FormatErrorMessageUTF16( |
49 errors::kInvalidPermission, | 50 errors::kInvalidPermission, |
50 permission_info->name()); | 51 permission_info->name()); |
51 } else { | 52 } else { |
52 *error = ErrorUtils::FormatErrorMessageUTF16( | 53 *error = ErrorUtils::FormatErrorMessageUTF16( |
53 errors::kInvalidPermissionWithDetail, | 54 errors::kInvalidPermissionWithDetail, |
54 permission_info->name(), | 55 permission_info->name(), |
55 error_details); | 56 error_details); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // The fileSystem.write and fileSystem.directory permissions imply | 177 // The fileSystem.write and fileSystem.directory permissions imply |
177 // fileSystem.writeDirectory. | 178 // fileSystem.writeDirectory. |
178 // TODO(sammc): Remove this. See http://crbug.com/284849. | 179 // TODO(sammc): Remove this. See http://crbug.com/284849. |
179 if (ContainsKey(map(), APIPermission::kFileSystemWrite) && | 180 if (ContainsKey(map(), APIPermission::kFileSystemWrite) && |
180 ContainsKey(map(), APIPermission::kFileSystemDirectory)) { | 181 ContainsKey(map(), APIPermission::kFileSystemDirectory)) { |
181 insert(APIPermission::kFileSystemWriteDirectory); | 182 insert(APIPermission::kFileSystemWriteDirectory); |
182 } | 183 } |
183 } | 184 } |
184 | 185 |
185 } // namespace extensions | 186 } // namespace extensions |
OLD | NEW |