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

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: 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
« chrome/browser/ui/browser_init.h ('K') | « 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..2fb57b3cd270e4e582fe395cbcdbb28e7b35ada5 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,30 @@ 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::ProcessCommandLinePostStartup(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();
+ ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, NULL, NULL);
sky 2011/12/07 18:28:55 Seems like you need a if (!profile) NOTREACHED();r
sail 2011/12/07 18:35:01 Done.
+}
« chrome/browser/ui/browser_init.h ('K') | « chrome/browser/ui/browser_init.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698