| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_COMMON_EXTENSIONS_FEATURES_SIMPLE_FEATURE_PROVIDER_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_FEATURES_SIMPLE_FEATURE_PROVIDER_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_FEATURES_SIMPLE_FEATURE_PROVIDER_H_ | 6 #define CHROME_COMMON_EXTENSIONS_FEATURES_SIMPLE_FEATURE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/common/extensions/features/feature_provider.h" | 14 #include "chrome/common/extensions/features/feature_provider.h" |
| 15 #include "chrome/common/extensions/features/simple_feature.h" | 15 #include "chrome/common/extensions/features/simple_feature.h" |
| 16 | 16 |
| 17 namespace extensions { | 17 namespace extensions { |
| 18 | 18 |
| 19 // Reads Features out of a simple JSON file description. | 19 // Reads Features out of a simple JSON file description. |
| 20 class SimpleFeatureProvider : public FeatureProvider { | 20 class SimpleFeatureProvider : public FeatureProvider { |
| 21 public: | 21 public: |
| 22 typedef SimpleFeature*(*FeatureFactory)(); | 22 typedef Feature*(*FeatureFactory)(Feature* feature); |
| 23 | 23 |
| 24 // Creates a new SimpleFeatureProvider. Pass null to |factory| to have the | 24 // Creates a new SimpleFeatureProvider. Pass null to |factory| to have the |
| 25 // provider create plain old Feature instances. | 25 // provider create plain old Feature instances. |
| 26 SimpleFeatureProvider(const DictionaryValue& root, FeatureFactory factory); | 26 SimpleFeatureProvider(const DictionaryValue& root, FeatureFactory factory); |
| 27 virtual ~SimpleFeatureProvider(); | 27 virtual ~SimpleFeatureProvider(); |
| 28 | 28 |
| 29 // Gets an instance for the _manifest_features.json file that is baked into | 29 // Gets an instance for the _manifest_features.json file that is baked into |
| 30 // Chrome as a resource. | 30 // Chrome as a resource. |
| 31 static SimpleFeatureProvider* GetManifestFeatures(); | 31 static SimpleFeatureProvider* GetManifestFeatures(); |
| 32 | 32 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 43 private: | 43 private: |
| 44 typedef std::map<std::string, linked_ptr<Feature> > FeatureMap; | 44 typedef std::map<std::string, linked_ptr<Feature> > FeatureMap; |
| 45 FeatureMap features_; | 45 FeatureMap features_; |
| 46 | 46 |
| 47 FeatureFactory factory_; | 47 FeatureFactory factory_; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 } // namespace extensions | 50 } // namespace extensions |
| 51 | 51 |
| 52 #endif // CHROME_COMMON_EXTENSIONS_FEATURES_SIMPLE_FEATURE_PROVIDER_H_ | 52 #endif // CHROME_COMMON_EXTENSIONS_FEATURES_SIMPLE_FEATURE_PROVIDER_H_ |
| OLD | NEW |