Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: chrome/common/extensions/features/base_feature_provider.h

Issue 109683007: Pass a Feature* to IsAnyFeatureAvailableToContext instead of a string name. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update extension_api_stub.cc Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 CHROME_COMMON_EXTENSIONS_FEATURES_BASE_FEATURE_PROVIDER_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_FEATURES_BASE_FEATURE_PROVIDER_H_
6 #define CHROME_COMMON_EXTENSIONS_FEATURES_BASE_FEATURE_PROVIDER_H_ 6 #define CHROME_COMMON_EXTENSIONS_FEATURES_BASE_FEATURE_PROVIDER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 13 matching lines...) Expand all
24 // Creates a new BaseFeatureProvider. Pass null to |factory| to have the 24 // Creates a new BaseFeatureProvider. Pass null to |factory| to have the
25 // provider create plain old Feature instances. 25 // provider create plain old Feature instances.
26 BaseFeatureProvider(const base::DictionaryValue& root, 26 BaseFeatureProvider(const base::DictionaryValue& root,
27 FeatureFactory factory); 27 FeatureFactory factory);
28 virtual ~BaseFeatureProvider(); 28 virtual ~BaseFeatureProvider();
29 29
30 // Gets a feature provider for a specific feature type, like "permission". 30 // Gets a feature provider for a specific feature type, like "permission".
31 static FeatureProvider* GetByName(const std::string& name); 31 static FeatureProvider* GetByName(const std::string& name);
32 32
33 // Gets the feature |feature_name|, if it exists. 33 // Gets the feature |feature_name|, if it exists.
34 virtual Feature* GetFeature(const std::string& feature_name) OVERRIDE; 34 virtual Feature* GetFeature(const std::string& feature_name) const OVERRIDE;
35 virtual Feature* GetParent(Feature* feature) OVERRIDE; 35 virtual Feature* GetParent(Feature* feature) const OVERRIDE;
36 36
37 virtual const std::vector<std::string>& GetAllFeatureNames() OVERRIDE; 37 virtual const std::vector<std::string>& GetAllFeatureNames() const OVERRIDE;
38 38
39 private: 39 private:
40 typedef std::map<std::string, linked_ptr<Feature> > FeatureMap; 40 typedef std::map<std::string, linked_ptr<Feature> > FeatureMap;
41 FeatureMap features_; 41 FeatureMap features_;
42 42
43 std::vector<std::string> feature_names_; 43 // Populated on first use.
44 mutable std::vector<std::string> feature_names_;
44 45
45 FeatureFactory factory_; 46 FeatureFactory factory_;
46 }; 47 };
47 48
48 } // namespace extensions 49 } // namespace extensions
49 50
50 #endif // CHROME_COMMON_EXTENSIONS_FEATURES_BASE_FEATURE_PROVIDER_H_ 51 #endif // CHROME_COMMON_EXTENSIONS_FEATURES_BASE_FEATURE_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/extension_api_unittest.cc ('k') | chrome/common/extensions/features/base_feature_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698