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

Unified Diff: chrome/common/extensions/features/simple_feature_provider.cc

Issue 11316164: Implement ComplexFeature to support permission features with multiple rules. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: new Created 8 years 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
Index: chrome/common/extensions/features/simple_feature_provider.cc
diff --git a/chrome/common/extensions/features/simple_feature_provider.cc b/chrome/common/extensions/features/simple_feature_provider.cc
index 4edcfe11c19544ae346e296bf3014334dd142e34..92ff894c83b7b79c1855e0a449382de8a08902da 100644
--- a/chrome/common/extensions/features/simple_feature_provider.cc
+++ b/chrome/common/extensions/features/simple_feature_provider.cc
@@ -16,7 +16,7 @@ namespace extensions {
namespace {
template<class FeatureClass>
-Feature* CreateFeature() {
+SimpleFeature* CreateFeature() {
return new FeatureClass();
}
@@ -65,19 +65,22 @@ base::LazyInstance<Static> g_static = LAZY_INSTANCE_INITIALIZER;
SimpleFeatureProvider::SimpleFeatureProvider(DictionaryValue* root,
FeatureFactory factory)
: factory_(factory ? factory :
- static_cast<FeatureFactory>(&CreateFeature<Feature>)) {
+ static_cast<FeatureFactory>(&CreateFeature<SimpleFeature>)) {
for (DictionaryValue::Iterator iter(*root); iter.HasNext(); iter.Advance()) {
if (iter.value().GetType() != Value::TYPE_DICTIONARY) {
- LOG(ERROR) << iter.key() << ": Feature description must be dictionary.";
+ if (iter.value().GetType() != Value::TYPE_LIST)
+ LOG(ERROR) << iter.key() << ": Feature description must be dictionary.";
+ else
+ DVLOG(2) << iter.key() << ": Feature is a complex feature.";
not at google - send to devlin 2012/12/12 17:42:41 I would hope this, by design, can never happen and
justinlin 2012/12/14 12:26:26 Updated.
continue;
}
- linked_ptr<Feature> feature((*factory_)());
+ linked_ptr<SimpleFeature> feature((*factory_)());
feature->set_name(iter.key());
feature->Parse(static_cast<const DictionaryValue*>(&iter.value()));
if (feature->extension_types()->empty()) {
- LOG(ERROR) << iter.key() << ": Simple features must specify atleast one "
+ LOG(ERROR) << iter.key() << ": Simple features must specify at least one "
<< "value for extension_types.";
continue;
}
@@ -113,7 +116,7 @@ std::set<std::string> SimpleFeatureProvider::GetAllFeatureNames() const {
return result;
}
-Feature* SimpleFeatureProvider::GetFeature(const std::string& name) {
+SimpleFeature* SimpleFeatureProvider::GetFeature(const std::string& name) {
FeatureMap::iterator iter = features_.find(name);
if (iter != features_.end())
return iter->second.get();

Powered by Google App Engine
This is Rietveld 408576698