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 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 // Create a 100% field trial based on the brand code. | 1087 // Create a 100% field trial based on the brand code. |
1087 if (LowerCaseEqualsASCII(brand, "ecdb")) { | 1088 if (LowerCaseEqualsASCII(brand, "ecdb")) { |
1088 base::FieldTrialList::CreateFieldTrial(kDefaultAppsTrial_Name, | 1089 base::FieldTrialList::CreateFieldTrial(kDefaultAppsTrial_Name, |
1089 kDefaultAppsTrial_NoAppsGroup); | 1090 kDefaultAppsTrial_NoAppsGroup); |
1090 } else if (LowerCaseEqualsASCII(brand, "ecda")) { | 1091 } else if (LowerCaseEqualsASCII(brand, "ecda")) { |
1091 base::FieldTrialList::CreateFieldTrial(kDefaultAppsTrial_Name, | 1092 base::FieldTrialList::CreateFieldTrial(kDefaultAppsTrial_Name, |
1092 kDefaultAppsTrial_WithAppsGroup); | 1093 kDefaultAppsTrial_WithAppsGroup); |
1093 } | 1094 } |
1094 } | 1095 } |
1095 | 1096 |
| 1097 void ChromeBrowserMainParts::AutoLaunchChromeFieldTrial() { |
| 1098 std::string brand; |
| 1099 google_util::GetBrand(&brand); |
| 1100 |
| 1101 // Create a 100% field trial based on the brand code. |
| 1102 if (LowerCaseEqualsASCII(brand, "rngp")) { |
| 1103 base::FieldTrialList::CreateFieldTrial(kAutoLaunchTrialName, |
| 1104 kAutoLaunchTrialAutoLaunchGroup); |
| 1105 } else if (LowerCaseEqualsASCII(brand, "rngq")) { |
| 1106 base::FieldTrialList::CreateFieldTrial(kAutoLaunchTrialName, |
| 1107 kAutoLaunchTrialControlGroup); |
| 1108 } |
| 1109 } |
| 1110 |
1096 // ChromeBrowserMainParts: |SetupMetricsAndFieldTrials()| related -------------- | 1111 // ChromeBrowserMainParts: |SetupMetricsAndFieldTrials()| related -------------- |
1097 | 1112 |
1098 // Initializes the metrics service with the configuration for this process, | 1113 // Initializes the metrics service with the configuration for this process, |
1099 // returning the created service (guaranteed non-NULL). | 1114 // returning the created service (guaranteed non-NULL). |
1100 MetricsService* ChromeBrowserMainParts::InitializeMetrics( | 1115 MetricsService* ChromeBrowserMainParts::InitializeMetrics( |
1101 const CommandLine& parsed_command_line, | 1116 const CommandLine& parsed_command_line, |
1102 const PrefService* local_state) { | 1117 const PrefService* local_state) { |
1103 #if defined(OS_WIN) | 1118 #if defined(OS_WIN) |
1104 if (parsed_command_line.HasSwitch(switches::kChromeFrame)) | 1119 if (parsed_command_line.HasSwitch(switches::kChromeFrame)) |
1105 MetricsLog::set_version_extension("-F"); | 1120 MetricsLog::set_version_extension("-F"); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 // shoud not be performed. | 1161 // shoud not be performed. |
1147 if (!proxy_policy_is_set) | 1162 if (!proxy_policy_is_set) |
1148 ProxyConnectionsFieldTrial(); | 1163 ProxyConnectionsFieldTrial(); |
1149 prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); | 1164 prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); |
1150 InstantFieldTrial::Activate(); | 1165 InstantFieldTrial::Activate(); |
1151 SpdyFieldTrial(); | 1166 SpdyFieldTrial(); |
1152 ConnectBackupJobsFieldTrial(); | 1167 ConnectBackupJobsFieldTrial(); |
1153 WarmConnectionFieldTrial(); | 1168 WarmConnectionFieldTrial(); |
1154 PredictorFieldTrial(); | 1169 PredictorFieldTrial(); |
1155 DefaultAppsFieldTrial(); | 1170 DefaultAppsFieldTrial(); |
| 1171 AutoLaunchChromeFieldTrial(); |
1156 sync_promo_trial::Activate(); | 1172 sync_promo_trial::Activate(); |
1157 } | 1173 } |
1158 | 1174 |
1159 // ----------------------------------------------------------------------------- | 1175 // ----------------------------------------------------------------------------- |
1160 // TODO(viettrungluu): move more/rest of BrowserMain() into BrowserMainParts. | 1176 // TODO(viettrungluu): move more/rest of BrowserMain() into BrowserMainParts. |
1161 | 1177 |
1162 #if defined(OS_CHROMEOS) | 1178 #if defined(OS_CHROMEOS) |
1163 // Allows authenticator to be invoked without adding refcounting. The instances | 1179 // Allows authenticator to be invoked without adding refcounting. The instances |
1164 // will delete themselves upon completion. | 1180 // will delete themselves upon completion. |
1165 DISABLE_RUNNABLE_METHOD_REFCOUNT(StubLogin); | 1181 DISABLE_RUNNABLE_METHOD_REFCOUNT(StubLogin); |
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2155 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && | 2171 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && |
2156 (pre_read == "0" || pre_read == "1")) { | 2172 (pre_read == "0" || pre_read == "1")) { |
2157 std::string uma_name(name); | 2173 std::string uma_name(name); |
2158 uma_name += "_PreRead"; | 2174 uma_name += "_PreRead"; |
2159 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; | 2175 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; |
2160 AddPreReadHistogramTime(uma_name.c_str(), time); | 2176 AddPreReadHistogramTime(uma_name.c_str(), time); |
2161 } | 2177 } |
2162 #endif | 2178 #endif |
2163 #endif | 2179 #endif |
2164 } | 2180 } |
OLD | NEW |