#ifndef EXTENSIONS_COMMON_FEATURES_BASE_FEATURE_PROVIDER_H_
#define EXTENSIONS_COMMON_FEATURES_BASE_FEATURE_PROVIDER_H_
#include <map>
#include <string>
#include <vector>
#include "base/memory/linked_ptr.h"
#include "base/values.h"
#include "extensions/common/features/feature_provider.h"
#include "extensions/common/features/simple_feature.h"
namespace extensions {
class BaseFeatureProvider : public FeatureProvider {
public:
typedef SimpleFeature*(*FeatureFactory)();
BaseFeatureProvider(const base::DictionaryValue& root,
FeatureFactory factory);
virtual ~BaseFeatureProvider();
static FeatureProvider* GetByName(const std::string& name);
virtual Feature* GetFeature(const std::string& feature_name) const OVERRIDE;
virtual Feature* GetParent(Feature* feature) const OVERRIDE;
virtual std::vector<Feature*> GetChildren(const Feature& parent) const
OVERRIDE;
virtual const std::vector<std::string>& GetAllFeatureNames() const OVERRIDE;
private:
typedef std::map<std::string, linked_ptr<Feature> > FeatureMap;
FeatureMap features_;
mutable std::vector<std::string> feature_names_;
FeatureFactory factory_;
};
}
#endif