Chromium Code Reviews| Index: chrome/browser/chrome_browser_main.cc |
| diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc |
| index 558380fd94ea63cc4d32ca309eebc794800e5b1a..be795bdce9942480286182379511dd0fae66e771 100644 |
| --- a/chrome/browser/chrome_browser_main.cc |
| +++ b/chrome/browser/chrome_browser_main.cc |
| @@ -85,6 +85,7 @@ |
| #include "chrome/browser/service/service_process_control.h" |
| #include "chrome/browser/shell_integration.h" |
| #include "chrome/browser/translate/translate_manager.h" |
| +#include "chrome/browser/ui/app_list/app_list_util.h" |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/browser_finder.h" |
| #include "chrome/browser/ui/startup/default_browser_prompt.h" |
| @@ -310,13 +311,34 @@ PrefService* InitializeLocalState( |
| return local_state; |
| } |
| +// Returns the path that contains the profile that should be loaded |
| +// on process startup. |
| +FilePath GetStartupProfilePath(const FilePath& user_data_dir, |
| + const CommandLine& command_line) { |
| +#if defined(OS_CHROMEOS) |
| + // TODO(ivankr): http://crbug.com/83792 |
| + return g_browser_process->profile_manager()->GetDefaultProfileDir( |
| + user_data_dir); |
| +#endif |
| + |
| + if (command_line.HasSwitch(switches::kProfileDirectory)) { |
| + return user_data_dir.Append( |
| + command_line.GetSwitchValuePath(switches::kProfileDirectory)); |
| + } |
| + |
| + if (command_line.HasSwitch(switches::kShowAppList)) |
|
sail
2013/01/23 16:55:24
why this change?
koz (OOO until 15th September)
2013/01/25 00:32:46
If chrome is started with the --show-app-list flag
sail
2013/01/25 18:22:34
This needs a comment.
koz (OOO until 15th September)
2013/01/29 00:34:11
Done.
|
| + return chrome::GetAppListProfilePath(user_data_dir); |
| + |
| + return g_browser_process->profile_manager()->GetLastUsedProfilePath( |
| + user_data_dir); |
| +} |
| + |
| // Initializes the profile, possibly doing some user prompting to pick a |
| // fallback profile. Returns the newly created profile, or NULL if startup |
| // should not continue. |
| Profile* CreateProfile(const content::MainFunctionParams& parameters, |
| const FilePath& user_data_dir, |
| const CommandLine& parsed_command_line) { |
| - Profile* profile; |
| if (ProfileManager::IsMultipleProfilesEnabled() && |
| parsed_command_line.HasSwitch(switches::kProfileDirectory)) { |
| g_browser_process->local_state()->SetString(prefs::kProfileLastUsed, |
| @@ -328,14 +350,11 @@ Profile* CreateProfile(const content::MainFunctionParams& parameters, |
| ListValue* profile_list = update.Get(); |
| profile_list->Clear(); |
| } |
| -#if defined(OS_CHROMEOS) |
| - // TODO(ivankr): http://crbug.com/83792 |
| - profile = g_browser_process->profile_manager()->GetDefaultProfile( |
| - user_data_dir); |
| -#else |
| - profile = g_browser_process->profile_manager()->GetLastUsedProfile( |
| - user_data_dir); |
| -#endif |
| + |
| + FilePath profile_path = |
| + GetStartupProfilePath(user_data_dir, parsed_command_line); |
| + Profile* profile = g_browser_process->profile_manager()->GetProfile( |
| + profile_path); |
| if (profile) |
| return profile; |
| @@ -429,8 +448,13 @@ bool ProcessSingletonNotificationCallback(const CommandLine& command_line, |
| return true; |
| } |
| + FilePath user_data_dir = |
| + g_browser_process->profile_manager()->user_data_dir(); |
| + FilePath startup_profile_dir = |
| + GetStartupProfilePath(user_data_dir, command_line); |
| + |
| StartupBrowserCreator::ProcessCommandLineAlreadyRunning( |
| - command_line, current_directory); |
| + command_line, current_directory, startup_profile_dir); |
| return true; |
| } |