OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "extensions/common/manifest.h" | 5 #include "extensions/common/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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 std::string* error, | 139 std::string* error, |
140 std::vector<InstallWarning>* warnings) const { | 140 std::vector<InstallWarning>* warnings) const { |
141 *error = ""; | 141 *error = ""; |
142 | 142 |
143 // Check every feature to see if its in the manifest. Note that this means | 143 // Check every feature to see if its in the manifest. Note that this means |
144 // we will ignore keys that are not features; we do this for forward | 144 // we will ignore keys that are not features; we do this for forward |
145 // compatibility. | 145 // compatibility. |
146 // TODO(aa): Consider having an error here in the case of strict error | 146 // TODO(aa): Consider having an error here in the case of strict error |
147 // checking to let developers know when they screw up. | 147 // checking to let developers know when they screw up. |
148 | 148 |
149 FeatureProvider* manifest_feature_provider = | 149 const FeatureProvider* manifest_feature_provider = |
150 FeatureProvider::GetManifestFeatures(); | 150 FeatureProvider::GetManifestFeatures(); |
151 const std::vector<std::string>& feature_names = | 151 const std::vector<std::string>& feature_names = |
152 manifest_feature_provider->GetAllFeatureNames(); | 152 manifest_feature_provider->GetAllFeatureNames(); |
153 for (std::vector<std::string>::const_iterator feature_name = | 153 for (std::vector<std::string>::const_iterator feature_name = |
154 feature_names.begin(); | 154 feature_names.begin(); |
155 feature_name != feature_names.end(); ++feature_name) { | 155 feature_name != feature_names.end(); ++feature_name) { |
156 // Use Get instead of HasKey because the former uses path expansion. | 156 // Use Get instead of HasKey because the former uses path expansion. |
157 if (!value_->Get(*feature_name, NULL)) | 157 if (!value_->Get(*feature_name, NULL)) |
158 continue; | 158 continue; |
159 | 159 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 Feature* feature = FeatureProvider::GetManifestFeatures()->GetFeature(key); | 257 Feature* feature = FeatureProvider::GetManifestFeatures()->GetFeature(key); |
258 if (!feature) | 258 if (!feature) |
259 return true; | 259 return true; |
260 | 260 |
261 return feature->IsAvailableToManifest( | 261 return feature->IsAvailableToManifest( |
262 extension_id_, type_, location_, GetManifestVersion()) | 262 extension_id_, type_, location_, GetManifestVersion()) |
263 .is_available(); | 263 .is_available(); |
264 } | 264 } |
265 | 265 |
266 } // namespace extensions | 266 } // namespace extensions |
OLD | NEW |