Chromium Code Reviews| Index: chrome/common/extensions/manifest.cc |
| diff --git a/chrome/common/extensions/manifest.cc b/chrome/common/extensions/manifest.cc |
| index 0c55e6b60a422cdd5172c6d45c6304f75c183db5..f6f4ab41ba0585110175921517043e5e59377f3b 100644 |
| --- a/chrome/common/extensions/manifest.cc |
| +++ b/chrome/common/extensions/manifest.cc |
| @@ -8,6 +8,7 @@ |
| #include "base/lazy_instance.h" |
| #include "base/logging.h" |
| #include "base/string_split.h" |
| +#include "base/stringprintf.h" |
| #include "base/utf_string_conversions.h" |
| #include "chrome/common/extensions/extension_manifest_constants.h" |
| #include "chrome/common/extensions/extension_error_utils.h" |
| @@ -27,12 +28,7 @@ Manifest::~Manifest() { |
| } |
| void Manifest::ValidateManifest(std::vector<std::string>* warnings) const { |
| - // Check every feature to see if its in the manifest. Note that this means |
| - // we will ignore keys that are not features; we do this for forward |
| - // compatibility. |
| - // TODO(aa): Consider having an error here in the case of strict error |
| - // checking to let developers know when they screw up. |
| - |
| + // Check every feature to see if its in the manifest. |
| std::set<std::string> feature_names = |
| SimpleFeatureProvider::GetManifestFeatures()->GetAllFeatureNames(); |
| for (std::set<std::string>::iterator feature_name = feature_names.begin(); |
| @@ -49,6 +45,15 @@ void Manifest::ValidateManifest(std::vector<std::string>* warnings) const { |
| if (result != Feature::IS_AVAILABLE) |
| warnings->push_back(feature->GetErrorMessage(result)); |
| } |
| + |
| + // Also generate warnings for keys that are not features. |
| + for (DictionaryValue::key_iterator key = value_->begin_keys(); |
| + key != value_->end_keys(); ++key) { |
| + if (!SimpleFeatureProvider::GetManifestFeatures()->GetFeature(*key)) { |
| + warnings->push_back(base::StringPrintf("Unrecognized manifest key '%s'.", |
| + (*key).c_str())); |
|
not at google - send to devlin
2012/05/01 04:04:01
key->c_str()
mitchellwrosen
2012/05/01 04:18:47
But key's a key_iterator, not a std::string*
|
| + } |
| + } |
| } |
| bool Manifest::HasKey(const std::string& key) const { |