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

Unified Diff: chrome/common/extensions/simple_feature_provider.h

Issue 9950046: Implement FeatureProvider for ExtensionAPI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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
Index: chrome/common/extensions/simple_feature_provider.h
diff --git a/chrome/common/extensions/simple_feature_provider.h b/chrome/common/extensions/simple_feature_provider.h
index 2ba5e5283bfcc7d34708551c299e51679f92f2b5..24d24fb0fdf7ee71b1cdcb287de1cedae71d7cf2 100644
--- a/chrome/common/extensions/simple_feature_provider.h
+++ b/chrome/common/extensions/simple_feature_provider.h
@@ -12,15 +12,19 @@
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "chrome/common/extensions/feature.h"
+#include "chrome/common/extensions/feature_provider.h"
namespace extensions {
// Reads Features out of a simple JSON file description.
-class SimpleFeatureProvider {
+class SimpleFeatureProvider : public FeatureProvider {
public:
- // Create an instance for an arbitrary hunk of JSON. This is typically used
- // during tests.
- explicit SimpleFeatureProvider(scoped_ptr<DictionaryValue> root);
+ typedef Feature*(*FeatureFactory)();
+
+ // Creates a new SimpleFeatureProvider. Pass null to |factory| to have the
+ // provider create plain old Factory instances.
koz (OOO until 15th September) 2012/04/02 06:39:48 plain old Factory instances -> plain old Feature i
+ SimpleFeatureProvider(scoped_ptr<DictionaryValue> root,
+ FeatureFactory factory);
~SimpleFeatureProvider();
// Gets an instance for the _manifest_features.json file that is baked into
@@ -35,10 +39,12 @@ class SimpleFeatureProvider {
std::set<std::string> GetAllFeatureNames() const;
// Gets the feature |feature_name|, if it exists.
- scoped_ptr<Feature> GetFeature(const std::string& feature_name) const;
+ virtual scoped_ptr<Feature> GetFeature(
+ const std::string& feature_name) OVERRIDE;
private:
scoped_ptr<DictionaryValue> root_;
+ FeatureFactory factory_;
};
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698