diff options
author | kalman <kalman@chromium.org> | 2014-12-18 01:40:38 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-18 09:41:05 +0000 |
commit | 38ec48860b67cc8574a0b69cedbd8a0b89acd990 (patch) | |
tree | d009af4ddf2709a4d6506c9d008c7581e34b0e1e /extensions/common/features/feature_provider.h | |
parent | 1c2a4917f604903f092bb00afefbd0d5223bd2a8 (diff) | |
download | chromium_src-38ec48860b67cc8574a0b69cedbd8a0b89acd990.zip chromium_src-38ec48860b67cc8574a0b69cedbd8a0b89acd990.tar.gz chromium_src-38ec48860b67cc8574a0b69cedbd8a0b89acd990.tar.bz2 |
Add FeatureProvider::GetAPIFeature, FeatureProvider::GetBehaviorFeature, etc as
(further) syntactic sugar to fetching a specific Feature.
R=yoz@chromium.org, benwells@chromium.org
Review URL: https://codereview.chromium.org/806333003
Cr-Commit-Position: refs/heads/master@{#308977}
Diffstat (limited to 'extensions/common/features/feature_provider.h')
-rw-r--r-- | extensions/common/features/feature_provider.h | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/extensions/common/features/feature_provider.h b/extensions/common/features/feature_provider.h index a45326f..40d8ab8 100644 --- a/extensions/common/features/feature_provider.h +++ b/extensions/common/features/feature_provider.h @@ -18,6 +18,31 @@ class FeatureProvider { FeatureProvider() {} virtual ~FeatureProvider() {} + // + // Static helpers. + // + + // Gets a FeatureProvider for a specific type, like "permission". + static const FeatureProvider* GetByName(const std::string& name); + + // Directly access the common FeatureProvider types. + // Each is equivalent to GetByName('featuretype'). + static const FeatureProvider* GetAPIFeatures(); + static const FeatureProvider* GetManifestFeatures(); + static const FeatureProvider* GetPermissionFeatures(); + static const FeatureProvider* GetBehaviorFeatures(); + + // Directly get Features from the common FeatureProvider types. + // Each is equivalent to GetByName('featuretype')->GetFeature(name). + static const Feature* GetAPIFeature(const std::string& name); + static const Feature* GetManifestFeature(const std::string& name); + static const Feature* GetPermissionFeature(const std::string& name); + static const Feature* GetBehaviorFeature(const std::string& name); + + // + // Instance methods. + // + // Returns the feature with the specified name. virtual Feature* GetFeature(const std::string& name) const = 0; @@ -29,15 +54,6 @@ class FeatureProvider { // Returns all features described by this instance, in asciibetical order. virtual const std::vector<std::string>& GetAllFeatureNames() const = 0; - - // Gets a feature provider for a specific feature type, like "permission". - static const FeatureProvider* GetByName(const std::string& name); - - // Directly access the common feature types. - static const FeatureProvider* GetAPIFeatures(); - static const FeatureProvider* GetManifestFeatures(); - static const FeatureProvider* GetPermissionFeatures(); - static const FeatureProvider* GetBehaviorFeatures(); }; } // namespace extensions |