OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "base/string_piece.h" | 22 #include "base/string_piece.h" |
23 #include "base/string_split.h" | 23 #include "base/string_split.h" |
24 #include "base/string_util.h" | 24 #include "base/string_util.h" |
25 #include "base/sys_string_conversions.h" | 25 #include "base/sys_string_conversions.h" |
26 #include "base/threading/platform_thread.h" | 26 #include "base/threading/platform_thread.h" |
27 #include "base/time.h" | 27 #include "base/time.h" |
28 #include "base/utf_string_conversions.h" | 28 #include "base/utf_string_conversions.h" |
29 #include "base/values.h" | 29 #include "base/values.h" |
30 #include "build/build_config.h" | 30 #include "build/build_config.h" |
31 #include "chrome/browser/about_flags.h" | 31 #include "chrome/browser/about_flags.h" |
| 32 #include "chrome/browser/auto_launch_trial.h" |
32 #include "chrome/browser/background/background_mode_manager.h" | 33 #include "chrome/browser/background/background_mode_manager.h" |
33 #include "chrome/browser/browser_process_impl.h" | 34 #include "chrome/browser/browser_process_impl.h" |
34 #include "chrome/browser/browser_shutdown.h" | 35 #include "chrome/browser/browser_shutdown.h" |
35 #include "chrome/browser/chrome_browser_main_extra_parts.h" | 36 #include "chrome/browser/chrome_browser_main_extra_parts.h" |
36 #include "chrome/browser/defaults.h" | 37 #include "chrome/browser/defaults.h" |
37 #include "chrome/browser/extensions/default_apps_trial.h" | 38 #include "chrome/browser/extensions/default_apps_trial.h" |
38 #include "chrome/browser/extensions/extension_protocols.h" | 39 #include "chrome/browser/extensions/extension_protocols.h" |
39 #include "chrome/browser/extensions/extension_service.h" | 40 #include "chrome/browser/extensions/extension_service.h" |
40 #include "chrome/browser/extensions/extensions_startup.h" | 41 #include "chrome/browser/extensions/extensions_startup.h" |
41 #include "chrome/browser/first_run/first_run_browser_process.h" | 42 #include "chrome/browser/first_run/first_run_browser_process.h" |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 // Create a 100% field trial based on the brand code. | 1073 // Create a 100% field trial based on the brand code. |
1073 if (LowerCaseEqualsASCII(brand, "ecdb")) { | 1074 if (LowerCaseEqualsASCII(brand, "ecdb")) { |
1074 base::FieldTrialList::CreateFieldTrial(kDefaultAppsTrial_Name, | 1075 base::FieldTrialList::CreateFieldTrial(kDefaultAppsTrial_Name, |
1075 kDefaultAppsTrial_NoAppsGroup); | 1076 kDefaultAppsTrial_NoAppsGroup); |
1076 } else if (LowerCaseEqualsASCII(brand, "ecda")) { | 1077 } else if (LowerCaseEqualsASCII(brand, "ecda")) { |
1077 base::FieldTrialList::CreateFieldTrial(kDefaultAppsTrial_Name, | 1078 base::FieldTrialList::CreateFieldTrial(kDefaultAppsTrial_Name, |
1078 kDefaultAppsTrial_WithAppsGroup); | 1079 kDefaultAppsTrial_WithAppsGroup); |
1079 } | 1080 } |
1080 } | 1081 } |
1081 | 1082 |
| 1083 void ChromeBrowserMainParts::AutoLaunchChromeFieldTrial() { |
| 1084 std::string brand; |
| 1085 google_util::GetBrand(&brand); |
| 1086 |
| 1087 // Create a 100% field trial based on the brand code. |
| 1088 if (LowerCaseEqualsASCII(brand, "rngp")) { |
| 1089 base::FieldTrialList::CreateFieldTrial(kAutoLaunchTrial_Name, |
| 1090 kAutoLaunchTrial_AutoLaunchGroup); |
| 1091 } else if (LowerCaseEqualsASCII(brand, "rngq")) { |
| 1092 base::FieldTrialList::CreateFieldTrial(kAutoLaunchTrial_Name, |
| 1093 kAutoLaunchTrial_ControlGroup); |
| 1094 } |
| 1095 } |
| 1096 |
1082 // ChromeBrowserMainParts: |SetupMetricsAndFieldTrials()| related -------------- | 1097 // ChromeBrowserMainParts: |SetupMetricsAndFieldTrials()| related -------------- |
1083 | 1098 |
1084 // Initializes the metrics service with the configuration for this process, | 1099 // Initializes the metrics service with the configuration for this process, |
1085 // returning the created service (guaranteed non-NULL). | 1100 // returning the created service (guaranteed non-NULL). |
1086 MetricsService* ChromeBrowserMainParts::InitializeMetrics( | 1101 MetricsService* ChromeBrowserMainParts::InitializeMetrics( |
1087 const CommandLine& parsed_command_line, | 1102 const CommandLine& parsed_command_line, |
1088 const PrefService* local_state) { | 1103 const PrefService* local_state) { |
1089 #if defined(OS_WIN) | 1104 #if defined(OS_WIN) |
1090 if (parsed_command_line.HasSwitch(switches::kChromeFrame)) | 1105 if (parsed_command_line.HasSwitch(switches::kChromeFrame)) |
1091 MetricsLog::set_version_extension("-F"); | 1106 MetricsLog::set_version_extension("-F"); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 // shoud not be performed. | 1147 // shoud not be performed. |
1133 if (!proxy_policy_is_set) | 1148 if (!proxy_policy_is_set) |
1134 ProxyConnectionsFieldTrial(); | 1149 ProxyConnectionsFieldTrial(); |
1135 prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); | 1150 prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); |
1136 InstantFieldTrial::Activate(); | 1151 InstantFieldTrial::Activate(); |
1137 SpdyFieldTrial(); | 1152 SpdyFieldTrial(); |
1138 ConnectBackupJobsFieldTrial(); | 1153 ConnectBackupJobsFieldTrial(); |
1139 WarmConnectionFieldTrial(); | 1154 WarmConnectionFieldTrial(); |
1140 PredictorFieldTrial(); | 1155 PredictorFieldTrial(); |
1141 DefaultAppsFieldTrial(); | 1156 DefaultAppsFieldTrial(); |
| 1157 AutoLaunchChromeFieldTrial(); |
1142 } | 1158 } |
1143 | 1159 |
1144 // ----------------------------------------------------------------------------- | 1160 // ----------------------------------------------------------------------------- |
1145 // TODO(viettrungluu): move more/rest of BrowserMain() into BrowserMainParts. | 1161 // TODO(viettrungluu): move more/rest of BrowserMain() into BrowserMainParts. |
1146 | 1162 |
1147 #if defined(OS_CHROMEOS) | 1163 #if defined(OS_CHROMEOS) |
1148 // Allows authenticator to be invoked without adding refcounting. The instances | 1164 // Allows authenticator to be invoked without adding refcounting. The instances |
1149 // will delete themselves upon completion. | 1165 // will delete themselves upon completion. |
1150 DISABLE_RUNNABLE_METHOD_REFCOUNT(StubLogin); | 1166 DISABLE_RUNNABLE_METHOD_REFCOUNT(StubLogin); |
1151 #endif | 1167 #endif |
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2141 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && | 2157 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && |
2142 (pre_read == "0" || pre_read == "1")) { | 2158 (pre_read == "0" || pre_read == "1")) { |
2143 std::string uma_name(name); | 2159 std::string uma_name(name); |
2144 uma_name += "_PreRead"; | 2160 uma_name += "_PreRead"; |
2145 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; | 2161 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; |
2146 AddPreReadHistogramTime(uma_name.c_str(), time); | 2162 AddPreReadHistogramTime(uma_name.c_str(), time); |
2147 } | 2163 } |
2148 #endif | 2164 #endif |
2149 #endif | 2165 #endif |
2150 } | 2166 } |
OLD | NEW |