1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/chrome_browser_field_trials.h"
9 #include "base/command_line.h"
10 #include "base/metrics/field_trial.h"
11 #include "base/prefs/pref_service.h"
12 #include "base/strings/string_util.h"
13 #include "base/time/time.h"
14 #include "chrome/common/chrome_switches.h"
15 #include "chrome/common/chrome_version_info.h"
16 #include "components/metrics/metrics_pref_names.h"
17 #include "components/omnibox/omnibox_field_trial.h"
19 #if defined(OS_ANDROID) || defined(OS_IOS)
20 #include "chrome/browser/chrome_browser_field_trials_mobile.h"
22 #include "chrome/browser/chrome_browser_field_trials_desktop.h"
25 ChromeBrowserFieldTrials::ChromeBrowserFieldTrials(
26 const base::CommandLine
& parsed_command_line
)
27 : parsed_command_line_(parsed_command_line
) {
30 ChromeBrowserFieldTrials::~ChromeBrowserFieldTrials() {
33 void ChromeBrowserFieldTrials::SetupFieldTrials(const base::Time
& install_time
,
34 PrefService
* local_state
) {
35 DCHECK(!install_time
.is_null());
37 // Field trials that are shared by all platforms.
38 InstantiateDynamicTrials();
40 #if defined(OS_ANDROID) || defined(OS_IOS)
41 chrome::SetupMobileFieldTrials(parsed_command_line_
);
43 chrome::SetupDesktopFieldTrials(
44 parsed_command_line_
, local_state
);
48 void ChromeBrowserFieldTrials::InstantiateDynamicTrials() {
49 // The following trials are used from renderer process.
50 // Mark here so they will be sync-ed.
51 base::FieldTrialList::FindValue("CLD1VsCLD2");
52 base::FieldTrialList::FindValue("MouseEventPreconnect");
53 base::FieldTrialList::FindValue("DisplayList2dCanvas");
54 // Activate the autocomplete dynamic field trials.
55 OmniboxFieldTrial::ActivateDynamicTrials();