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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_COMMON_FEATURES_FEATURE_PROVIDER_H_
6 #define EXTENSIONS_COMMON_FEATURES_FEATURE_PROVIDER_H_
11 namespace extensions
{
15 // Implemented by classes that can vend features.
16 class FeatureProvider
{
19 virtual ~FeatureProvider() {}
21 // Returns the feature with the specified name.
22 virtual Feature
* GetFeature(const std::string
& name
) const = 0;
24 // Returns the parent feature of |feature|, or NULL if there isn't one.
25 virtual Feature
* GetParent(Feature
* feature
) const = 0;
27 // Returns the features inside the |parent| namespace, recursively.
28 virtual std::vector
<Feature
*> GetChildren(const Feature
& parent
) const = 0;
30 // Returns all features described by this instance, in asciibetical order.
31 virtual const std::vector
<std::string
>& GetAllFeatureNames() const = 0;
33 // Gets a feature provider for a specific feature type, like "permission".
34 static const FeatureProvider
* GetByName(const std::string
& name
);
36 // Directly access the common feature types.
37 static const FeatureProvider
* GetAPIFeatures();
38 static const FeatureProvider
* GetManifestFeatures();
39 static const FeatureProvider
* GetPermissionFeatures();
42 } // namespace extensions
44 #endif // EXTENSIONS_COMMON_FEATURES_FEATURE_PROVIDER_H_