| 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/common/extensions/manifest.h" | 5 #include "chrome/common/extensions/manifest.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 return false; | 135 return false; |
| 136 } | 136 } |
| 137 | 137 |
| 138 // Check every feature to see if its in the manifest. Note that this means | 138 // Check every feature to see if its in the manifest. Note that this means |
| 139 // we will ignore keys that are not features; we do this for forward | 139 // we will ignore keys that are not features; we do this for forward |
| 140 // compatibility. | 140 // compatibility. |
| 141 // TODO(aa): Consider having an error here in the case of strict error | 141 // TODO(aa): Consider having an error here in the case of strict error |
| 142 // checking to let developers know when they screw up. | 142 // checking to let developers know when they screw up. |
| 143 | 143 |
| 144 FeatureProvider* provider = BaseFeatureProvider::GetByName("manifest"); | 144 FeatureProvider* provider = BaseFeatureProvider::GetByName("manifest"); |
| 145 std::set<std::string> feature_names = provider->GetAllFeatureNames(); | 145 const std::vector<std::string>& feature_names = |
| 146 for (std::set<std::string>::iterator feature_name = feature_names.begin(); | 146 provider->GetAllFeatureNames(); |
| 147 for (std::vector<std::string>::const_iterator feature_name = |
| 148 feature_names.begin(); |
| 147 feature_name != feature_names.end(); ++feature_name) { | 149 feature_name != feature_names.end(); ++feature_name) { |
| 148 // Use Get instead of HasKey because the former uses path expansion. | 150 // Use Get instead of HasKey because the former uses path expansion. |
| 149 if (!value_->Get(*feature_name, NULL)) | 151 if (!value_->Get(*feature_name, NULL)) |
| 150 continue; | 152 continue; |
| 151 | 153 |
| 152 Feature* feature = provider->GetFeature(*feature_name); | 154 Feature* feature = provider->GetFeature(*feature_name); |
| 153 Feature::Availability result = feature->IsAvailableToManifest( | 155 Feature::Availability result = feature->IsAvailableToManifest( |
| 154 extension_id_, type_, Feature::ConvertLocation(location_), | 156 extension_id_, type_, Feature::ConvertLocation(location_), |
| 155 GetManifestVersion()); | 157 GetManifestVersion()); |
| 156 if (!result.is_available()) | 158 if (!result.is_available()) |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 BaseFeatureProvider::GetByName("manifest")->GetFeature(key); | 254 BaseFeatureProvider::GetByName("manifest")->GetFeature(key); |
| 253 if (!feature) | 255 if (!feature) |
| 254 return true; | 256 return true; |
| 255 | 257 |
| 256 return feature->IsAvailableToManifest( | 258 return feature->IsAvailableToManifest( |
| 257 extension_id_, type_, Feature::ConvertLocation(location_), | 259 extension_id_, type_, Feature::ConvertLocation(location_), |
| 258 GetManifestVersion()).is_available(); | 260 GetManifestVersion()).is_available(); |
| 259 } | 261 } |
| 260 | 262 |
| 261 } // namespace extensions | 263 } // namespace extensions |
| OLD | NEW |