| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 BASE_FEATURE_LIST_H_ | 5 #ifndef BASE_FEATURE_LIST_H_ |
| 6 #define BASE_FEATURE_LIST_H_ | 6 #define BASE_FEATURE_LIST_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 enum FeatureState { | 25 enum FeatureState { |
| 26 FEATURE_DISABLED_BY_DEFAULT, | 26 FEATURE_DISABLED_BY_DEFAULT, |
| 27 FEATURE_ENABLED_BY_DEFAULT, | 27 FEATURE_ENABLED_BY_DEFAULT, |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 // The Feature struct is used to define the default state for a feature. See | 30 // The Feature struct is used to define the default state for a feature. See |
| 31 // comment below for more details. There must only ever be one struct instance | 31 // comment below for more details. There must only ever be one struct instance |
| 32 // for a given feature name - generally defined as a constant global variable or | 32 // for a given feature name - generally defined as a constant global variable or |
| 33 // file static. | 33 // file static. |
| 34 struct BASE_EXPORT Feature { | 34 struct BASE_EXPORT Feature { |
| 35 constexpr Feature(const char* name, FeatureState default_state) |
| 36 : name(name), default_state(default_state) {} |
| 35 // The name of the feature. This should be unique to each feature and is used | 37 // The name of the feature. This should be unique to each feature and is used |
| 36 // for enabling/disabling features via command line flags and experiments. | 38 // for enabling/disabling features via command line flags and experiments. |
| 37 const char* const name; | 39 const char* const name; |
| 38 | 40 |
| 39 // The default state (i.e. enabled or disabled) for this feature. | 41 // The default state (i.e. enabled or disabled) for this feature. |
| 40 const FeatureState default_state; | 42 const FeatureState default_state; |
| 41 }; | 43 }; |
| 42 | 44 |
| 43 // The FeatureList class is used to determine whether a given feature is on or | 45 // The FeatureList class is used to determine whether a given feature is on or |
| 44 // off. It provides an authoritative answer, taking into account command-line | 46 // off. It provides an authoritative answer, taking into account command-line |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 276 |
| 275 // Whether this object has been initialized from command line. | 277 // Whether this object has been initialized from command line. |
| 276 bool initialized_from_command_line_ = false; | 278 bool initialized_from_command_line_ = false; |
| 277 | 279 |
| 278 DISALLOW_COPY_AND_ASSIGN(FeatureList); | 280 DISALLOW_COPY_AND_ASSIGN(FeatureList); |
| 279 }; | 281 }; |
| 280 | 282 |
| 281 } // namespace base | 283 } // namespace base |
| 282 | 284 |
| 283 #endif // BASE_FEATURE_LIST_H_ | 285 #endif // BASE_FEATURE_LIST_H_ |
| OLD | NEW |