Chromium Code Reviews| 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.
|
| +} |