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..3939da1c9991fab9b62636a8e72aaf4b84ade23e 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; |
@@ -798,11 +802,14 @@ FilePath ProfileManager::GenerateNextProfileDirectoryPath() { |
return new_path; |
} |
+// TODO(robertshield): ProfileManager should not be opening windows and should |
+// not have to care about HostDesktopType. See http://crbug.com/153864 |
// static |
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 +818,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 +930,11 @@ bool ProfileManager::ShouldGoOffTheRecord() { |
return go_off_the_record; |
} |
-void ProfileManager::ScheduleProfileForDeletion(const FilePath& profile_dir) { |
+// TODO(robertshield): ProfileManager should not be opening windows and should |
+// not have to care about HostDesktopType. See http://crbug.com/153864 |
+void ProfileManager::ScheduleProfileForDeletion( |
+ const FilePath& profile_dir, |
+ chrome::HostDesktopType desktop_type) { |
DCHECK(IsMultipleProfilesEnabled()); |
// If we're deleting the last profile, then create a new profile in its |
@@ -930,8 +943,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 |