summaryrefslogtreecommitdiffstats
path: root/ios
diff options
context:
space:
mode:
authorsdefresne <sdefresne@chromium.org>2015-11-04 08:44:53 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-04 16:45:50 +0000
commit90ff654e507c5046d060523db574a309a494ca29 (patch)
tree52ddaa251b9388803dd1dae8cc55aadc450bce73 /ios
parente9d7c2b4be22284fea96a9d0a857d6a57f9d13db (diff)
downloadchromium_src-90ff654e507c5046d060523db574a309a494ca29.zip
chromium_src-90ff654e507c5046d060523db574a309a494ca29.tar.gz
chromium_src-90ff654e507c5046d060523db574a309a494ca29.tar.bz2
Add function to register field trials on iOS.
Introduce new iOS specific function to register field trials used on iOS based on the trials currently enabled downstream. BUG=513323 Review URL: https://codereview.chromium.org/1413353010 Cr-Commit-Position: refs/heads/master@{#357830}
Diffstat (limited to 'ios')
-rw-r--r--ios/chrome/browser/ios_chrome_field_trials.cc27
-rw-r--r--ios/chrome/browser/ios_chrome_field_trials.h17
-rw-r--r--ios/chrome/ios_chrome.gyp2
3 files changed, 46 insertions, 0 deletions
diff --git a/ios/chrome/browser/ios_chrome_field_trials.cc b/ios/chrome/browser/ios_chrome_field_trials.cc
new file mode 100644
index 0000000..7d9f19d
--- /dev/null
+++ b/ios/chrome/browser/ios_chrome_field_trials.cc
@@ -0,0 +1,27 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ios/chrome/browser/ios_chrome_field_trials.h"
+
+#include "base/metrics/field_trial.h"
+#include "components/omnibox/browser/omnibox_field_trial.h"
+
+namespace {
+
+// Instantiates dynamic field trials by querying their state to ensure they
+// get reported as used.
+void InstantiateDynamicTrials() {
+ // Activate the autocomplete dynamic field trials.
+ OmniboxFieldTrial::ActivateDynamicTrials();
+
+ // Activate the iOS tab eviction dynamic field trials.
+ base::FieldTrialList::FindValue("TabEviction");
+}
+
+} // namespace
+
+void SetupFieldTrials(const base::CommandLine& command_line,
+ const base::Time& install_time) {
+ InstantiateDynamicTrials();
+}
diff --git a/ios/chrome/browser/ios_chrome_field_trials.h b/ios/chrome/browser/ios_chrome_field_trials.h
new file mode 100644
index 0000000..9f890a7
--- /dev/null
+++ b/ios/chrome/browser/ios_chrome_field_trials.h
@@ -0,0 +1,17 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_IOS_CHROME_FIELD_TRIALS_H_
+#define IOS_CHROME_BROWSER_IOS_CHROME_FIELD_TRIALS_H_
+
+namespace base {
+class CommandLine;
+class Time;
+}
+
+// Sets up iOS-specific field trials.
+void SetupFieldTrials(const base::CommandLine& command_line,
+ const base::Time& install_time);
+
+#endif // IOS_CHROME_BROWSER_IOS_CHROME_FIELD_TRIALS_H_
diff --git a/ios/chrome/ios_chrome.gyp b/ios/chrome/ios_chrome.gyp
index 285c863..6a7ea80 100644
--- a/ios/chrome/ios_chrome.gyp
+++ b/ios/chrome/ios_chrome.gyp
@@ -295,6 +295,8 @@
'browser/install_time_util.mm',
'browser/installation_notifier.h',
'browser/installation_notifier.mm',
+ 'browser/ios_chrome_field_trials.cc',
+ 'browser/ios_chrome_field_trials.h',
'browser/memory/memory_debugger.h',
'browser/memory/memory_debugger.mm',
'browser/memory/memory_debugger_manager.h',