Remove five deleted header files from .gyp files
[chromium-blink-merge.git] / extensions / common / features / base_feature_provider.h
blobe82c46d5ab819100b58be6150f83b96104f72b04
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_COMMON_FEATURES_BASE_FEATURE_PROVIDER_H_
6 #define EXTENSIONS_COMMON_FEATURES_BASE_FEATURE_PROVIDER_H_
8 #include <map>
9 #include <string>
10 #include <vector>
12 #include "base/memory/linked_ptr.h"
13 #include "base/values.h"
14 #include "extensions/common/features/feature_provider.h"
15 #include "extensions/common/features/simple_feature.h"
17 namespace extensions {
19 // Reads Features out of a simple JSON file description.
20 class BaseFeatureProvider : public FeatureProvider {
21 public:
22 typedef SimpleFeature*(*FeatureFactory)();
24 // Creates a new BaseFeatureProvider. Pass null to |factory| to have the
25 // provider create plain old Feature instances.
26 BaseFeatureProvider(const base::DictionaryValue& root,
27 FeatureFactory factory);
28 ~BaseFeatureProvider() override;
30 // Gets the feature |feature_name|, if it exists.
31 Feature* GetFeature(const std::string& feature_name) const override;
32 Feature* GetParent(Feature* feature) const override;
33 std::vector<Feature*> GetChildren(const Feature& parent) const override;
35 const std::vector<std::string>& GetAllFeatureNames() const override;
37 private:
38 typedef std::map<std::string, linked_ptr<Feature> > FeatureMap;
39 FeatureMap features_;
41 // Populated on first use.
42 mutable std::vector<std::string> feature_names_;
44 FeatureFactory factory_;
47 } // namespace extensions
49 #endif // EXTENSIONS_COMMON_FEATURES_BASE_FEATURE_PROVIDER_H_