Index: extensions/common/features/base_feature_provider.h |
diff --git a/extensions/common/features/base_feature_provider.h b/extensions/common/features/base_feature_provider.h |
index 503371e05862518348487d5ece77d6be387e157e..59c16699d591324619808db6c8b919164b33ee95 100644 |
--- a/extensions/common/features/base_feature_provider.h |
+++ b/extensions/common/features/base_feature_provider.h |
@@ -10,24 +10,22 @@ |
#include <string> |
#include <vector> |
+#include "base/macros.h" |
#include "extensions/common/features/feature_provider.h" |
-#include "extensions/common/features/simple_feature.h" |
- |
-namespace Base { |
-class DictionaryValue; |
-} |
namespace extensions { |
- |
-// Reads Features out of a simple JSON file description. |
+class Feature; |
+ |
+// A FeatureProvider contains the mapping of all feature names specified in the |
+// _*_features.json files to the Feature classes. Look up a Feature by its name |
+// to determine whether or not it is available in a certain context. |
+// Subclasses implement the specific logic for how the features are populated; |
+// this class handles vending the features given the query. |
+// TODO(devlin): We could probably combine this and FeatureProvider, since both |
+// contain common functionality and neither are designed to be full |
+// implementations. |
class BaseFeatureProvider : public FeatureProvider { |
public: |
- typedef SimpleFeature*(*FeatureFactory)(); |
- |
- // Creates a new BaseFeatureProvider. Pass null to |factory| to have the |
- // provider create plain old Feature instances. |
- BaseFeatureProvider(const base::DictionaryValue& root, |
- FeatureFactory factory); |
~BaseFeatureProvider() override; |
// Gets the feature |feature_name|, if it exists. |
@@ -37,13 +35,12 @@ class BaseFeatureProvider : public FeatureProvider { |
const FeatureMap& GetAllFeatures() const override; |
- private: |
+ protected: |
+ BaseFeatureProvider(); |
std::map<std::string, std::unique_ptr<Feature>> features_; |
- // Populated on first use. |
- mutable std::vector<std::string> feature_names_; |
- |
- FeatureFactory factory_; |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(BaseFeatureProvider); |
}; |
} // namespace extensions |