| 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 <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // feature to |override_state|. Command-line overrides still take precedence | 110 // feature to |override_state|. Command-line overrides still take precedence |
| 111 // over field trials, so this will have no effect if the feature is being | 111 // over field trials, so this will have no effect if the feature is being |
| 112 // overridden from the command-line. The associated field trial will be | 112 // overridden from the command-line. The associated field trial will be |
| 113 // activated when the feature state for this feature is queried. This should | 113 // activated when the feature state for this feature is queried. This should |
| 114 // be called during registration, after InitializeFromCommandLine() has been | 114 // be called during registration, after InitializeFromCommandLine() has been |
| 115 // called but before the instance is registered via SetInstance(). | 115 // called but before the instance is registered via SetInstance(). |
| 116 void RegisterFieldTrialOverride(const std::string& feature_name, | 116 void RegisterFieldTrialOverride(const std::string& feature_name, |
| 117 OverrideState override_state, | 117 OverrideState override_state, |
| 118 FieldTrial* field_trial); | 118 FieldTrial* field_trial); |
| 119 | 119 |
| 120 // Returns comma-separated lists of feature names (in the same format that is |
| 121 // accepted by InitializeFromCommandLine()) corresponding to features that |
| 122 // have been overridden - either through command-line or via FieldTrials. |
| 123 // Must be called only after the instance has been initialized and registered. |
| 124 void GetFeatureOverrides(std::string* enable_overrides, |
| 125 std::string* disable_overrides); |
| 126 |
| 120 // Returns whether the given |feature| is enabled. Must only be called after | 127 // Returns whether the given |feature| is enabled. Must only be called after |
| 121 // the singleton instance has been registered via SetInstance(). Additionally, | 128 // the singleton instance has been registered via SetInstance(). Additionally, |
| 122 // a feature with a given name must only have a single corresponding Feature | 129 // a feature with a given name must only have a single corresponding Feature |
| 123 // struct, which is checked in builds with DCHECKs enabled. | 130 // struct, which is checked in builds with DCHECKs enabled. |
| 124 static bool IsEnabled(const Feature& feature); | 131 static bool IsEnabled(const Feature& feature); |
| 125 | 132 |
| 126 // Splits a comma-separated string containing feature names into a vector. | 133 // Splits a comma-separated string containing feature names into a vector. |
| 127 static std::vector<std::string> SplitFeatureListString( | 134 static std::vector<std::string> SplitFeatureListString( |
| 128 const std::string& input); | 135 const std::string& input); |
| 129 | 136 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 // Whether this object has been fully initialized. This gets set to true as a | 216 // Whether this object has been fully initialized. This gets set to true as a |
| 210 // result of FinalizeInitialization(). | 217 // result of FinalizeInitialization(). |
| 211 bool initialized_; | 218 bool initialized_; |
| 212 | 219 |
| 213 DISALLOW_COPY_AND_ASSIGN(FeatureList); | 220 DISALLOW_COPY_AND_ASSIGN(FeatureList); |
| 214 }; | 221 }; |
| 215 | 222 |
| 216 } // namespace base | 223 } // namespace base |
| 217 | 224 |
| 218 #endif // BASE_FEATURE_LIST_H_ | 225 #endif // BASE_FEATURE_LIST_H_ |
| OLD | NEW |