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..8e706f44d93c252444465625b982338132b1192f 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: |
|
Alexei Svitkine (slow)
2016/06/10 15:46:49
I find "a fixed list of variations of parameters o
jkrcal
2016/06/14 10:04:22
Done.
|
| + // 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 { |
|
Alexei Svitkine (slow)
2016/06/10 15:46:49
Nit: FeatureState? assuming this only applies to f
jkrcal
2016/06/14 10:04:22
Done.
|
| + // 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; |
|
Alexei Svitkine (slow)
2016/06/10 15:46:49
Add a comment mentioning how it's used.
Also, exp
jkrcal
2016/06/14 10:04:22
Done.
|
| + 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,39 @@ 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 FieldTrial in which the selected variation parameters |
| + // should be registered. This is used if type is |
| + // FEATURE_WITH_VARIATIONS_VALUE. |
| + const char* feature_trial_name; |
| + |
| + // 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; |
|
Alexei Svitkine (slow)
2016/06/10 15:46:49
Nit: Keep this above the two fields above, since i
jkrcal
2016/06/14 10:04:22
I moved it even above the choices, I think it is c
|
| + |
| + // 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 choice for the option at |index|. Only applicable for types |
|
Alexei Svitkine (slow)
2016/06/10 15:46:49
types -> type
jkrcal
2016/06/14 10:04:22
Done.
|
| + // FEATURE_MULTI. |
|
Alexei Svitkine (slow)
2016/06/10 15:46:49
FEATURE_WITH_VARIATIONS_VALUE?
jkrcal
2016/06/14 10:04:22
Addressed by VariationForOption(). Maybe I don't u
|
| + const FeatureEntry::Choice& ChoiceForOption(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 { |