Chromium Code Reviews| Index: components/flags_ui/feature_entry.h |
| diff --git a/components/flags_ui/feature_entry.h b/components/flags_ui/feature_entry.h |
| index 4f7f0819a489962e0a195b4b79fd0c8ae9910e0f..42fda2113a64f9d6f4ff4356a5cbba591cb8166c 100644 |
| --- a/components/flags_ui/feature_entry.h |
| +++ b/components/flags_ui/feature_entry.h |
| @@ -47,6 +47,23 @@ struct FeatureEntry { |
| // have three states: Default, Enabled, Disabled. When not specified or set |
| // to Default, the normal default value of the feature is used. |
| FEATURE_VALUE, |
| + |
| + // Corresponds to a base::Feature + a fixed list of variations of parameters |
| + // of the given feature [V_1, ..., V_n]. The entry will have n+2 states: |
| + // Default, Enabled: V_1, ..., Enabled: V_n, Disabled. When not specified or |
| + // set to Default, the normal default values of the feature and of the |
| + // parameters are used. |
| + FEATURE_WITH_VARIATIONS_VALUE, |
| + }; |
| + |
| + // Describes state of a feature. |
| + enum State { |
| + // The state of the feature is not overridden by the user. |
| + DEFAULT, |
| + // The feature is enabled by the user. |
| + ENABLED, |
| + // The feature is disabled by the user. |
| + DISABLED, |
| }; |
| // Used for MULTI_VALUE types to describe one of the possible values the user |
| @@ -61,6 +78,20 @@ struct FeatureEntry { |
| const char* command_line_value; |
| }; |
| + // Configures one parameter for FEATURE_WITH_VARIATIONS_VALUE. |
| + struct FeatureParam { |
| + const char* param_name; |
| + const char* param_value; |
| + }; |
| + |
| + // Specified one variation (list of parameter values) for |
| + // FEATURE_WITH_VARIATIONS_VALUE. |
| + struct FeatureVariation { |
| + const char* description_text; |
| + const FeatureParam* params; |
| + int num_params; |
| + }; |
| + |
| // The internal name of the feature entry. This is never shown to the user. |
| // It _is_ however stored in the prefs file, so you shouldn't change the |
| // name of existing flags. |
| @@ -99,15 +130,35 @@ struct FeatureEntry { |
| // This is used if type is MULTI_VALUE. |
| const Choice* choices; |
| - // Number of |choices|. |
| - // This is used if type is MULTI_VALUE. |
| - int num_choices; |
| + // This is used if type is FEATURE_WITH_VARIATIONS_VALUE. The first variation |
| + // is the default "Enabled" variation, its description_id is disregarded. |
| + const FeatureVariation* feature_variations; |
| + |
| + // The name of the Finch trial in which the selected variation parameters |
|
Alexei Svitkine (slow)
2016/06/08 18:54:35
Finch is an internal codename and shouldn't be use
jkrcal
2016/06/09 09:55:15
Done.
|
| + // should be registered. This is used if type is |
| + // FEATURE_WITH_VARIATIONS_VALUE. |
| + const char* feature_trial; |
|
Alexei Svitkine (slow)
2016/06/08 18:54:35
feature_trial_name
jkrcal
2016/06/09 09:55:15
Done.
|
| + |
| + // Number of options to choose from. This is used if type is MULTI_VALUE, |
| + // ENABLE_DISABLE_VALUE, FEATURE_VALUE, or FEATURE_WITH_VARIATIONS_VALUE. |
| + int num_options; |
| + |
| + // Returns the name used in prefs for the option at the specified |index|. |
| + // Only used for types that use |num_options|. |
| + std::string NameForOption(int index) const; |
| + |
| + // Returns the human readable description for the option at |index|. |
| + // Only used for types that use |num_options|. |
| + base::string16 DescriptionForOption(int index) const; |
| - // Returns the name used in prefs for the choice at the specified |index|. |
| - std::string NameForChoice(int index) const; |
| + // Returns the state of the feature at |index|. Only applicable for types |
| + // FEATURE_VALUE and FEATURE_WITH_VARIATIONS_VALUE. |
| + FeatureEntry::State StateForOption(int index) const; |
| - // Returns the human readable description for the choice at |index|. |
| - base::string16 DescriptionForChoice(int index) const; |
| + // Returns the variation for the option at |index| or nullptr if there is no |
| + // variation associated at |index|. Only applicable for types FEATURE_VALUE |
| + // and FEATURE_WITH_VARIATIONS_VALUE. |
| + const FeatureEntry::FeatureVariation* VariationForOption(int index) const; |
| }; |
| namespace testing { |