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

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

Issue 221353003: Make unknown extension subpermissions warnings instead of errors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 6 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 | Annotate | Revision Log
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 #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
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
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
OLDNEW
« no previous file with comments | « extensions/common/permissions/api_permission.cc ('k') | extensions/common/permissions/api_permission_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698