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

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

Issue 11572036: Do not load extension system in the Profile import process. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rollback to patchset 10 Created 8 years 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
« no previous file with comments | « no previous file | chrome/browser/extensions/component_loader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 extensions::StartupHelper extension_startup_helper; 420 extensions::StartupHelper extension_startup_helper;
421 extension_startup_helper.UninstallExtension(command_line, profile); 421 extension_startup_helper.UninstallExtension(command_line, profile);
422 return true; 422 return true;
423 } 423 }
424 424
425 StartupBrowserCreator::ProcessCommandLineAlreadyRunning( 425 StartupBrowserCreator::ProcessCommandLineAlreadyRunning(
426 command_line, current_directory); 426 command_line, current_directory);
427 return true; 427 return true;
428 } 428 }
429 429
430 bool HasImportSwitch(const CommandLine& command_line) {
431 return (command_line.HasSwitch(switches::kImport) ||
432 command_line.HasSwitch(switches::kImportFromFile));
433 }
434
435 void LaunchDevToolsHandlerIfNeeded(Profile* profile, 430 void LaunchDevToolsHandlerIfNeeded(Profile* profile,
436 const CommandLine& command_line) { 431 const CommandLine& command_line) {
437 if (command_line.HasSwitch(::switches::kRemoteDebuggingPort)) { 432 if (command_line.HasSwitch(::switches::kRemoteDebuggingPort)) {
438 std::string port_str = 433 std::string port_str =
439 command_line.GetSwitchValueASCII(::switches::kRemoteDebuggingPort); 434 command_line.GetSwitchValueASCII(::switches::kRemoteDebuggingPort);
440 int port; 435 int port;
441 if (base::StringToInt(port_str, &port) && port > 0 && port < 65535) { 436 if (base::StringToInt(port_str, &port) && port > 0 && port < 65535) {
442 std::string frontend_str; 437 std::string frontend_str;
443 if (command_line.HasSwitch(::switches::kRemoteDebuggingFrontend)) { 438 if (command_line.HasSwitch(::switches::kRemoteDebuggingFrontend)) {
444 frontend_str = command_line.GetSwitchValueASCII( 439 frontend_str = command_line.GetSwitchValueASCII(
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 // Android's first run is done in Java instead of native. 684 // Android's first run is done in Java instead of native.
690 #if !defined(OS_ANDROID) 685 #if !defined(OS_ANDROID)
691 process_singleton_.reset(new ProcessSingleton(user_data_dir_)); 686 process_singleton_.reset(new ProcessSingleton(user_data_dir_));
692 // Ensure ProcessSingleton won't process messages too early. It will be 687 // Ensure ProcessSingleton won't process messages too early. It will be
693 // unlocked in PostBrowserStart(). 688 // unlocked in PostBrowserStart().
694 process_singleton_->Lock(NULL); 689 process_singleton_->Lock(NULL);
695 690
696 is_first_run_ = 691 is_first_run_ =
697 (first_run::IsChromeFirstRun() || 692 (first_run::IsChromeFirstRun() ||
698 parsed_command_line().HasSwitch(switches::kFirstRun)) && 693 parsed_command_line().HasSwitch(switches::kFirstRun)) &&
699 !HasImportSwitch(parsed_command_line()); 694 !ProfileManager::IsImportProcess(parsed_command_line());
700 #endif 695 #endif
701 696
702 FilePath local_state_path; 697 FilePath local_state_path;
703 CHECK(PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path)); 698 CHECK(PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path));
704 scoped_refptr<base::SequencedTaskRunner> local_state_task_runner = 699 scoped_refptr<base::SequencedTaskRunner> local_state_task_runner =
705 JsonPrefStore::GetTaskRunnerForFile(local_state_path, 700 JsonPrefStore::GetTaskRunnerForFile(local_state_path,
706 BrowserThread::GetBlockingPool()); 701 BrowserThread::GetBlockingPool());
707 browser_process_.reset(new BrowserProcessImpl(local_state_task_runner, 702 browser_process_.reset(new BrowserProcessImpl(local_state_task_runner,
708 parsed_command_line())); 703 parsed_command_line()));
709 704
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 return chrome::RESULT_CODE_PACK_EXTENSION_ERROR; 1014 return chrome::RESULT_CODE_PACK_EXTENSION_ERROR;
1020 } 1015 }
1021 1016
1022 bool pass_command_line = true; 1017 bool pass_command_line = true;
1023 1018
1024 #if !defined(OS_MACOSX) 1019 #if !defined(OS_MACOSX)
1025 // In environments other than Mac OS X we support import of settings 1020 // In environments other than Mac OS X we support import of settings
1026 // from other browsers. In case this process is a short-lived "import" 1021 // from other browsers. In case this process is a short-lived "import"
1027 // process that another browser runs just to import the settings, we 1022 // process that another browser runs just to import the settings, we
1028 // don't want to be checking for another browser process, by design. 1023 // don't want to be checking for another browser process, by design.
1029 pass_command_line = !HasImportSwitch(parsed_command_line()); 1024 pass_command_line = !ProfileManager::IsImportProcess(parsed_command_line());
1030 #endif 1025 #endif
1031 1026
1032 // If we're being launched just to check the connector policy, we are 1027 // If we're being launched just to check the connector policy, we are
1033 // short-lived and don't want to be passing that switch off. 1028 // short-lived and don't want to be passing that switch off.
1034 pass_command_line = pass_command_line && !parsed_command_line().HasSwitch( 1029 pass_command_line = pass_command_line && !parsed_command_line().HasSwitch(
1035 switches::kCheckCloudPrintConnectorPolicy); 1030 switches::kCheckCloudPrintConnectorPolicy);
1036 1031
1037 if (pass_command_line) { 1032 if (pass_command_line) {
1038 // When another process is running, use that process instead of starting a 1033 // When another process is running, use that process instead of starting a
1039 // new one. NotifyOtherProcess will currently give the other process up to 1034 // new one. NotifyOtherProcess will currently give the other process up to
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 // TODO(rlp): Do this on a separate thread. See http://crbug.com/99075. 1127 // TODO(rlp): Do this on a separate thread. See http://crbug.com/99075.
1133 browser_process_->profile_manager()->AutoloadProfiles(); 1128 browser_process_->profile_manager()->AutoloadProfiles();
1134 #endif 1129 #endif
1135 // Post-profile init --------------------------------------------------------- 1130 // Post-profile init ---------------------------------------------------------
1136 1131
1137 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) 1132 #if !defined(OS_MACOSX) && !defined(OS_ANDROID)
1138 // Importing other browser settings is done in a browser-like process 1133 // Importing other browser settings is done in a browser-like process
1139 // that exits when this task has finished. 1134 // that exits when this task has finished.
1140 // TODO(port): Port the Mac's IPC-based implementation to other platforms to 1135 // TODO(port): Port the Mac's IPC-based implementation to other platforms to
1141 // replace this implementation. http://crbug.com/22142 1136 // replace this implementation. http://crbug.com/22142
1142 if (HasImportSwitch(parsed_command_line())) { 1137 if (ProfileManager::IsImportProcess(parsed_command_line())) {
1143 return first_run::ImportNow(profile_, parsed_command_line()); 1138 return first_run::ImportNow(profile_, parsed_command_line());
1144 } 1139 }
1145 #endif 1140 #endif
1146 1141
1147 #if defined(OS_WIN) 1142 #if defined(OS_WIN)
1148 // Do the tasks if chrome has been upgraded while it was last running. 1143 // Do the tasks if chrome has been upgraded while it was last running.
1149 if (!already_running && upgrade_util::DoUpgradeTasks(parsed_command_line())) 1144 if (!already_running && upgrade_util::DoUpgradeTasks(parsed_command_line()))
1150 return content::RESULT_CODE_NORMAL_EXIT; 1145 return content::RESULT_CODE_NORMAL_EXIT;
1151 1146
1152 // Check if there is any machine level Chrome installed on the current 1147 // Check if there is any machine level Chrome installed on the current
(...skipping 25 matching lines...) Expand all
1178 1173
1179 #if !defined(OS_ANDROID) 1174 #if !defined(OS_ANDROID)
1180 // Show the First Run UI if this is the first time Chrome has been run on 1175 // Show the First Run UI if this is the first time Chrome has been run on
1181 // this computer, or we're being compelled to do so by a command line flag. 1176 // this computer, or we're being compelled to do so by a command line flag.
1182 // Note that this be done _after_ the PrefService is initialized and all 1177 // Note that this be done _after_ the PrefService is initialized and all
1183 // preferences are registered, since some of the code that the importer 1178 // preferences are registered, since some of the code that the importer
1184 // touches reads preferences. 1179 // touches reads preferences.
1185 if (is_first_run_) { 1180 if (is_first_run_) {
1186 PreInteractiveFirstRunInit(); 1181 PreInteractiveFirstRunInit();
1187 1182
1188 if (!first_run_ui_bypass_) { 1183 if (!first_run_ui_bypass_ ||
1184 parsed_command_line().HasSwitch(switches::kFirstRunForceImport)) {
1189 first_run::AutoImport(profile_, 1185 first_run::AutoImport(profile_,
1190 master_prefs_->homepage_defined, 1186 master_prefs_->homepage_defined,
1191 master_prefs_->do_import_items, 1187 master_prefs_->do_import_items,
1192 master_prefs_->dont_import_items, 1188 master_prefs_->dont_import_items,
1193 master_prefs_->make_chrome_default, 1189 master_prefs_->make_chrome_default,
1194 process_singleton_.get()); 1190 process_singleton_.get());
1195 #if defined(OS_POSIX) && !defined(OS_CHROMEOS) 1191 #if defined(OS_POSIX) && !defined(OS_CHROMEOS)
1196 // TODO(thakis): Look into moving this POSIX-specific section to 1192 // TODO(thakis): Look into moving this POSIX-specific section to
1197 // ChromeBrowserMainPartsPosix::PostInteractiveFirstRunInit(). 1193 // ChromeBrowserMainPartsPosix::PostInteractiveFirstRunInit().
1198 1194
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 if (base::win::GetVersion() <= base::win::VERSION_XP) 1661 if (base::win::GetVersion() <= base::win::VERSION_XP)
1666 uma_name += "_XP"; 1662 uma_name += "_XP";
1667 1663
1668 uma_name += "_PreRead_"; 1664 uma_name += "_PreRead_";
1669 uma_name += pre_read_percentage; 1665 uma_name += pre_read_percentage;
1670 AddPreReadHistogramTime(uma_name.c_str(), time); 1666 AddPreReadHistogramTime(uma_name.c_str(), time);
1671 } 1667 }
1672 #endif 1668 #endif
1673 #endif 1669 #endif
1674 } 1670 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/component_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698