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

Unified Diff: extensions/common/features/manifest_feature.cc

Issue 2150193002: [Extensions] Add a SimpleFeature::Validate function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Istiaque's Created 4 years, 5 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 | « extensions/common/features/manifest_feature.h ('k') | extensions/common/features/permission_feature.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/features/manifest_feature.cc
diff --git a/extensions/common/features/manifest_feature.cc b/extensions/common/features/manifest_feature.cc
index f169c6a8ac8451a54c7ec378d5db4c19938fbb19..2245dee24e23490587e1767489b3a70e08f72a0b 100644
--- a/extensions/common/features/manifest_feature.cc
+++ b/extensions/common/features/manifest_feature.cc
@@ -34,20 +34,22 @@ Feature::Availability ManifestFeature::IsAvailableToContext(
return CreateAvailability(IS_AVAILABLE);
}
-std::string ManifestFeature::Parse(const base::DictionaryValue* value) {
- std::string error = SimpleFeature::Parse(value);
- if (!error.empty())
- return error;
+bool ManifestFeature::Validate(std::string* error) {
+ if (!SimpleFeature::Validate(error))
+ return false;
if (extension_types()->empty()) {
- return name() + ": Manifest features must specify at least one " +
- "value for extension_types.";
+ *error = name() + ": Manifest features must specify at least one " +
+ "value for extension_types.";
+ return false;
}
- if (value->HasKey("contexts"))
- return name() + ": Manifest features do not support contexts.";
+ if (!contexts()->empty()) {
+ *error = name() + ": Manifest features do not support contexts.";
+ return false;
+ }
- return std::string();
+ return true;
}
} // namespace extensions
« no previous file with comments | « extensions/common/features/manifest_feature.h ('k') | extensions/common/features/permission_feature.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698