Removed code to support the ShowAppLauncherPromo field trial.
[chromium-blink-merge.git] / chrome / browser / chrome_browser_field_trials_desktop.cc
blobd1ac876ed9aaa46769596a302f3b498dac77aa88
1 // Copyright 2013 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_desktop.h"
7 #include <string>
9 #include "base/command_line.h"
10 #include "base/metrics/field_trial.h"
11 #include "base/strings/string_util.h"
12 #include "chrome/browser/auto_launch_trial.h"
13 #include "chrome/browser/google/google_brand.h"
14 #include "chrome/browser/prerender/prerender_field_trial.h"
15 #include "chrome/browser/profiles/profiles_state.h"
16 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
17 #include "chrome/browser/ui/sync/one_click_signin_helper.h"
18 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/chrome_version_info.h"
20 #include "chrome/common/variations/variations_util.h"
21 #include "components/variations/variations_associated_data.h"
22 #include "content/public/common/content_constants.h"
23 #include "net/spdy/spdy_session.h"
24 #include "ui/base/layout.h"
26 namespace chrome {
28 namespace {
30 void AutoLaunchChromeFieldTrial() {
31 std::string brand;
32 google_brand::GetBrand(&brand);
34 // Create a 100% field trial based on the brand code.
35 if (auto_launch_trial::IsInExperimentGroup(brand)) {
36 base::FieldTrialList::CreateFieldTrial(kAutoLaunchTrialName,
37 kAutoLaunchTrialAutoLaunchGroup);
38 } else if (auto_launch_trial::IsInControlGroup(brand)) {
39 base::FieldTrialList::CreateFieldTrial(kAutoLaunchTrialName,
40 kAutoLaunchTrialControlGroup);
44 void SetupInfiniteCacheFieldTrial() {
45 const base::FieldTrial::Probability kDivisor = 100;
47 base::FieldTrial::Probability infinite_cache_probability = 0;
49 scoped_refptr<base::FieldTrial> trial(
50 base::FieldTrialList::FactoryGetFieldTrial(
51 "InfiniteCache", kDivisor, "No", 2013, 12, 31,
52 base::FieldTrial::ONE_TIME_RANDOMIZED, NULL));
53 trial->AppendGroup("Yes", infinite_cache_probability);
54 trial->AppendGroup("Control", infinite_cache_probability);
57 void DisableShowProfileSwitcherTrialIfNecessary() {
58 // This trial is created by the VariationsService, but it needs to be disabled
59 // if multi-profiles isn't enabled.
60 base::FieldTrial* trial = base::FieldTrialList::Find("ShowProfileSwitcher");
61 if (trial && !profiles::IsMultipleProfilesEnabled())
62 trial->Disable();
65 void SetupLightSpeedTrials() {
66 if (!variations::GetVariationParamValue("LightSpeed", "NoGpu").empty()) {
67 base::CommandLine::ForCurrentProcess()->AppendSwitch(
68 switches::kDisableGpu);
72 } // namespace
74 void SetupDesktopFieldTrials(const base::CommandLine& parsed_command_line) {
75 prerender::ConfigurePrerender(parsed_command_line);
76 AutoLaunchChromeFieldTrial();
77 SetupInfiniteCacheFieldTrial();
78 DisableShowProfileSwitcherTrialIfNecessary();
79 SetupLightSpeedTrials();
82 } // namespace chrome