| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <initializer_list> | 10 #include <initializer_list> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 std::string* previous_id_; | 42 std::string* previous_id_; |
| 43 | 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(ScopedWhitelistForTest); | 44 DISALLOW_COPY_AND_ASSIGN(ScopedWhitelistForTest); |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 SimpleFeature(); | 47 SimpleFeature(); |
| 48 ~SimpleFeature() override; | 48 ~SimpleFeature() override; |
| 49 | 49 |
| 50 // Parses the JSON representation of a feature into the fields of this object. | |
| 51 // Note: Validate() should be called after this. | |
| 52 void Parse(const base::DictionaryValue* dictionary); | |
| 53 | |
| 54 // Checks whether the feature is valid. Invalid features should not be used. | |
| 55 // Subclasses can override to implement specific checking, but should always | |
| 56 // call this method as well. | |
| 57 virtual bool Validate(std::string* error); | |
| 58 | |
| 59 Availability IsAvailableToContext(const Extension* extension, | 50 Availability IsAvailableToContext(const Extension* extension, |
| 60 Context context) const { | 51 Context context) const { |
| 61 return IsAvailableToContext(extension, context, GURL()); | 52 return IsAvailableToContext(extension, context, GURL()); |
| 62 } | 53 } |
| 63 Availability IsAvailableToContext(const Extension* extension, | 54 Availability IsAvailableToContext(const Extension* extension, |
| 64 Context context, | 55 Context context, |
| 65 Platform platform) const { | 56 Platform platform) const { |
| 66 return IsAvailableToContext(extension, context, GURL(), platform); | 57 return IsAvailableToContext(extension, context, GURL(), platform); |
| 67 } | 58 } |
| 68 Availability IsAvailableToContext(const Extension* extension, | 59 Availability IsAvailableToContext(const Extension* extension, |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 bool is_internal_; | 223 bool is_internal_; |
| 233 std::string command_line_switch_; | 224 std::string command_line_switch_; |
| 234 std::unique_ptr<version_info::Channel> channel_; | 225 std::unique_ptr<version_info::Channel> channel_; |
| 235 | 226 |
| 236 DISALLOW_COPY_AND_ASSIGN(SimpleFeature); | 227 DISALLOW_COPY_AND_ASSIGN(SimpleFeature); |
| 237 }; | 228 }; |
| 238 | 229 |
| 239 } // namespace extensions | 230 } // namespace extensions |
| 240 | 231 |
| 241 #endif // EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_ | 232 #endif // EXTENSIONS_COMMON_FEATURES_SIMPLE_FEATURE_H_ |
| OLD | NEW |