Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Side by Side Diff: chrome/browser/chrome_browser_main.cc

Issue 12670013: Out-of-process import on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: extract some more CLs Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #if defined(TOOLKIT_GTK) 7 #if defined(TOOLKIT_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 // Ensure ProcessSingleton won't process messages too early. It will be 764 // Ensure ProcessSingleton won't process messages too early. It will be
765 // unlocked in PostBrowserStart(). 765 // unlocked in PostBrowserStart().
766 process_singleton_->Lock(NULL); 766 process_singleton_->Lock(NULL);
767 767
768 bool force_first_run = 768 bool force_first_run =
769 parsed_command_line().HasSwitch(switches::kForceFirstRun); 769 parsed_command_line().HasSwitch(switches::kForceFirstRun);
770 bool force_skip_first_run_tasks = 770 bool force_skip_first_run_tasks =
771 (!force_first_run && 771 (!force_first_run &&
772 parsed_command_line().HasSwitch(switches::kNoFirstRun)); 772 parsed_command_line().HasSwitch(switches::kNoFirstRun));
773 773
774 is_first_run = 774 is_first_run = force_first_run || first_run::IsChromeFirstRun();;
tapted 2013/04/24 08:08:35 stray semicolon at end.
gab 2013/04/24 20:24:59 Done.
775 (force_first_run || first_run::IsChromeFirstRun()) &&
776 !ProfileManager::IsImportProcess(parsed_command_line());
777 #endif 775 #endif
778 776
779 scoped_refptr<base::SequencedTaskRunner> local_state_task_runner = 777 scoped_refptr<base::SequencedTaskRunner> local_state_task_runner =
780 JsonPrefStore::GetTaskRunnerForFile( 778 JsonPrefStore::GetTaskRunnerForFile(
781 base::FilePath(chrome::kLocalStorePoolName), 779 base::FilePath(chrome::kLocalStorePoolName),
782 BrowserThread::GetBlockingPool()); 780 BrowserThread::GetBlockingPool());
783 browser_process_.reset(new BrowserProcessImpl(local_state_task_runner, 781 browser_process_.reset(new BrowserProcessImpl(local_state_task_runner,
784 parsed_command_line())); 782 parsed_command_line()));
785 783
786 if (parsed_command_line().HasSwitch(switches::kEnableProfiling)) { 784 if (parsed_command_line().HasSwitch(switches::kEnableProfiling)) {
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 #if !defined(OS_ANDROID) 1102 #if !defined(OS_ANDROID)
1105 // If the command line specifies --pack-extension, attempt the pack extension 1103 // If the command line specifies --pack-extension, attempt the pack extension
1106 // startup action and exit. 1104 // startup action and exit.
1107 if (parsed_command_line().HasSwitch(switches::kPackExtension)) { 1105 if (parsed_command_line().HasSwitch(switches::kPackExtension)) {
1108 extensions::StartupHelper extension_startup_helper; 1106 extensions::StartupHelper extension_startup_helper;
1109 if (extension_startup_helper.PackExtension(parsed_command_line())) 1107 if (extension_startup_helper.PackExtension(parsed_command_line()))
1110 return content::RESULT_CODE_NORMAL_EXIT; 1108 return content::RESULT_CODE_NORMAL_EXIT;
1111 return chrome::RESULT_CODE_PACK_EXTENSION_ERROR; 1109 return chrome::RESULT_CODE_PACK_EXTENSION_ERROR;
1112 } 1110 }
1113 1111
1114 bool pass_command_line = true;
1115
1116 #if !defined(OS_MACOSX)
1117 // In environments other than Mac OS X we support import of settings
1118 // from other browsers. In case this process is a short-lived "import"
1119 // process that another browser runs just to import the settings, we
1120 // don't want to be checking for another browser process, by design.
1121 pass_command_line = !ProfileManager::IsImportProcess(parsed_command_line());
1122 #endif
1123
1124 // If we're being launched just to check the connector policy, we are 1112 // If we're being launched just to check the connector policy, we are
1125 // short-lived and don't want to be passing that switch off. 1113 // short-lived and don't want to be passing that switch off.
1126 pass_command_line = pass_command_line && !parsed_command_line().HasSwitch( 1114 bool pass_command_line = !parsed_command_line().HasSwitch(
1127 switches::kCheckCloudPrintConnectorPolicy); 1115 switches::kCheckCloudPrintConnectorPolicy);
1128 1116
1129 if (pass_command_line) { 1117 if (pass_command_line) {
1130 // When another process is running, use that process instead of starting a 1118 // When another process is running, use that process instead of starting a
1131 // new one. NotifyOtherProcess will currently give the other process up to 1119 // new one. NotifyOtherProcess will currently give the other process up to
1132 // 20 seconds to respond. Note that this needs to be done before we attempt 1120 // 20 seconds to respond. Note that this needs to be done before we attempt
1133 // to read the profile. 1121 // to read the profile.
1134 notify_result_ = process_singleton_->NotifyOtherProcessOrCreate(); 1122 notify_result_ = process_singleton_->NotifyOtherProcessOrCreate();
1135 UMA_HISTOGRAM_ENUMERATION("NotifyOtherProcessOrCreate.Result", 1123 UMA_HISTOGRAM_ENUMERATION("NotifyOtherProcessOrCreate.Result",
1136 notify_result_, 1124 notify_result_,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 if (!profile_) 1206 if (!profile_)
1219 return content::RESULT_CODE_NORMAL_EXIT; 1207 return content::RESULT_CODE_NORMAL_EXIT;
1220 1208
1221 #if defined(ENABLE_BACKGROUND) 1209 #if defined(ENABLE_BACKGROUND)
1222 // Autoload any profiles which are running background apps. 1210 // Autoload any profiles which are running background apps.
1223 // TODO(rlp): Do this on a separate thread. See http://crbug.com/99075. 1211 // TODO(rlp): Do this on a separate thread. See http://crbug.com/99075.
1224 browser_process_->profile_manager()->AutoloadProfiles(); 1212 browser_process_->profile_manager()->AutoloadProfiles();
1225 #endif 1213 #endif
1226 // Post-profile init --------------------------------------------------------- 1214 // Post-profile init ---------------------------------------------------------
1227 1215
1228 #if !defined(OS_MACOSX) && !defined(OS_ANDROID)
1229 // Importing other browser settings is done in a browser-like process
1230 // that exits when this task has finished.
1231 // TODO(port): Port the Mac's IPC-based implementation to other platforms to
1232 // replace this implementation. http://crbug.com/22142
1233 if (ProfileManager::IsImportProcess(parsed_command_line())) {
1234 return first_run::ImportNow(profile_, parsed_command_line());
1235 }
1236 #endif
1237
1238 #if defined(OS_WIN) 1216 #if defined(OS_WIN)
1239 // 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.
1240 if (!already_running && upgrade_util::DoUpgradeTasks(parsed_command_line())) 1218 if (!already_running && upgrade_util::DoUpgradeTasks(parsed_command_line()))
1241 return content::RESULT_CODE_NORMAL_EXIT; 1219 return content::RESULT_CODE_NORMAL_EXIT;
1242 1220
1243 // Check if there is any machine level Chrome installed on the current 1221 // Check if there is any machine level Chrome installed on the current
1244 // machine. If yes and the current Chrome process is user level, we do not 1222 // machine. If yes and the current Chrome process is user level, we do not
1245 // allow the user level Chrome to run. So we notify the user and uninstall 1223 // allow the user level Chrome to run. So we notify the user and uninstall
1246 // user level Chrome. 1224 // user level Chrome.
1247 // Note this check should only happen here, after all the checks above 1225 // Note this check should only happen here, after all the checks above
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 // Show the First Run UI if this is the first time Chrome has been run on 1262 // Show the First Run UI if this is the first time Chrome has been run on
1285 // this computer, or we're being compelled to do so by a command line flag. 1263 // this computer, or we're being compelled to do so by a command line flag.
1286 // Note that this be done _after_ the PrefService is initialized and all 1264 // Note that this be done _after_ the PrefService is initialized and all
1287 // preferences are registered, since some of the code that the importer 1265 // preferences are registered, since some of the code that the importer
1288 // touches reads preferences. 1266 // touches reads preferences.
1289 if (do_first_run_tasks_) { 1267 if (do_first_run_tasks_) {
1290 first_run::AutoImport(profile_, 1268 first_run::AutoImport(profile_,
1291 master_prefs_->homepage_defined, 1269 master_prefs_->homepage_defined,
1292 master_prefs_->do_import_items, 1270 master_prefs_->do_import_items,
1293 master_prefs_->dont_import_items, 1271 master_prefs_->dont_import_items,
1272 master_prefs_->import_bookmarks_path,
1294 process_singleton_.get()); 1273 process_singleton_.get());
1274
1295 // Note: this can pop the first run consent dialog on linux. 1275 // Note: this can pop the first run consent dialog on linux.
1296 first_run::DoPostImportTasks(profile_, master_prefs_->make_chrome_default); 1276 first_run::DoPostImportTasks(profile_, master_prefs_->make_chrome_default);
1297 1277
1298 browser_process_->profile_manager()->OnImportFinished(profile_); 1278 browser_process_->profile_manager()->OnImportFinished(profile_);
1299 1279
1300 if (!master_prefs_->suppress_first_run_default_browser_prompt) { 1280 if (!master_prefs_->suppress_first_run_default_browser_prompt) {
1301 browser_creator_->set_show_main_browser_window( 1281 browser_creator_->set_show_main_browser_window(
1302 !chrome::ShowFirstRunDefaultBrowserPrompt(profile_)); 1282 !chrome::ShowFirstRunDefaultBrowserPrompt(profile_));
1303 } else { 1283 } else {
1304 browser_creator_->set_is_default_browser_dialog_suppressed(true); 1284 browser_creator_->set_is_default_browser_dialog_suppressed(true);
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
1748 if (base::win::GetVersion() <= base::win::VERSION_XP) 1728 if (base::win::GetVersion() <= base::win::VERSION_XP)
1749 uma_name += "_XP"; 1729 uma_name += "_XP";
1750 1730
1751 uma_name += "_PreRead_"; 1731 uma_name += "_PreRead_";
1752 uma_name += pre_read_percentage; 1732 uma_name += pre_read_percentage;
1753 AddPreReadHistogramTime(uma_name.c_str(), time); 1733 AddPreReadHistogramTime(uma_name.c_str(), time);
1754 } 1734 }
1755 #endif 1735 #endif
1756 #endif 1736 #endif
1757 } 1737 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.cc » ('j') | chrome/browser/first_run/first_run.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698