| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser_main.h" | 5 #include "chrome/browser/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 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 | 1198 |
| 1199 // Tests should be able to tune login manager before showing it. | 1199 // Tests should be able to tune login manager before showing it. |
| 1200 // Thus only show login manager in normal (non-testing) mode. | 1200 // Thus only show login manager in normal (non-testing) mode. |
| 1201 if (!parameters.ui_task) { | 1201 if (!parameters.ui_task) { |
| 1202 OptionallyRunChromeOSLoginManager(parsed_command_line); | 1202 OptionallyRunChromeOSLoginManager(parsed_command_line); |
| 1203 } | 1203 } |
| 1204 | 1204 |
| 1205 #if !defined(OS_MACOSX) | 1205 #if !defined(OS_MACOSX) |
| 1206 // Importing other browser settings is done in a browser-like process | 1206 // Importing other browser settings is done in a browser-like process |
| 1207 // that exits when this task has finished. | 1207 // that exits when this task has finished. |
| 1208 // TODO(port): Port to Mac | 1208 // TODO(port): Port the Mac's IPC-based implementation to other platforms to |
| 1209 // replace this implementation. http://crbug.com/22142 |
| 1209 if (parsed_command_line.HasSwitch(switches::kImport) || | 1210 if (parsed_command_line.HasSwitch(switches::kImport) || |
| 1210 parsed_command_line.HasSwitch(switches::kImportFromFile)) { | 1211 parsed_command_line.HasSwitch(switches::kImportFromFile)) { |
| 1211 return FirstRun::ImportNow(profile, parsed_command_line); | 1212 return FirstRun::ImportNow(profile, parsed_command_line); |
| 1212 } | 1213 } |
| 1213 #endif | 1214 #endif |
| 1214 | 1215 |
| 1215 #if defined(OS_WIN) | 1216 #if defined(OS_WIN) |
| 1216 // Do the tasks if chrome has been upgraded while it was last running. | 1217 // Do the tasks if chrome has been upgraded while it was last running. |
| 1217 if (!already_running && Upgrade::DoUpgradeTasks(parsed_command_line)) | 1218 if (!already_running && Upgrade::DoUpgradeTasks(parsed_command_line)) |
| 1218 return ResultCodes::NORMAL_EXIT; | 1219 return ResultCodes::NORMAL_EXIT; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1243 } | 1244 } |
| 1244 #endif | 1245 #endif |
| 1245 | 1246 |
| 1246 // Show the First Run UI if this is the first time Chrome has been run on | 1247 // Show the First Run UI if this is the first time Chrome has been run on |
| 1247 // this computer, or we're being compelled to do so by a command line flag. | 1248 // this computer, or we're being compelled to do so by a command line flag. |
| 1248 // Note that this be done _after_ the PrefService is initialized and all | 1249 // Note that this be done _after_ the PrefService is initialized and all |
| 1249 // preferences are registered, since some of the code that the importer | 1250 // preferences are registered, since some of the code that the importer |
| 1250 // touches reads preferences. | 1251 // touches reads preferences. |
| 1251 if (is_first_run) { | 1252 if (is_first_run) { |
| 1252 if (!first_run_ui_bypass) { | 1253 if (!first_run_ui_bypass) { |
| 1253 #if defined(OS_WIN) || defined(OS_LINUX) | |
| 1254 FirstRun::AutoImport(profile, | 1254 FirstRun::AutoImport(profile, |
| 1255 master_prefs.homepage_defined, | 1255 master_prefs.homepage_defined, |
| 1256 master_prefs.do_import_items, | 1256 master_prefs.do_import_items, |
| 1257 master_prefs.dont_import_items, | 1257 master_prefs.dont_import_items, |
| 1258 master_prefs.run_search_engine_experiment, | 1258 master_prefs.run_search_engine_experiment, |
| 1259 master_prefs.randomize_search_engine_experiment, | 1259 master_prefs.randomize_search_engine_experiment, |
| 1260 master_prefs.make_chrome_default, | 1260 master_prefs.make_chrome_default, |
| 1261 &process_singleton); | 1261 &process_singleton); |
| 1262 #else | |
| 1263 if (!OpenFirstRunDialog(profile, | |
| 1264 master_prefs.homepage_defined, | |
| 1265 master_prefs.do_import_items, | |
| 1266 master_prefs.dont_import_items, | |
| 1267 master_prefs.run_search_engine_experiment, | |
| 1268 master_prefs.randomize_search_engine_experiment, | |
| 1269 &process_singleton)) { | |
| 1270 return ResultCodes::NORMAL_EXIT; | |
| 1271 } | |
| 1272 #endif | |
| 1273 #if defined(OS_POSIX) | 1262 #if defined(OS_POSIX) |
| 1274 // On Windows, the download is tagged with enable/disable stats so there | 1263 // On Windows, the download is tagged with enable/disable stats so there |
| 1275 // is no need for this code. | 1264 // is no need for this code. |
| 1276 | 1265 |
| 1277 // If stats reporting was turned on by the first run dialog then toggle | 1266 // If stats reporting was turned on by the first run dialog then toggle |
| 1278 // the pref. | 1267 // the pref. |
| 1279 if (GoogleUpdateSettings::GetCollectStatsConsent()) | 1268 if (GoogleUpdateSettings::GetCollectStatsConsent()) |
| 1280 local_state->SetBoolean(prefs::kMetricsReportingEnabled, true); | 1269 local_state->SetBoolean(prefs::kMetricsReportingEnabled, true); |
| 1281 #endif // OS_POSIX | 1270 #endif // OS_POSIX |
| 1282 } // if (!first_run_ui_bypass) | 1271 } // if (!first_run_ui_bypass) |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 metrics->Stop(); | 1496 metrics->Stop(); |
| 1508 | 1497 |
| 1509 // browser_shutdown takes care of deleting browser_process, so we need to | 1498 // browser_shutdown takes care of deleting browser_process, so we need to |
| 1510 // release it. | 1499 // release it. |
| 1511 ignore_result(browser_process.release()); | 1500 ignore_result(browser_process.release()); |
| 1512 browser_shutdown::Shutdown(); | 1501 browser_shutdown::Shutdown(); |
| 1513 | 1502 |
| 1514 TRACE_EVENT_END("BrowserMain", 0, 0); | 1503 TRACE_EVENT_END("BrowserMain", 0, 0); |
| 1515 return result_code; | 1504 return result_code; |
| 1516 } | 1505 } |
| OLD | NEW |