| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |