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

Unified Diff: chrome/browser/ui/browser_init.cc

Issue 8854001: Honor profile directory when creating new window in existing browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser_init.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_init.cc
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc
index 87c15a1a7219f0eab773c6663bcbbc0b0deac488..2b6b291f4b711631e5aa22aefd63c18c05a426da 100644
--- a/chrome/browser/ui/browser_init.cc
+++ b/chrome/browser/ui/browser_init.cc
@@ -47,6 +47,7 @@
#include "chrome/browser/printing/print_dialog_cloud.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_io_data.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
@@ -1496,3 +1497,36 @@ bool BrowserInit::CreateAutomationProvider(const std::string& channel_id,
return true;
}
+
+// static
+void BrowserInit::ProcessCommandLineOnProfileCreated(
+ const CommandLine& cmd_line,
+ const FilePath& cur_dir,
+ Profile* profile,
+ Profile::CreateStatus status) {
+ if (status == Profile::CREATE_STATUS_INITIALIZED)
+ ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, NULL, NULL);
+}
+
+// static
+void BrowserInit::ProcessCommandLineAlreadyRunning(const CommandLine& cmd_line,
+ const FilePath& cur_dir) {
+ if (cmd_line.HasSwitch(switches::kProfileDirectory)) {
+ ProfileManager* profile_manager = g_browser_process->profile_manager();
+ FilePath path = cmd_line.GetSwitchValuePath(switches::kProfileDirectory);
+ path = profile_manager->user_data_dir().Append(path);
+ profile_manager->CreateProfileAsync(path,
+ base::Bind(&BrowserInit::ProcessCommandLineOnProfileCreated,
+ cmd_line, cur_dir));
+ return;
+ }
+
+ Profile* profile = ProfileManager::GetLastUsedProfile();
+ if (!profile) {
+ // We should only be able to get here if the profile already exists and
+ // has been created.
+ NOTREACHED();
+ return;
+ }
+ ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, NULL, NULL);
+}
« no previous file with comments | « chrome/browser/ui/browser_init.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698