Chromium Code Reviews| 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/stringprintf.h" | 10 #include "base/stringprintf.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 std::vector<std::string> feature_names = provider->GetAllFeatureNames(); |
|
not at google - send to devlin
2013/05/24 19:09:18
also const&
cduvall
2013/05/30 00:50:51
Done.
| |
| 146 for (std::set<std::string>::iterator feature_name = feature_names.begin(); | 146 for (std::vector<std::string>::iterator feature_name = feature_names.begin(); |
| 147 feature_name != feature_names.end(); ++feature_name) { | 147 feature_name != feature_names.end(); ++feature_name) { |
| 148 // Use Get instead of HasKey because the former uses path expansion. | 148 // Use Get instead of HasKey because the former uses path expansion. |
| 149 if (!value_->Get(*feature_name, NULL)) | 149 if (!value_->Get(*feature_name, NULL)) |
| 150 continue; | 150 continue; |
| 151 | 151 |
| 152 Feature* feature = provider->GetFeature(*feature_name); | 152 Feature* feature = provider->GetFeature(*feature_name); |
| 153 Feature::Availability result = feature->IsAvailableToManifest( | 153 Feature::Availability result = feature->IsAvailableToManifest( |
| 154 extension_id_, type_, Feature::ConvertLocation(location_), | 154 extension_id_, type_, Feature::ConvertLocation(location_), |
| 155 GetManifestVersion()); | 155 GetManifestVersion()); |
| 156 if (!result.is_available()) | 156 if (!result.is_available()) |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 252 BaseFeatureProvider::GetByName("manifest")->GetFeature(key); | 252 BaseFeatureProvider::GetByName("manifest")->GetFeature(key); |
| 253 if (!feature) | 253 if (!feature) |
| 254 return true; | 254 return true; |
| 255 | 255 |
| 256 return feature->IsAvailableToManifest( | 256 return feature->IsAvailableToManifest( |
| 257 extension_id_, type_, Feature::ConvertLocation(location_), | 257 extension_id_, type_, Feature::ConvertLocation(location_), |
| 258 GetManifestVersion()).is_available(); | 258 GetManifestVersion()).is_available(); |
| 259 } | 259 } |
| 260 | 260 |
| 261 } // namespace extensions | 261 } // namespace extensions |
| OLD | NEW |