Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_COMMON_EXTENSIONS_FEATURES_COMPLEX_FEATURE_PROVIDER_H_ | |
| 6 #define CHROME_COMMON_EXTENSIONS_FEATURES_COMPLEX_FEATURE_PROVIDER_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <set> | |
| 10 #include <string> | |
| 11 | |
| 12 #include "base/memory/linked_ptr.h" | |
| 13 #include "base/values.h" | |
| 14 #include "chrome/common/extensions/features/complex_feature.h" | |
| 15 #include "chrome/common/extensions/features/feature_provider.h" | |
| 16 | |
| 17 namespace extensions { | |
| 18 | |
| 19 // ComplexFeatureProvider is an extension of SimpleFeatureProvider and provides | |
| 20 // support for ComplexFeatures (i.e. specifying multiple rules for | |
| 21 // PermissionFeatures) in addition to supporting the existing functionality from | |
|
not at google - send to devlin
2012/12/12 17:42:41
why only PermissionFeatures?
| |
| 22 // SimpleFeatureProvider. | |
|
not at google - send to devlin
2012/12/12 17:42:41
"is an extension of SimpleFeatureProvider" -> well
| |
| 23 class ComplexFeatureProvider : public FeatureProvider { | |
| 24 public: | |
| 25 explicit ComplexFeatureProvider(DictionaryValue* root); | |
|
not at google - send to devlin
2012/12/12 17:42:41
Does this take ownership? In which case pass scope
justinlin
2012/12/14 12:26:26
Done.
| |
| 26 virtual ~ComplexFeatureProvider(); | |
| 27 | |
| 28 // Gets an instance for the _permission_features.json file that is baked into | |
| 29 // Chrome as a resource. | |
| 30 static ComplexFeatureProvider* GetPermissionFeatures(); | |
|
not at google - send to devlin
2012/12/12 17:42:41
hm I find it a bit confusing that users need to kn
justinlin
2012/12/14 12:26:26
Yea, it gets kind of complicated with a bunch of c
| |
| 31 | |
| 32 // Returns all features described by this instance. | |
| 33 std::set<std::string> GetAllFeatureNames() const; | |
| 34 | |
| 35 // Gets the feature |feature_name|, if it exists. | |
| 36 virtual Feature* GetFeature(const std::string& feature_name) OVERRIDE; | |
| 37 | |
| 38 private: | |
| 39 typedef std::map<std::string, linked_ptr<ComplexFeature> > FeatureMap; | |
| 40 FeatureMap features_; | |
| 41 }; | |
| 42 | |
| 43 } // namespace extensions | |
| 44 | |
| 45 #endif // CHROME_COMMON_EXTENSIONS_FEATURES_COMPLEX_FEATURE_PROVIDER_H_ | |
| OLD | NEW |