| 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 23 matching lines...) Expand all Loading... |
| 34 // nor should it really have any reason to access the SimpleFeature class | 34 // nor should it really have any reason to access the SimpleFeature class |
| 35 // directly, it should be dealing with the Feature interface. | 35 // directly, it should be dealing with the Feature interface. |
| 36 enum Location { | 36 enum Location { |
| 37 UNSPECIFIED_LOCATION, | 37 UNSPECIFIED_LOCATION, |
| 38 COMPONENT_LOCATION, | 38 COMPONENT_LOCATION, |
| 39 POLICY_LOCATION, | 39 POLICY_LOCATION, |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 // Accessors defined for testing. See comment above about not directly using | 42 // Accessors defined for testing. See comment above about not directly using |
| 43 // SimpleFeature in production code. | 43 // SimpleFeature in production code. |
| 44 std::set<std::string>* blacklist() { return &blacklist_; } |
| 45 std::set<std::string>* whitelist() { return &whitelist_; } |
| 46 std::set<Manifest::Type>* extension_types() { return &extension_types_; } |
| 47 std::set<Context>* contexts() { return &contexts_; } |
| 44 Location location() const { return location_; } | 48 Location location() const { return location_; } |
| 45 void set_location(Location location) { location_ = location; } | 49 void set_location(Location location) { location_ = location; } |
| 46 int min_manifest_version() const { return min_manifest_version_; } | 50 int min_manifest_version() const { return min_manifest_version_; } |
| 47 void set_min_manifest_version(int min_manifest_version) { | 51 void set_min_manifest_version(int min_manifest_version) { |
| 48 min_manifest_version_ = min_manifest_version; | 52 min_manifest_version_ = min_manifest_version; |
| 49 } | 53 } |
| 50 int max_manifest_version() const { return max_manifest_version_; } | 54 int max_manifest_version() const { return max_manifest_version_; } |
| 51 void set_max_manifest_version(int max_manifest_version) { | 55 void set_max_manifest_version(int max_manifest_version) { |
| 52 max_manifest_version_ = max_manifest_version; | 56 max_manifest_version_ = max_manifest_version; |
| 53 } | 57 } |
| 54 | 58 const std::string& command_line_switch() const { |
| 55 std::set<std::string>* blacklist() { return &blacklist_; } | 59 return command_line_switch_; |
| 56 std::set<std::string>* whitelist() { return &whitelist_; } | 60 } |
| 57 std::set<Manifest::Type>* extension_types() { return &extension_types_; } | 61 void set_command_line_switch(const std::string& command_line_switch) { |
| 58 std::set<Context>* contexts() { return &contexts_; } | 62 command_line_switch_ = command_line_switch; |
| 63 } |
| 59 | 64 |
| 60 // Dependency resolution is a property of Features that is preferrably | 65 // Dependency resolution is a property of Features that is preferrably |
| 61 // handled internally to avoid temptation, but FeatureFilters may need | 66 // handled internally to avoid temptation, but FeatureFilters may need |
| 62 // to know if there are any at all. | 67 // to know if there are any at all. |
| 63 bool HasDependencies(); | 68 bool HasDependencies(); |
| 64 | 69 |
| 65 // Adds a filter to this feature. The feature takes ownership of the filter. | 70 // Adds a filter to this feature. The feature takes ownership of the filter. |
| 66 void AddFilter(scoped_ptr<SimpleFeatureFilter> filter); | 71 void AddFilter(scoped_ptr<SimpleFeatureFilter> filter); |
| 67 | 72 |
| 68 // Parses the JSON representation of a feature into the fields of this object. | 73 // Parses the JSON representation of a feature into the fields of this object. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 std::set<std::string> blacklist_; | 139 std::set<std::string> blacklist_; |
| 135 std::set<std::string> whitelist_; | 140 std::set<std::string> whitelist_; |
| 136 std::set<std::string> dependencies_; | 141 std::set<std::string> dependencies_; |
| 137 std::set<Manifest::Type> extension_types_; | 142 std::set<Manifest::Type> extension_types_; |
| 138 std::set<Context> contexts_; | 143 std::set<Context> contexts_; |
| 139 URLPatternSet matches_; | 144 URLPatternSet matches_; |
| 140 Location location_; | 145 Location location_; |
| 141 std::set<Platform> platforms_; | 146 std::set<Platform> platforms_; |
| 142 int min_manifest_version_; | 147 int min_manifest_version_; |
| 143 int max_manifest_version_; | 148 int max_manifest_version_; |
| 144 bool has_parent_; | |
| 145 bool component_extensions_auto_granted_; | 149 bool component_extensions_auto_granted_; |
| 150 std::string command_line_switch_; |
| 146 | 151 |
| 147 typedef std::vector<linked_ptr<SimpleFeatureFilter> > FilterList; | 152 typedef std::vector<linked_ptr<SimpleFeatureFilter> > FilterList; |
| 148 FilterList filters_; | 153 FilterList filters_; |
| 149 | 154 |
| 150 DISALLOW_COPY_AND_ASSIGN(SimpleFeature); | 155 DISALLOW_COPY_AND_ASSIGN(SimpleFeature); |
| 151 }; | 156 }; |
| 152 | 157 |
| 153 } // namespace extensions | 158 } // namespace extensions |
| 154 | 159 |
| 155 #endif // EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_ | 160 #endif // EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_ |
| OLD | NEW |