Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6728)

Unified Diff: chrome/common/extensions/extension.cc

Issue 8227021: Merge 104582 - Add support for an optional "requirements" section in extension/app manifests. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/874/src/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension.cc
===================================================================
--- chrome/common/extensions/extension.cc (revision 104911)
+++ chrome/common/extensions/extension.cc (working copy)
@@ -1175,7 +1175,9 @@
*key != keys::kOptionalPermissions &&
*key != keys::kOptionsPage &&
*key != keys::kBackground &&
- *key != keys::kOfflineEnabled) {
+ *key != keys::kOfflineEnabled &&
+ *key != keys::kMinimumChromeVersion &&
+ *key != keys::kRequirements) {
*error = ExtensionErrorUtils::FormatErrorMessage(
errors::kHostedAppsCannotIncludeExtensionFeatures, *key);
return false;
@@ -2299,6 +2301,27 @@
}
}
+ // 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(
+ *it, &requirement_value)) {
+ *error = ExtensionErrorUtils::FormatErrorMessage(
+ errors::kInvalidRequirement, *it);
+ return false;
+ }
+ }
+ }
+
if (HasMultipleUISurfaces()) {
*error = errors::kOneUISurfaceOnly;
return false;
« no previous file with comments | « no previous file | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698