| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/manifest_handlers/permissions_parser.h" | 5 #include "extensions/common/manifest_handlers/permissions_parser.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 api_permissions, | 105 api_permissions, |
| 106 error, | 106 error, |
| 107 &host_data)) { | 107 &host_data)) { |
| 108 return false; | 108 return false; |
| 109 } | 109 } |
| 110 | 110 |
| 111 // Verify feature availability of permissions. | 111 // Verify feature availability of permissions. |
| 112 std::vector<APIPermission::ID> to_remove; | 112 std::vector<APIPermission::ID> to_remove; |
| 113 const FeatureProvider* permission_features = | 113 const FeatureProvider* permission_features = |
| 114 FeatureProvider::GetPermissionFeatures(); | 114 FeatureProvider::GetPermissionFeatures(); |
| 115 |
| 115 for (APIPermissionSet::const_iterator iter = api_permissions->begin(); | 116 for (APIPermissionSet::const_iterator iter = api_permissions->begin(); |
| 116 iter != api_permissions->end(); | 117 iter != api_permissions->end(); |
| 117 ++iter) { | 118 ++iter) { |
| 118 Feature* feature = permission_features->GetFeature(iter->name()); | 119 Feature* feature = permission_features->GetFeature(iter->name()); |
| 119 | 120 |
| 120 // The feature should exist since we just got an APIPermission for it. The | 121 // The feature should exist since we just got an APIPermission for it. The |
| 121 // two systems should be updated together whenever a permission is added. | 122 // two systems should be updated together whenever a permission is added. |
| 122 DCHECK(feature) << "Could not find feature for " << iter->name(); | 123 DCHECK(feature) << "Could not find feature for " << iter->name(); |
| 123 // http://crbug.com/176381 | 124 // http://crbug.com/176381 |
| 124 if (!feature) { | 125 if (!feature) { |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 // static | 332 // static |
| 332 scoped_refptr<const PermissionSet> PermissionsParser::GetOptionalPermissions( | 333 scoped_refptr<const PermissionSet> PermissionsParser::GetOptionalPermissions( |
| 333 const Extension* extension) { | 334 const Extension* extension) { |
| 334 DCHECK(extension->GetManifestData(keys::kOptionalPermissions)); | 335 DCHECK(extension->GetManifestData(keys::kOptionalPermissions)); |
| 335 return static_cast<const ManifestPermissions*>( | 336 return static_cast<const ManifestPermissions*>( |
| 336 extension->GetManifestData(keys::kOptionalPermissions)) | 337 extension->GetManifestData(keys::kOptionalPermissions)) |
| 337 ->permissions; | 338 ->permissions; |
| 338 } | 339 } |
| 339 | 340 |
| 340 } // namespace extensions | 341 } // namespace extensions |
| OLD | NEW |