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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
160 Feature* feature = manifest_feature_provider->GetFeature(*feature_name); | 160 Feature* feature = manifest_feature_provider->GetFeature(*feature_name); |
161 Feature::Availability result = feature->IsAvailableToManifest( | 161 Feature::Availability result = feature->IsAvailableToManifest( |
162 extension_id_, type_, Feature::ConvertLocation(location_), | 162 extension_id_, type_, location_, GetManifestVersion()); |
163 GetManifestVersion()); | |
164 if (!result.is_available()) | 163 if (!result.is_available()) |
165 warnings->push_back(InstallWarning(result.message(), *feature_name)); | 164 warnings->push_back(InstallWarning(result.message(), *feature_name)); |
166 } | 165 } |
167 | 166 |
168 // Also generate warnings for keys that are not features. | 167 // Also generate warnings for keys that are not features. |
169 for (base::DictionaryValue::Iterator it(*value_); !it.IsAtEnd(); | 168 for (base::DictionaryValue::Iterator it(*value_); !it.IsAtEnd(); |
170 it.Advance()) { | 169 it.Advance()) { |
171 if (!manifest_feature_provider->GetFeature(it.key())) { | 170 if (!manifest_feature_provider->GetFeature(it.key())) { |
172 warnings->push_back(InstallWarning( | 171 warnings->push_back(InstallWarning( |
173 ErrorUtils::FormatErrorMessage( | 172 ErrorUtils::FormatErrorMessage( |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 252 } |
254 return true; | 253 return true; |
255 } | 254 } |
256 | 255 |
257 bool Manifest::CanAccessKey(const std::string& key) const { | 256 bool Manifest::CanAccessKey(const std::string& key) const { |
258 Feature* feature = FeatureProvider::GetManifestFeatures()->GetFeature(key); | 257 Feature* feature = FeatureProvider::GetManifestFeatures()->GetFeature(key); |
259 if (!feature) | 258 if (!feature) |
260 return true; | 259 return true; |
261 | 260 |
262 return feature->IsAvailableToManifest( | 261 return feature->IsAvailableToManifest( |
263 extension_id_, type_, Feature::ConvertLocation(location_), | 262 extension_id_, type_, location_, GetManifestVersion()) |
264 GetManifestVersion()).is_available(); | 263 .is_available(); |
265 } | 264 } |
266 | 265 |
267 } // namespace extensions | 266 } // namespace extensions |
OLD | NEW |