Chromium Code Reviews| Index: chrome/browser/profiles/profile_manager.cc |
| diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc |
| index e20fe5dc5f977a4a7e078718903f0c74230caa69..056492a477396a9f73ce25cc32632af8f4ecc87d 100644 |
| --- a/chrome/browser/profiles/profile_manager.cc |
| +++ b/chrome/browser/profiles/profile_manager.cc |
| @@ -153,14 +153,17 @@ void QueueProfileDirectoryForDeletion(const FilePath& path) { |
| // launching a new browser window and signing the user in to their Google |
| // account. |
| void OnOpenWindowForNewProfile( |
| + chrome::HostDesktopType desktop_type, |
| const ProfileManager::CreateCallback& callback, |
| Profile* profile, |
| Profile::CreateStatus status) { |
| if (status == Profile::CREATE_STATUS_INITIALIZED) { |
| + |
| ProfileManager::FindOrCreateNewWindowForProfile( |
| profile, |
| chrome::startup::IS_PROCESS_STARTUP, |
| chrome::startup::IS_FIRST_RUN, |
| + desktop_type, |
| false); |
| } |
| if (!callback.is_null()) |
| @@ -274,7 +277,7 @@ ProfileManager::ProfileManager(const FilePath& user_data_dir) |
| if (ProfileShortcutManager::IsFeatureEnabled() && !user_data_dir.empty()) |
| profile_shortcut_manager_.reset(ProfileShortcutManager::Create( |
| - this)); |
| + this)); |
| } |
| ProfileManager::~ProfileManager() { |
| @@ -512,11 +515,12 @@ void ProfileManager::FindOrCreateNewWindowForProfile( |
| Profile* profile, |
| chrome::startup::IsProcessStartup process_startup, |
| chrome::startup::IsFirstRun is_first_run, |
| + chrome::HostDesktopType desktop_type, |
| bool always_create) { |
| DCHECK(profile); |
| if (!always_create) { |
| - Browser* browser = browser::FindTabbedBrowser(profile, false); |
| + Browser* browser = browser::FindTabbedBrowser(profile, false, desktop_type); |
| if (browser) { |
| browser->window()->Activate(); |
| return; |
| @@ -802,7 +806,8 @@ FilePath ProfileManager::GenerateNextProfileDirectoryPath() { |
| void ProfileManager::CreateMultiProfileAsync( |
| const string16& name, |
| const string16& icon_url, |
| - const CreateCallback& callback) { |
| + const CreateCallback& callback, |
| + chrome::HostDesktopType desktop_type) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| @@ -811,8 +816,10 @@ void ProfileManager::CreateMultiProfileAsync( |
| profile_manager->CreateProfileAsync(new_path, |
| base::Bind(&OnOpenWindowForNewProfile, |
| - callback), |
| - name, icon_url); |
| + desktop_type, |
| + callback), |
| + name, |
| + icon_url); |
| } |
| // static |
| @@ -921,7 +928,9 @@ bool ProfileManager::ShouldGoOffTheRecord() { |
| return go_off_the_record; |
| } |
| -void ProfileManager::ScheduleProfileForDeletion(const FilePath& profile_dir) { |
| +void ProfileManager::ScheduleProfileForDeletion( |
| + const FilePath& profile_dir, |
| + chrome::HostDesktopType desktop_type) { |
|
Ben Goodger (Google)
2012/10/03 19:16:56
it's unfortunate to have ProfileManager have to kn
robertshield
2012/10/03 19:58:17
Yeah, that would be much better. ProfileManager re
|
| DCHECK(IsMultipleProfilesEnabled()); |
| // If we're deleting the last profile, then create a new profile in its |
| @@ -930,8 +939,15 @@ void ProfileManager::ScheduleProfileForDeletion(const FilePath& profile_dir) { |
| if (cache.GetNumberOfProfiles() == 1) { |
| FilePath new_path = GenerateNextProfileDirectoryPath(); |
| - CreateProfileAsync(new_path, base::Bind(&OnOpenWindowForNewProfile, |
| - CreateCallback()), string16(), string16()); |
| + // TODO(robertshield): This desktop type needs to come from the invoker, |
| + // currently that involves plumbing this through web UI. |
| + chrome::HostDesktopType desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE; |
| + CreateProfileAsync(new_path, |
| + base::Bind(&OnOpenWindowForNewProfile, |
| + desktop_type, |
| + CreateCallback()), |
| + string16(), |
| + string16()); |
| } |
| // Update the last used profile pref before closing browser windows. This way |