Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / chrome_browser_field_trials_desktop.cc
blob087fdb595863b8ca015614be5d0c9735a54160c7
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 "chrome/browser/auto_launch_trial.h"
12 #include "chrome/browser/google/google_brand.h"
13 #include "chrome/browser/prerender/prerender_field_trial.h"
14 #include "chrome/browser/tracing/background_tracing_field_trial.h"
15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/variations/variations_util.h"
17 #include "components/variations/variations_associated_data.h"
19 namespace chrome {
21 namespace {
23 void AutoLaunchChromeFieldTrial() {
24 std::string brand;
25 google_brand::GetBrand(&brand);
27 // Create a 100% field trial based on the brand code.
28 if (auto_launch_trial::IsInExperimentGroup(brand)) {
29 base::FieldTrialList::CreateFieldTrial(kAutoLaunchTrialName,
30 kAutoLaunchTrialAutoLaunchGroup);
31 } else if (auto_launch_trial::IsInControlGroup(brand)) {
32 base::FieldTrialList::CreateFieldTrial(kAutoLaunchTrialName,
33 kAutoLaunchTrialControlGroup);
37 void SetupLightSpeedTrials() {
38 if (!variations::GetVariationParamValue("LightSpeed", "NoGpu").empty()) {
39 base::CommandLine::ForCurrentProcess()->AppendSwitch(
40 switches::kDisableGpu);
44 void SetupStunProbeTrial() {
45 #if defined(ENABLE_WEBRTC)
46 std::map<std::string, std::string> params;
47 if (!variations::GetVariationParams("StunProbeTrial", &params))
48 return;
50 // The parameter, used by StartStunFieldTrial, should have the following
51 // format: "request_per_ip/interval/sharedsocket/server1:port/server2:port/
52 // server3:port/"
53 std::string cmd_param = params["request_per_ip"] + "/" + params["interval"] +
54 "/" + params["sharedsocket"] + "/" +
55 params["server1"] + "/" + params["server2"] + "/" +
56 params["server3"] + "/";
58 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
59 switches::kWebRtcStunProbeTrialParameter, cmd_param);
60 #endif
63 } // namespace
65 void SetupDesktopFieldTrials(const base::CommandLine& parsed_command_line) {
66 prerender::ConfigurePrerender(parsed_command_line);
67 AutoLaunchChromeFieldTrial();
68 SetupLightSpeedTrials();
69 tracing::SetupBackgroundTracingFieldTrial();
70 SetupStunProbeTrial();
73 } // namespace chrome