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 // TODO(finnur): Get actual brand codes before checking this in. |
| 1088 |
| 1089 // Create a 100% field trial based on the brand code. |
| 1090 //if (LowerCaseEqualsASCII(brand, "xyzw")) { |
| 1091 base::FieldTrialList::CreateFieldTrial(kAutoLaunchTrial_Name, |
| 1092 kAutoLaunchTrial_AutoLaunchGroup); |
| 1093 /* |
| 1094 } else if (LowerCaseEqualsASCII(brand, "xyzz")) { |
| 1095 base::FieldTrialList::CreateFieldTrial(kAutoLaunchTrial_Name, |
| 1096 kAutoLaunchTrial_ControlGroup); |
| 1097 } |
| 1098 */ |
| 1099 } |
| 1100 |
1082 // ChromeBrowserMainParts: |SetupMetricsAndFieldTrials()| related -------------- | 1101 // ChromeBrowserMainParts: |SetupMetricsAndFieldTrials()| related -------------- |
1083 | 1102 |
1084 // Initializes the metrics service with the configuration for this process, | 1103 // Initializes the metrics service with the configuration for this process, |
1085 // returning the created service (guaranteed non-NULL). | 1104 // returning the created service (guaranteed non-NULL). |
1086 MetricsService* ChromeBrowserMainParts::InitializeMetrics( | 1105 MetricsService* ChromeBrowserMainParts::InitializeMetrics( |
1087 const CommandLine& parsed_command_line, | 1106 const CommandLine& parsed_command_line, |
1088 const PrefService* local_state) { | 1107 const PrefService* local_state) { |
1089 #if defined(OS_WIN) | 1108 #if defined(OS_WIN) |
1090 if (parsed_command_line.HasSwitch(switches::kChromeFrame)) | 1109 if (parsed_command_line.HasSwitch(switches::kChromeFrame)) |
1091 MetricsLog::set_version_extension("-F"); | 1110 MetricsLog::set_version_extension("-F"); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 // shoud not be performed. | 1151 // shoud not be performed. |
1133 if (!proxy_policy_is_set) | 1152 if (!proxy_policy_is_set) |
1134 ProxyConnectionsFieldTrial(); | 1153 ProxyConnectionsFieldTrial(); |
1135 prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); | 1154 prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); |
1136 InstantFieldTrial::Activate(); | 1155 InstantFieldTrial::Activate(); |
1137 SpdyFieldTrial(); | 1156 SpdyFieldTrial(); |
1138 ConnectBackupJobsFieldTrial(); | 1157 ConnectBackupJobsFieldTrial(); |
1139 WarmConnectionFieldTrial(); | 1158 WarmConnectionFieldTrial(); |
1140 PredictorFieldTrial(); | 1159 PredictorFieldTrial(); |
1141 DefaultAppsFieldTrial(); | 1160 DefaultAppsFieldTrial(); |
| 1161 AutoLaunchChromeFieldTrial(); |
1142 } | 1162 } |
1143 | 1163 |
1144 // ----------------------------------------------------------------------------- | 1164 // ----------------------------------------------------------------------------- |
1145 // TODO(viettrungluu): move more/rest of BrowserMain() into BrowserMainParts. | 1165 // TODO(viettrungluu): move more/rest of BrowserMain() into BrowserMainParts. |
1146 | 1166 |
1147 #if defined(OS_CHROMEOS) | 1167 #if defined(OS_CHROMEOS) |
1148 // Allows authenticator to be invoked without adding refcounting. The instances | 1168 // Allows authenticator to be invoked without adding refcounting. The instances |
1149 // will delete themselves upon completion. | 1169 // will delete themselves upon completion. |
1150 DISABLE_RUNNABLE_METHOD_REFCOUNT(StubLogin); | 1170 DISABLE_RUNNABLE_METHOD_REFCOUNT(StubLogin); |
1151 #endif | 1171 #endif |
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2141 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && | 2161 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && |
2142 (pre_read == "0" || pre_read == "1")) { | 2162 (pre_read == "0" || pre_read == "1")) { |
2143 std::string uma_name(name); | 2163 std::string uma_name(name); |
2144 uma_name += "_PreRead"; | 2164 uma_name += "_PreRead"; |
2145 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; | 2165 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; |
2146 AddPreReadHistogramTime(uma_name.c_str(), time); | 2166 AddPreReadHistogramTime(uma_name.c_str(), time); |
2147 } | 2167 } |
2148 #endif | 2168 #endif |
2149 #endif | 2169 #endif |
2150 } | 2170 } |
OLD | NEW |