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

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

Issue 11585003: Make Manifest/Permission Features Compose with Feature Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « chrome/common/extensions/features/simple_feature_provider.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4c76dea9a1a2fddd2ced1ca7749384aa9aa47cfa..b6aeba04d8f1c0b483873bd5578f2ace038970d2 100644
--- a/chrome/common/extensions/features/simple_feature_provider.cc
+++ b/chrome/common/extensions/features/simple_feature_provider.cc
@@ -17,8 +17,8 @@ namespace extensions {
namespace {
template<class FeatureClass>
-SimpleFeature* CreateFeature() {
- return new FeatureClass();
+Feature* CreateFeature(Feature* feature) {
+ return new FeatureClass(feature);
}
struct Static {
@@ -86,16 +86,17 @@ base::LazyInstance<Static> g_static = LAZY_INSTANCE_INITIALIZER;
SimpleFeatureProvider::SimpleFeatureProvider(const DictionaryValue& root,
FeatureFactory factory)
: factory_(factory ? factory :
- static_cast<FeatureFactory>(&CreateFeature<SimpleFeature>)) {
+ static_cast<FeatureFactory>(&CreateFeature<ManifestFeature>)) {
for (DictionaryValue::Iterator iter(root); iter.HasNext(); iter.Advance()) {
if (iter.value().GetType() == Value::TYPE_DICTIONARY) {
- linked_ptr<SimpleFeature> feature((*factory_)());
+ scoped_ptr<SimpleFeature> simple_feature(new SimpleFeature());
if (!ParseFeature(static_cast<const DictionaryValue*>(&iter.value()),
iter.key(),
- feature.get()))
+ simple_feature.get()))
continue;
+ linked_ptr<Feature> feature((*factory_)(simple_feature.release()));
features_[iter.key()] = feature;
} else if (iter.value().GetType() == Value::TYPE_LIST) {
// This is a complex feature.
@@ -113,13 +114,13 @@ SimpleFeatureProvider::SimpleFeatureProvider(const DictionaryValue& root,
continue;
}
- scoped_ptr<SimpleFeature> feature((*factory_)());
+ scoped_ptr<SimpleFeature> feature(new SimpleFeature());
if (!ParseFeature(static_cast<const DictionaryValue*>(*list_iter),
iter.key(),
feature.get()))
continue;
- features->push_back(feature.release());
+ features->push_back((*factory_)(feature.release()));
}
linked_ptr<ComplexFeature> feature(new ComplexFeature(features.Pass()));
« no previous file with comments | « chrome/common/extensions/features/simple_feature_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698