summaryrefslogtreecommitdiffstats
path: root/extensions/common/feature_switch.h
diff options
context:
space:
mode:
authorimcheng <imcheng@chromium.org>2016-02-10 18:06:53 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-11 02:09:24 +0000
commit7c91fae3f88773af47a79f4a3bceaccfa1b27ea5 (patch)
tree89f4dbfa44555dc5a6d2a6ba327ca313084e3b61 /extensions/common/feature_switch.h
parent338a3bb9656e66896c4b28dc08a24c28579ee5f5 (diff)
downloadchromium_src-7c91fae3f88773af47a79f4a3bceaccfa1b27ea5.zip
chromium_src-7c91fae3f88773af47a79f4a3bceaccfa1b27ea5.tar.gz
chromium_src-7c91fae3f88773af47a79f4a3bceaccfa1b27ea5.tar.bz2
[Feature Switch][Media Router] Add required field trials to MR switch.
Add a generic required_field_trials to FeatureSwitch that takes the place of a singular field_trial_name. When deciding whether to enable or disable a feature with field trials, all field trials will be queried (though short circuiting can occur): - If user is in "Enabled" group for all field trials, then enable feature. - If user is in "Disabled group for any field trials, then disable feature. - Otherwise, fall back to default value. Change the MR FeatureSwitches to depend on the EAR field trial. Per discussion, we will change the interpretation of MR field trial to be "X% of users that have EAR field trial enabled". BUG=541315 Review URL: https://codereview.chromium.org/1680823004 Cr-Commit-Position: refs/heads/master@{#374834}
Diffstat (limited to 'extensions/common/feature_switch.h')
-rw-r--r--extensions/common/feature_switch.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/extensions/common/feature_switch.h b/extensions/common/feature_switch.h
index c170f9c..b39cc8c 100644
--- a/extensions/common/feature_switch.h
+++ b/extensions/common/feature_switch.h
@@ -6,6 +6,7 @@
#define EXTENSIONS_COMMON_FEATURE_SWITCH_H_
#include <string>
+#include <vector>
#include "base/macros.h"
@@ -26,8 +27,10 @@ namespace extensions {
// the finch config).
// 3. If there is a switch name, and the switch is present in the command line,
// the command line value will be used.
-// 4. If there is a finch experiment associated and applicable to the machine,
-// the finch value will be used.
+// 4. If there are field trials associated with the feature, and the machine
+// is in the "Enabled" group for all field trials, then the feature is
+// enabled. If the machine is in the "Disabled" group for any field trials,
+// the feature is disabled.
// 5. Otherwise, the default value is used.
class FeatureSwitch {
public:
@@ -72,13 +75,17 @@ class FeatureSwitch {
FeatureSwitch(const char* switch_name,
const char* field_trial_name,
DefaultValue default_value);
+ FeatureSwitch(const char* switch_name,
+ const std::vector<std::string>& required_field_trials,
+ DefaultValue default_value);
FeatureSwitch(const base::CommandLine* command_line,
const char* switch_name,
DefaultValue default_value);
FeatureSwitch(const base::CommandLine* command_line,
const char* switch_name,
- const char* field_trial_name,
+ const std::vector<std::string>& required_field_trials,
DefaultValue default_value);
+ ~FeatureSwitch();
// Consider using ScopedOverride instead.
void SetOverrideValue(OverrideValue value);
@@ -92,7 +99,7 @@ class FeatureSwitch {
const base::CommandLine* command_line_;
const char* switch_name_;
- const char* field_trial_name_;
+ std::vector<std::string> required_field_trials_;
bool default_value_;
OverrideValue override_value_;