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

Unified Diff: chrome/browser/chrome_browser_main.cc

Issue 11968034: Enable profile switching for standalone App Launcher via the Settings App. (Closed) Base URL: git://nomatter.syd/chromium/src.git@master
Patch Set: respond to comments Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
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..6f20cf44693c770631c0a6caa0593b1c771507c9 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,32 @@ PrefService* InitializeLocalState(
return local_state;
}
+FilePath GetStartupProfilePath(const FilePath& user_data_dir,
sky 2013/01/22 23:56:18 Add description.
koz (OOO until 15th September) 2013/01/23 00:07:55 Done.
+ 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))
+ 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 +348,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 +446,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;
}

Powered by Google App Engine
This is Rietveld 408576698