| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_COMMON_FEATURES_FEATURE_PROVIDER_H_ | 5 #ifndef EXTENSIONS_COMMON_FEATURES_FEATURE_PROVIDER_H_ |
| 6 #define EXTENSIONS_COMMON_FEATURES_FEATURE_PROVIDER_H_ | 6 #define EXTENSIONS_COMMON_FEATURES_FEATURE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
| 9 #include <string> | 10 #include <string> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 | 13 |
| 14 namespace extensions { | 14 namespace extensions { |
| 15 | 15 |
| 16 class Feature; | 16 class Feature; |
| 17 | 17 |
| 18 using FeatureMap = std::map<std::string, scoped_ptr<Feature>>; | 18 using FeatureMap = std::map<std::string, std::unique_ptr<Feature>>; |
| 19 | 19 |
| 20 // Implemented by classes that can vend features. | 20 // Implemented by classes that can vend features. |
| 21 class FeatureProvider { | 21 class FeatureProvider { |
| 22 public: | 22 public: |
| 23 FeatureProvider() {} | 23 FeatureProvider() {} |
| 24 virtual ~FeatureProvider() {} | 24 virtual ~FeatureProvider() {} |
| 25 | 25 |
| 26 // | 26 // |
| 27 // Static helpers. | 27 // Static helpers. |
| 28 // | 28 // |
| (...skipping 30 matching lines...) Expand all Loading... |
| 59 // Returns the features inside the |parent| namespace, recursively. | 59 // Returns the features inside the |parent| namespace, recursively. |
| 60 virtual std::vector<Feature*> GetChildren(const Feature& parent) const = 0; | 60 virtual std::vector<Feature*> GetChildren(const Feature& parent) const = 0; |
| 61 | 61 |
| 62 // Returns a map containing all features described by this instance. | 62 // Returns a map containing all features described by this instance. |
| 63 virtual const FeatureMap& GetAllFeatures() const = 0; | 63 virtual const FeatureMap& GetAllFeatures() const = 0; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 } // namespace extensions | 66 } // namespace extensions |
| 67 | 67 |
| 68 #endif // EXTENSIONS_COMMON_FEATURES_FEATURE_PROVIDER_H_ | 68 #endif // EXTENSIONS_COMMON_FEATURES_FEATURE_PROVIDER_H_ |
| OLD | NEW |