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

Side by Side Diff: chrome/browser/extensions/api/permissions/permissions_api_helpers.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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_prefs_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/browser/extensions/api/permissions/permissions_api_helpers.h" 5 #include "chrome/browser/extensions/api/permissions/permissions_api_helpers.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/common/extensions/api/permissions.h" 10 #include "chrome/common/extensions/api/permissions.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 const APIPermissionInfo* usb_device_permission_info = 101 const APIPermissionInfo* usb_device_permission_info =
102 info->GetByID(APIPermission::kUsbDevice); 102 info->GetByID(APIPermission::kUsbDevice);
103 if (permission_name == usb_device_permission_info->name()) { 103 if (permission_name == usb_device_permission_info->name()) {
104 permission = new UsbDevicePermission(usb_device_permission_info); 104 permission = new UsbDevicePermission(usb_device_permission_info);
105 } else { 105 } else {
106 *error = kUnsupportedPermissionId; 106 *error = kUnsupportedPermissionId;
107 return NULL; 107 return NULL;
108 } 108 }
109 109
110 CHECK(permission); 110 CHECK(permission);
111 if (!permission->FromValue(permission_json.get(), NULL)) { 111 if (!permission->FromValue(permission_json.get(), NULL, NULL)) {
112 *error = ErrorUtils::FormatErrorMessage(kInvalidParameter, *it); 112 *error = ErrorUtils::FormatErrorMessage(kInvalidParameter, *it);
113 return NULL; 113 return NULL;
114 } 114 }
115 apis.insert(permission); 115 apis.insert(permission);
116 } else { 116 } else {
117 const APIPermissionInfo* permission_info = info->GetByName(*it); 117 const APIPermissionInfo* permission_info = info->GetByName(*it);
118 if (!permission_info) { 118 if (!permission_info) {
119 *error = ErrorUtils::FormatErrorMessage( 119 *error = ErrorUtils::FormatErrorMessage(
120 kUnknownPermissionError, *it); 120 kUnknownPermissionError, *it);
121 return NULL; 121 return NULL;
(...skipping 26 matching lines...) Expand all
148 origins.AddPattern(origin); 148 origins.AddPattern(origin);
149 } 149 }
150 } 150 }
151 151
152 return scoped_refptr<PermissionSet>( 152 return scoped_refptr<PermissionSet>(
153 new PermissionSet(apis, manifest_permissions, origins, URLPatternSet())); 153 new PermissionSet(apis, manifest_permissions, origins, URLPatternSet()));
154 } 154 }
155 155
156 } // namespace permissions_api_helpers 156 } // namespace permissions_api_helpers
157 } // namespace extensions 157 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_prefs_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698