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

Unified Diff: chrome/browser/chrome_browser_main.cc

Issue 12090062: Enable profile switching for standalone App Launcher via the Settings App. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable tests on aura Created 7 years, 10 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
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/extensions/extension_install_ui_default.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_browser_main.cc
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 80835639b48e0d48e8f4879071d89d1d9a2038d1..b0e406b43079d2704a6e6764ede5adb24b7de681 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -92,6 +92,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"
@@ -329,13 +330,32 @@ 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 (command_line.HasSwitch(switches::kProfileDirectory)) {
+ return user_data_dir.Append(
+ command_line.GetSwitchValuePath(switches::kProfileDirectory));
+ }
+
+#if defined(ENABLE_APP_LIST)
+ // If we are showing the app list then chrome isn't shown so load the app
+ // list's profile rather than chrome's.
+ if (command_line.HasSwitch(switches::kShowAppList))
+ return chrome::GetAppListProfilePath(user_data_dir);
+#endif
+
+ return g_browser_process->profile_manager()->GetLastUsedProfileDir(
+ 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,
@@ -347,13 +367,17 @@ Profile* CreateProfile(const content::MainFunctionParams& parameters,
ListValue* profile_list = update.Get();
profile_list->Clear();
}
+
+ Profile* profile = NULL;
#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);
+ FilePath profile_path =
+ GetStartupProfilePath(user_data_dir, parsed_command_line);
+ profile = g_browser_process->profile_manager()->GetProfile(
+ profile_path);
#endif
if (profile)
return profile;
@@ -470,8 +494,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;
}
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/extensions/extension_install_ui_default.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698