OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SIMPLE_FEATURE_H_ | 5 #ifndef EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_ |
6 #define EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_ | 6 #define EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 min_manifest_version_ = min_manifest_version; | 48 min_manifest_version_ = min_manifest_version; |
49 } | 49 } |
50 int max_manifest_version() const { return max_manifest_version_; } | 50 int max_manifest_version() const { return max_manifest_version_; } |
51 void set_max_manifest_version(int max_manifest_version) { | 51 void set_max_manifest_version(int max_manifest_version) { |
52 max_manifest_version_ = max_manifest_version; | 52 max_manifest_version_ = max_manifest_version; |
53 } | 53 } |
54 | 54 |
55 std::set<std::string>* blacklist() { return &blacklist_; } | 55 std::set<std::string>* blacklist() { return &blacklist_; } |
56 std::set<std::string>* whitelist() { return &whitelist_; } | 56 std::set<std::string>* whitelist() { return &whitelist_; } |
57 std::set<Manifest::Type>* extension_types() { return &extension_types_; } | 57 std::set<Manifest::Type>* extension_types() { return &extension_types_; } |
| 58 std::set<Context>* contexts() { return &contexts_; } |
58 | 59 |
59 // Dependency resolution is a property of Features that is preferrably | 60 // Dependency resolution is a property of Features that is preferrably |
60 // handled internally to avoid temptation, but FeatureFilters may need | 61 // handled internally to avoid temptation, but FeatureFilters may need |
61 // to know if there are any at all. | 62 // to know if there are any at all. |
62 bool HasDependencies(); | 63 bool HasDependencies(); |
63 | 64 |
64 // Adds a filter to this feature. The feature takes ownership of the filter. | 65 // Adds a filter to this feature. The feature takes ownership of the filter. |
65 void AddFilter(scoped_ptr<SimpleFeatureFilter> filter); | 66 void AddFilter(scoped_ptr<SimpleFeatureFilter> filter); |
66 | 67 |
67 // Parses the JSON representation of a feature into the fields of this object. | 68 // Parses the JSON representation of a feature into the fields of this object. |
(...skipping 29 matching lines...) Expand all Loading... |
97 virtual Availability IsAvailableToContext(const Extension* extension, | 98 virtual Availability IsAvailableToContext(const Extension* extension, |
98 Context context, | 99 Context context, |
99 const GURL& url, | 100 const GURL& url, |
100 Platform platform) const OVERRIDE; | 101 Platform platform) const OVERRIDE; |
101 | 102 |
102 virtual std::string GetAvailabilityMessage(AvailabilityResult result, | 103 virtual std::string GetAvailabilityMessage(AvailabilityResult result, |
103 Manifest::Type type, | 104 Manifest::Type type, |
104 const GURL& url, | 105 const GURL& url, |
105 Context context) const OVERRIDE; | 106 Context context) const OVERRIDE; |
106 | 107 |
107 virtual std::set<Context>* GetContexts() OVERRIDE; | |
108 | |
109 virtual bool IsInternal() const OVERRIDE; | 108 virtual bool IsInternal() const OVERRIDE; |
110 virtual bool IsBlockedInServiceWorker() const OVERRIDE; | 109 virtual bool IsBlockedInServiceWorker() const OVERRIDE; |
111 | 110 |
112 virtual bool IsIdInBlacklist(const std::string& extension_id) const OVERRIDE; | 111 virtual bool IsIdInBlacklist(const std::string& extension_id) const OVERRIDE; |
113 virtual bool IsIdInWhitelist(const std::string& extension_id) const OVERRIDE; | 112 virtual bool IsIdInWhitelist(const std::string& extension_id) const OVERRIDE; |
114 static bool IsIdInList(const std::string& extension_id, | 113 static bool IsIdInList(const std::string& extension_id, |
115 const std::set<std::string>& list); | 114 const std::set<std::string>& list); |
116 | 115 |
117 protected: | 116 protected: |
118 Availability CreateAvailability(AvailabilityResult result) const; | 117 Availability CreateAvailability(AvailabilityResult result) const; |
(...skipping 29 matching lines...) Expand all Loading... |
148 | 147 |
149 typedef std::vector<linked_ptr<SimpleFeatureFilter> > FilterList; | 148 typedef std::vector<linked_ptr<SimpleFeatureFilter> > FilterList; |
150 FilterList filters_; | 149 FilterList filters_; |
151 | 150 |
152 DISALLOW_COPY_AND_ASSIGN(SimpleFeature); | 151 DISALLOW_COPY_AND_ASSIGN(SimpleFeature); |
153 }; | 152 }; |
154 | 153 |
155 } // namespace extensions | 154 } // namespace extensions |
156 | 155 |
157 #endif // EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_ | 156 #endif // EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_ |
OLD | NEW |