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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 GetManifestVersion()); | 153 GetManifestVersion()); |
154 if (!result.is_available()) | 154 if (!result.is_available()) |
155 warnings->push_back(InstallWarning(result.message(), *feature_name)); | 155 warnings->push_back(InstallWarning(result.message(), *feature_name)); |
156 } | 156 } |
157 | 157 |
158 // Also generate warnings for keys that are not features. | 158 // Also generate warnings for keys that are not features. |
159 for (base::DictionaryValue::Iterator it(*value_); !it.IsAtEnd(); | 159 for (base::DictionaryValue::Iterator it(*value_); !it.IsAtEnd(); |
160 it.Advance()) { | 160 it.Advance()) { |
161 if (!provider->GetFeature(it.key())) { | 161 if (!provider->GetFeature(it.key())) { |
162 warnings->push_back(InstallWarning( | 162 warnings->push_back(InstallWarning( |
163 base::StringPrintf("Unrecognized manifest key '%s'.", | 163 ErrorUtils::FormatErrorMessage( |
164 it.key().c_str()), | 164 manifest_errors::kUnrecognizedManifestKey, it.key()), |
165 it.key())); | 165 it.key())); |
166 } | 166 } |
167 } | 167 } |
168 return true; | 168 return true; |
169 } | 169 } |
170 | 170 |
171 bool Manifest::HasKey(const std::string& key) const { | 171 bool Manifest::HasKey(const std::string& key) const { |
172 return CanAccessKey(key) && value_->HasKey(key); | 172 return CanAccessKey(key) && value_->HasKey(key); |
173 } | 173 } |
174 | 174 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 Feature* feature = FeatureProvider::GetByName("manifest")->GetFeature(key); | 248 Feature* feature = FeatureProvider::GetByName("manifest")->GetFeature(key); |
249 if (!feature) | 249 if (!feature) |
250 return true; | 250 return true; |
251 | 251 |
252 return feature->IsAvailableToManifest( | 252 return feature->IsAvailableToManifest( |
253 extension_id_, type_, Feature::ConvertLocation(location_), | 253 extension_id_, type_, Feature::ConvertLocation(location_), |
254 GetManifestVersion()).is_available(); | 254 GetManifestVersion()).is_available(); |
255 } | 255 } |
256 | 256 |
257 } // namespace extensions | 257 } // namespace extensions |
OLD | NEW |