| 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 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 } | 1053 } |
| 1054 #endif | 1054 #endif |
| 1055 | 1055 |
| 1056 // Show the First Run UI if this is the first time Chrome has been run on | 1056 // Show the First Run UI if this is the first time Chrome has been run on |
| 1057 // this computer, or we're being compelled to do so by a command line flag. | 1057 // this computer, or we're being compelled to do so by a command line flag. |
| 1058 // Note that this be done _after_ the PrefService is initialized and all | 1058 // Note that this be done _after_ the PrefService is initialized and all |
| 1059 // preferences are registered, since some of the code that the importer | 1059 // preferences are registered, since some of the code that the importer |
| 1060 // touches reads preferences. | 1060 // touches reads preferences. |
| 1061 if (is_first_run) { | 1061 if (is_first_run) { |
| 1062 if (!first_run_ui_bypass) { | 1062 if (!first_run_ui_bypass) { |
| 1063 #if defined(OS_WIN) |
| 1064 FirstRun::AutoImport(profile, |
| 1065 master_prefs.homepage_defined, |
| 1066 master_prefs.do_import_items, |
| 1067 master_prefs.dont_import_items, |
| 1068 master_prefs.run_search_engine_experiment, |
| 1069 master_prefs.randomize_search_engine_experiment, |
| 1070 &process_singleton); |
| 1071 #else |
| 1063 if (!OpenFirstRunDialog(profile, | 1072 if (!OpenFirstRunDialog(profile, |
| 1064 master_prefs.homepage_defined, | 1073 master_prefs.homepage_defined, |
| 1065 master_prefs.do_import_items, | 1074 master_prefs.do_import_items, |
| 1066 master_prefs.dont_import_items, | 1075 master_prefs.dont_import_items, |
| 1067 master_prefs.run_search_engine_experiment, | 1076 master_prefs.run_search_engine_experiment, |
| 1068 master_prefs.randomize_search_engine_experiment, | 1077 master_prefs.randomize_search_engine_experiment, |
| 1069 &process_singleton)) { | 1078 &process_singleton)) { |
| 1070 // The user cancelled the first run dialog box, we should exit Chrome. | |
| 1071 return ResultCodes::NORMAL_EXIT; | 1079 return ResultCodes::NORMAL_EXIT; |
| 1072 } | 1080 } |
| 1081 #endif |
| 1073 #if defined(OS_POSIX) | 1082 #if defined(OS_POSIX) |
| 1074 // On Windows, the download is tagged with enable/disable stats so there | 1083 // On Windows, the download is tagged with enable/disable stats so there |
| 1075 // is no need for this code. | 1084 // is no need for this code. |
| 1076 | 1085 |
| 1077 // If stats reporting was turned on by the first run dialog then toggle | 1086 // If stats reporting was turned on by the first run dialog then toggle |
| 1078 // the pref. | 1087 // the pref. |
| 1079 if (GoogleUpdateSettings::GetCollectStatsConsent()) | 1088 if (GoogleUpdateSettings::GetCollectStatsConsent()) |
| 1080 local_state->SetBoolean(prefs::kMetricsReportingEnabled, true); | 1089 local_state->SetBoolean(prefs::kMetricsReportingEnabled, true); |
| 1081 #endif // OS_POSIX | 1090 #endif // OS_POSIX |
| 1082 } | 1091 } // if (!first_run_ui_bypass) |
| 1083 | 1092 |
| 1084 Browser::SetNewHomePagePrefs(user_prefs); | 1093 Browser::SetNewHomePagePrefs(user_prefs); |
| 1085 } | 1094 } |
| 1086 | 1095 |
| 1087 // Sets things up so that if we crash from this point on, a dialog will | 1096 // Sets things up so that if we crash from this point on, a dialog will |
| 1088 // popup asking the user to restart chrome. It is done this late to avoid | 1097 // popup asking the user to restart chrome. It is done this late to avoid |
| 1089 // testing against a bunch of special cases that are taken care early on. | 1098 // testing against a bunch of special cases that are taken care early on. |
| 1090 PrepareRestartOnCrashEnviroment(parsed_command_line); | 1099 PrepareRestartOnCrashEnviroment(parsed_command_line); |
| 1091 | 1100 |
| 1092 // Initialize and maintain network predictor module, which handles DNS | 1101 // Initialize and maintain network predictor module, which handles DNS |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 | 1303 |
| 1295 metrics->Stop(); | 1304 metrics->Stop(); |
| 1296 | 1305 |
| 1297 // browser_shutdown takes care of deleting browser_process, so we need to | 1306 // browser_shutdown takes care of deleting browser_process, so we need to |
| 1298 // release it. | 1307 // release it. |
| 1299 ignore_result(browser_process.release()); | 1308 ignore_result(browser_process.release()); |
| 1300 browser_shutdown::Shutdown(); | 1309 browser_shutdown::Shutdown(); |
| 1301 | 1310 |
| 1302 return result_code; | 1311 return result_code; |
| 1303 } | 1312 } |
| OLD | NEW |