Delay app cache check until flag file indicates that it is ready
[chromium-blink-merge.git] / chrome / browser / chrome_browser_field_trials.cc
blob00256c790b74339cd29e13982a455e358a3497ef
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"
7 #include <string>
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/browser/omnibox/omnibox_field_trial.h"
15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/chrome_version_info.h"
17 #include "chrome/common/metrics/variations/uniformity_field_trials.h"
18 #include "chrome/common/pref_names.h"
20 #if defined(OS_ANDROID) || defined(OS_IOS)
21 #include "chrome/browser/chrome_browser_field_trials_mobile.h"
22 #else
23 #include "chrome/browser/chrome_browser_field_trials_desktop.h"
24 #endif
26 ChromeBrowserFieldTrials::ChromeBrowserFieldTrials(
27 const CommandLine& parsed_command_line)
28 : parsed_command_line_(parsed_command_line) {
31 ChromeBrowserFieldTrials::~ChromeBrowserFieldTrials() {
34 void ChromeBrowserFieldTrials::SetupFieldTrials(PrefService* local_state) {
35 const base::Time install_time = base::Time::FromTimeT(
36 local_state->GetInt64(prefs::kInstallDate));
37 DCHECK(!install_time.is_null());
39 // Field trials that are shared by all platforms.
40 chrome_variations::SetupUniformityFieldTrials(install_time);
41 InstantiateDynamicTrials();
43 #if defined(OS_ANDROID) || defined(OS_IOS)
44 chrome::SetupMobileFieldTrials(
45 parsed_command_line_, install_time, local_state);
46 #else
47 chrome::SetupDesktopFieldTrials(
48 parsed_command_line_, install_time, local_state);
49 #endif
52 void ChromeBrowserFieldTrials::InstantiateDynamicTrials() {
53 // Call |FindValue()| on the trials below, which may come from the server, to
54 // ensure they get marked as "used" for the purposes of data reporting.
55 base::FieldTrialList::FindValue("UMA-Dynamic-Binary-Uniformity-Trial");
56 base::FieldTrialList::FindValue("UMA-Dynamic-Uniformity-Trial");
57 base::FieldTrialList::FindValue("InstantDummy");
58 base::FieldTrialList::FindValue("InstantChannel");
59 base::FieldTrialList::FindValue("Test0PercentDefault");
60 // MouseEventPreconnect trial is used from renderer process.
61 // Mark here so it will be sync-ed.
62 base::FieldTrialList::FindValue("MouseEventPreconnect");
63 // Activate the autocomplete dynamic field trials.
64 OmniboxFieldTrial::ActivateDynamicTrials();