| 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 <string> | 9 #include <string> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 |
| 11 namespace extensions { | 14 namespace extensions { |
| 12 | 15 |
| 13 class Feature; | 16 class Feature; |
| 14 | 17 |
| 18 using FeatureMap = std::map<std::string, scoped_ptr<Feature>>; |
| 19 |
| 15 // Implemented by classes that can vend features. | 20 // Implemented by classes that can vend features. |
| 16 class FeatureProvider { | 21 class FeatureProvider { |
| 17 public: | 22 public: |
| 18 FeatureProvider() {} | 23 FeatureProvider() {} |
| 19 virtual ~FeatureProvider() {} | 24 virtual ~FeatureProvider() {} |
| 20 | 25 |
| 21 // | 26 // |
| 22 // Static helpers. | 27 // Static helpers. |
| 23 // | 28 // |
| 24 | 29 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 45 | 50 |
| 46 // Returns the feature with the specified name. | 51 // Returns the feature with the specified name. |
| 47 virtual Feature* GetFeature(const std::string& name) const = 0; | 52 virtual Feature* GetFeature(const std::string& name) const = 0; |
| 48 | 53 |
| 49 // Returns the parent feature of |feature|, or NULL if there isn't one. | 54 // Returns the parent feature of |feature|, or NULL if there isn't one. |
| 50 virtual Feature* GetParent(Feature* feature) const = 0; | 55 virtual Feature* GetParent(Feature* feature) const = 0; |
| 51 | 56 |
| 52 // Returns the features inside the |parent| namespace, recursively. | 57 // Returns the features inside the |parent| namespace, recursively. |
| 53 virtual std::vector<Feature*> GetChildren(const Feature& parent) const = 0; | 58 virtual std::vector<Feature*> GetChildren(const Feature& parent) const = 0; |
| 54 | 59 |
| 55 // Returns all features described by this instance, in asciibetical order. | 60 // Returns a map containing all features described by this instance. |
| 56 virtual const std::vector<std::string>& GetAllFeatureNames() const = 0; | 61 virtual const FeatureMap& GetAllFeatures() const = 0; |
| 57 }; | 62 }; |
| 58 | 63 |
| 59 } // namespace extensions | 64 } // namespace extensions |
| 60 | 65 |
| 61 #endif // EXTENSIONS_COMMON_FEATURES_FEATURE_PROVIDER_H_ | 66 #endif // EXTENSIONS_COMMON_FEATURES_FEATURE_PROVIDER_H_ |
| OLD | NEW |