summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chrome_browser_field_trials_mobile.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/chrome_browser_field_trials_mobile.cc')
-rw-r--r--chrome/browser/chrome_browser_field_trials_mobile.cc44
1 files changed, 44 insertions, 0 deletions
diff --git a/chrome/browser/chrome_browser_field_trials_mobile.cc b/chrome/browser/chrome_browser_field_trials_mobile.cc
index 7fb1896..5e17ca7 100644
--- a/chrome/browser/chrome_browser_field_trials_mobile.cc
+++ b/chrome/browser/chrome_browser_field_trials_mobile.cc
@@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/metrics/field_trial.h"
#include "base/prefs/pref_service.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
namespace chrome {
@@ -51,12 +52,55 @@ void DataCompressionProxyFieldTrial() {
<< ". Selected group id: " << v;
}
+void NewTabButtonInToolbarFieldTrial(const CommandLine& parsed_command_line) {
+ // Do not enable this field trials for tablet devices.
+ if (parsed_command_line.HasSwitch(switches::kTabletUI))
+ return;
+
+ const char kPhoneNewTabToolbarButtonFieldTrialName[] =
+ "PhoneNewTabToolbarButton";
+ const base::FieldTrial::Probability kPhoneNewTabToolbarButtonDivisor = 100;
+
+ // 50/100 = 50% for Non-Stable users.
+ // 0/100 = 0% for Stable users.
+ const base::FieldTrial::Probability kPhoneNewTabToolbarButtonNonStable = 50;
+ const base::FieldTrial::Probability kPhoneNewTabToolbarButtonStable = 0;
+ const char kEnabled[] = "Enabled";
+ const char kDisabled[] = "Disabled";
+
+ // Find out if this is a stable channel.
+ const bool kIsStableChannel =
+ chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE;
+
+ // Experiment enabled until Jan 1, 2015. By default, disabled.
+ scoped_refptr<base::FieldTrial> trial(
+ base::FieldTrialList::FactoryGetFieldTrial(
+ kPhoneNewTabToolbarButtonFieldTrialName,
+ kPhoneNewTabToolbarButtonDivisor,
+ kDisabled, 2015, 1, 1, NULL));
+
+ // We want our trial results to be persistent.
+ trial->UseOneTimeRandomization();
+ const int kEnabledGroup = trial->AppendGroup(
+ kEnabled,
+ kIsStableChannel ?
+ kPhoneNewTabToolbarButtonStable : kPhoneNewTabToolbarButtonNonStable);
+
+ const int v = trial->group();
+ VLOG(1) << "Phone NewTab toolbar button enabled group id: " << kEnabledGroup
+ << ". Selected group id: " << v;
+}
+
} // namespace
void SetupMobileFieldTrials(const CommandLine& parsed_command_line,
const base::Time& install_time,
PrefService* local_state) {
DataCompressionProxyFieldTrial();
+
+#if defined(OS_ANDROID)
+ NewTabButtonInToolbarFieldTrial(parsed_command_line);
+#endif
}
} // namespace chrome