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