Chromium Code Reviews| Index: chrome/common/extensions/extension.cc |
| diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc |
| index 68a29e6d8d51119704b105c9d1044a8707f9f7e3..35776f59a4c75576c9291c2a8a1c6fb7505a085a 100644 |
| --- a/chrome/common/extensions/extension.cc |
| +++ b/chrome/common/extensions/extension.cc |
| @@ -1246,7 +1246,8 @@ bool Extension::EnsureNotHybridApp(const DictionaryValue* manifest, |
| *key != keys::kOptionsPage && |
| *key != keys::kBackground && |
| *key != keys::kOfflineEnabled && |
| - *key != keys::kMinimumChromeVersion) { |
| + *key != keys::kMinimumChromeVersion && |
| + *key != keys::kRequirements) { |
| *error = ExtensionErrorUtils::FormatErrorMessage( |
| errors::kHostedAppsCannotIncludeExtensionFeatures, *key); |
| return false; |
| @@ -2375,6 +2376,27 @@ bool Extension::InitFromValue(const DictionaryValue& source, int flags, |
| } |
| } |
| + // Initialize requirements (optional). Not actually persisted (they're only |
| + // used by the store), but still validated. |
| + if (source.HasKey(keys::kRequirements)) { |
| + DictionaryValue* requirements_value = NULL; |
| + if (!source.GetDictionary(keys::kRequirements, &requirements_value)) { |
| + *error = errors::kInvalidRequirements; |
| + return false; |
| + } |
| + |
| + for (DictionaryValue::key_iterator it = requirements_value->begin_keys(); |
| + it != requirements_value->end_keys(); ++it) { |
| + DictionaryValue* requirement_value; |
| + if (!requirements_value->GetDictionaryWithoutPathExpansion( |
|
Yoyo Zhou
2011/10/07 21:05:33
Any particular reason to use the WithoutPathExpans
Mihai Parparita -not on Chrome
2011/10/07 21:15:32
The iterator docs say that should be used (http://
Yoyo Zhou
2011/10/07 21:19:11
Ok, I didn't realize we would have such keys (from
|
| + *it, &requirement_value)) { |
| + *error = ExtensionErrorUtils::FormatErrorMessage( |
| + errors::kInvalidRequirement, *it); |
| + return false; |
| + } |
| + } |
| + } |
| + |
| if (HasMultipleUISurfaces()) { |
| *error = errors::kOneUISurfaceOnly; |
| return false; |