summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_main.cc
diff options
context:
space:
mode:
authordavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-30 21:18:51 +0000
committerdavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-30 21:18:51 +0000
commit9acc48601ea4aff4e5ec977c0dd089e887ba5ffd (patch)
tree9c0ef6715ab756b6c8eafb5f4385eaab73a3a8ab /chrome/browser/browser_main.cc
parent8d7690b29c0572c62bbe72817ac3b5195bf38e42 (diff)
downloadchromium_src-9acc48601ea4aff4e5ec977c0dd089e887ba5ffd.zip
chromium_src-9acc48601ea4aff4e5ec977c0dd089e887ba5ffd.tar.gz
chromium_src-9acc48601ea4aff4e5ec977c0dd089e887ba5ffd.tar.bz2
Add -profile command line switch
Review URL: http://codereview.chromium.org/384062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33335 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_main.cc')
-rw-r--r--chrome/browser/browser_main.cc91
1 files changed, 42 insertions, 49 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 28ba351..2b9d0ad 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -567,49 +567,8 @@ int BrowserMain(const MainFunctionParams& parameters) {
// Initialize the shared instance of user data manager.
scoped_ptr<UserDataManager> user_data_manager(UserDataManager::Create());
- // Try to create/load the profile.
- ProfileManager* profile_manager = browser_process->profile_manager();
- Profile* profile = profile_manager->GetDefaultProfile(user_data_dir);
-#if defined(OS_WIN)
- if (!profile) {
- // Ideally, we should be able to run w/o access to disk. For now, we
- // prompt the user to pick a different user-data-dir and restart chrome
- // with the new dir.
- // http://code.google.com/p/chromium/issues/detail?id=11510
- user_data_dir = UserDataDirDialog::RunUserDataDirDialog(user_data_dir);
- if (!parameters.ui_task && browser_shutdown::delete_resources_on_shutdown) {
- // Only delete the resources if we're not running tests. If we're running
- // tests the resources need to be reused as many places in the UI cache
- // SkBitmaps from the ResourceBundle.
- ResourceBundle::CleanupSharedInstance();
- }
-
- if (!user_data_dir.empty()) {
- // Because of the way CommandLine parses, it's sufficient to append a new
- // --user-data-dir switch. The last flag of the same name wins.
- // TODO(tc): It would be nice to remove the flag we don't want, but that
- // sounds risky if we parse differently than CommandLineToArgvW.
- CommandLine new_command_line = parsed_command_line;
- new_command_line.AppendSwitchWithValue(switches::kUserDataDir,
- user_data_dir.ToWStringHack());
- base::LaunchApp(new_command_line, false, false, NULL);
- }
-
- return ResultCodes::NORMAL_EXIT;
- }
-#else
- // TODO(port): fix this. See comments near the definition of
- // user_data_dir. It is better to CHECK-fail here than it is to
- // silently exit because of missing code in the above test.
- CHECK(profile) << "Cannot get default profile.";
-#endif
-
- PrefService* user_prefs = profile->GetPrefs();
- DCHECK(user_prefs);
-
- // Now that local state and user prefs have been loaded, make the two pref
- // services aware of all our preferences.
- browser::RegisterAllPrefs(user_prefs, local_state);
+ // Initialize the prefs of the local state.
+ browser::RegisterLocalState(local_state);
// Now that all preferences have been registered, set the install date
// for the uninstall metrics if this is our first run. This only actually
@@ -654,6 +613,46 @@ int BrowserMain(const MainFunctionParams& parameters) {
}
}
+ // Try to create/load the profile.
+ ProfileManager* profile_manager = browser_process->profile_manager();
+ Profile* profile = profile_manager->GetDefaultProfile(user_data_dir);
+#if defined(OS_WIN)
+ if (!profile) {
+ // Ideally, we should be able to run w/o access to disk. For now, we
+ // prompt the user to pick a different user-data-dir and restart chrome
+ // with the new dir.
+ // http://code.google.com/p/chromium/issues/detail?id=11510
+ user_data_dir = UserDataDirDialog::RunUserDataDirDialog(user_data_dir);
+ if (!parameters.ui_task && browser_shutdown::delete_resources_on_shutdown) {
+ // Only delete the resources if we're not running tests. If we're running
+ // tests the resources need to be reused as many places in the UI cache
+ // SkBitmaps from the ResourceBundle.
+ ResourceBundle::CleanupSharedInstance();
+ }
+
+ if (!user_data_dir.empty()) {
+ // Because of the way CommandLine parses, it's sufficient to append a new
+ // --user-data-dir switch. The last flag of the same name wins.
+ // TODO(tc): It would be nice to remove the flag we don't want, but that
+ // sounds risky if we parse differently than CommandLineToArgvW.
+ CommandLine new_command_line = parsed_command_line;
+ new_command_line.AppendSwitchWithValue(switches::kUserDataDir,
+ user_data_dir.ToWStringHack());
+ base::LaunchApp(new_command_line, false, false, NULL);
+ }
+
+ return ResultCodes::NORMAL_EXIT;
+ }
+#else
+ // TODO(port): fix this. See comments near the definition of
+ // user_data_dir. It is better to CHECK-fail here than it is to
+ // silently exit because of missing code in the above test.
+ CHECK(profile) << "Cannot get default profile.";
+#endif
+
+ PrefService* user_prefs = profile->GetPrefs();
+ DCHECK(user_prefs);
+
// Importing other browser settings is done in a browser-like process
// that exits when this task has finished.
#if defined(OS_WIN)
@@ -872,12 +871,6 @@ int BrowserMain(const MainFunctionParams& parameters) {
HandleTestParameters(parsed_command_line);
Platform::RecordBreakpadStatusUMA(metrics);
- // Start up the extensions service. This should happen before Start().
- profile->InitExtensions();
- // Start up the web resource service. This starts loading data after a
- // short delay so as not to interfere with startup time.
- if (!parsed_command_line.HasSwitch(switches::kDisableWebResources))
- profile->InitWebResources();
#if defined(OS_CHROMEOS)
chromeos::ExternalCookieHandler::GetCookies(parsed_command_line, profile);