OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/common/extensions/permissions/permissions_data.h" | 5 #include "chrome/common/extensions/permissions/permissions_data.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // associated with them are available because the feature system does not | 123 // associated with them are available because the feature system does not |
124 // know about aliases. | 124 // know about aliases. |
125 | 125 |
126 std::vector<std::string> host_data; | 126 std::vector<std::string> host_data; |
127 if (!APIPermissionSet::ParseFromJSON( | 127 if (!APIPermissionSet::ParseFromJSON( |
128 permissions, APIPermissionSet::kDisallowInternalPermissions, | 128 permissions, APIPermissionSet::kDisallowInternalPermissions, |
129 api_permissions, error, &host_data)) { | 129 api_permissions, error, &host_data)) { |
130 return false; | 130 return false; |
131 } | 131 } |
132 | 132 |
| 133 api_permissions->AddImpliedPermissions(); |
| 134 |
133 // Verify feature availability of permissions. | 135 // Verify feature availability of permissions. |
134 std::vector<APIPermission::ID> to_remove; | 136 std::vector<APIPermission::ID> to_remove; |
135 FeatureProvider* permission_features = | 137 FeatureProvider* permission_features = |
136 BaseFeatureProvider::GetByName("permission"); | 138 BaseFeatureProvider::GetByName("permission"); |
137 for (APIPermissionSet::const_iterator iter = api_permissions->begin(); | 139 for (APIPermissionSet::const_iterator iter = api_permissions->begin(); |
138 iter != api_permissions->end(); ++iter) { | 140 iter != api_permissions->end(); ++iter) { |
139 Feature* feature = permission_features->GetFeature(iter->name()); | 141 Feature* feature = permission_features->GetFeature(iter->name()); |
140 | 142 |
141 // The feature should exist since we just got an APIPermission for it. The | 143 // The feature should exist since we just got an APIPermission for it. The |
142 // two systems should be updated together whenever a permission is added. | 144 // two systems should be updated together whenever a permission is added. |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 optional_permission_set_ = new PermissionSet( | 637 optional_permission_set_ = new PermissionSet( |
636 initial_optional_permissions_->api_permissions, | 638 initial_optional_permissions_->api_permissions, |
637 initial_optional_permissions_->host_permissions, | 639 initial_optional_permissions_->host_permissions, |
638 URLPatternSet()); | 640 URLPatternSet()); |
639 | 641 |
640 initial_required_permissions_.reset(); | 642 initial_required_permissions_.reset(); |
641 initial_optional_permissions_.reset(); | 643 initial_optional_permissions_.reset(); |
642 } | 644 } |
643 | 645 |
644 } // namespace extensions | 646 } // namespace extensions |
OLD | NEW |