diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/components/flags_ui/feature_entry.h | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/components/flags_ui/feature_entry.h')
-rw-r--r-- | chromium/components/flags_ui/feature_entry.h | 87 |
1 files changed, 48 insertions, 39 deletions
diff --git a/chromium/components/flags_ui/feature_entry.h b/chromium/components/flags_ui/feature_entry.h index 3e0cfc383bd..167618f45f4 100644 --- a/chromium/components/flags_ui/feature_entry.h +++ b/chromium/components/flags_ui/feature_entry.h @@ -7,6 +7,7 @@ #include <string> +#include "base/containers/span.h" #include "base/strings/string16.h" namespace base { @@ -27,7 +28,7 @@ extern const char kGenericExperimentChoiceAutomatic[]; // about_flags entries or deleted. Most feature entries should only be around // for a few milestones, until their full launch. struct FeatureEntry { - enum Type { + enum Type : unsigned short { // A feature with a single flag value. // // For new entries, it is recommended to instead use FEATURE_VALUE macro @@ -72,8 +73,9 @@ struct FeatureEntry { // passed from the server in a trial config). When set to Enabled, the // feature is overriden to be enabled and empty set of parameters is used // boiling down to the default behavior in the code. - // TODO(crbug.com/805766): The resulting chrome://flags entries will not work on Chrome OS - // devices (but will work in the CrOS-emulated build on Linux). + // TODO(crbug.com/805766): The resulting chrome://flags entries will not + // work on Chrome OS devices (but will work in the CrOS-emulated build on + // Linux). FEATURE_WITH_PARAMS_VALUE, // Corresponds to a command line switch where the value is treatead as a @@ -140,52 +142,59 @@ struct FeatureEntry { // The platforms the feature is available on. // Needs to be more than a compile-time #ifdef because of profile sync. - unsigned supported_platforms; // bitmask + unsigned short supported_platforms; // bitmask // Type of entry. Type type; - // The commandline switch and value that are added when this flag is active. - // This is different from |internal_name| so that the commandline flag can be - // renamed without breaking the prefs file. - // This is used if type is SINGLE_VALUE or ENABLE_DISABLE_VALUE. - const char* command_line_switch; - - // Simple switches that have no value should use "" for command_line_value. - const char* command_line_value; - - // For ENABLE_DISABLE_VALUE, the command line switch and value to explicitly - // disable the feature. - const char* disable_command_line_switch; - const char* disable_command_line_value; - - // For FEATURE_VALUE or FEATURE_WITH_VARIATIONS_VALUE, the base::Feature this - // entry corresponds to. The same feature must not be used in multiple - // FeatureEntries. - const base::Feature* feature; - - // 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; - - // This describes the options if type is MULTI_VALUE. - const Choice* choices; - - // This describes the options 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; + union { + struct { + // The commandline switch and value that are added when this flag is + // active. This is different from |internal_name| so that the commandline + // flag can be renamed without breaking the prefs file. This is used if + // type is SINGLE_VALUE or ENABLE_DISABLE_VALUE. + const char* command_line_switch; + + // Simple switches that have no value should use "" for + // command_line_value. + const char* command_line_value; + + // For ENABLE_DISABLE_VALUE, the command line switch and value to + // explicitly disable the feature. + const char* disable_command_line_switch; + const char* disable_command_line_value; + } switches; + + struct { + // For FEATURE_VALUE or FEATURE_WITH_VARIATIONS_VALUE, the base::Feature + // this entry corresponds to. The same feature must not be used in + // multiple FeatureEntries. + const base::Feature* feature; + + // This describes the options if type is FEATURE_WITH_VARIATIONS_VALUE. + // The first variation is the default "Enabled" variation, its + // description_id is disregarded. + base::span<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; + } feature; + + // This describes the options if type is MULTI_VALUE. + base::span<const Choice> choices; + }; // Check whether internal |name| matches this FeatureEntry. Depending on the // type of entry, this compared it to either |internal_name| or the values // produced by NameForOption(). bool InternalNameMatches(const std::string& name) const; + // Number of options to choose from. This is used if type is MULTI_VALUE, + // ENABLE_DISABLE_VALUE, FEATURE_VALUE, or FEATURE_WITH_PARAMS_VALUE. + int NumOptions() const; + // 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; |