Index: chrome/browser/profiles/profile_window.cc |
diff --git a/chrome/browser/profiles/profile_window.cc b/chrome/browser/profiles/profile_window.cc |
index 8567442161b6cfe068d46456cf5cbd7328f845e3..17ee186fe4af3042a7c6ecb82510d1124cab43ad 100644 |
--- a/chrome/browser/profiles/profile_window.cc |
+++ b/chrome/browser/profiles/profile_window.cc |
@@ -50,7 +50,7 @@ class BrowserAddedForProfileObserver : public chrome::BrowserListObserver { |
public: |
BrowserAddedForProfileObserver( |
Profile* profile, |
- profiles::ProfileSwitchingDoneCallback callback) |
+ ProfileManager::CreateCallback callback) |
: profile_(profile), |
callback_(callback) { |
DCHECK(!callback_.is_null()); |
@@ -64,20 +64,20 @@ class BrowserAddedForProfileObserver : public chrome::BrowserListObserver { |
virtual void OnBrowserAdded(Browser* browser) OVERRIDE { |
if (browser->profile() == profile_) { |
BrowserList::RemoveObserver(this); |
- callback_.Run(); |
+ callback_.Run(profile_, Profile::CREATE_STATUS_ALREADY_CREATED); |
base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
} |
} |
// Profile for which the browser should be opened. |
Profile* profile_; |
- profiles::ProfileSwitchingDoneCallback callback_; |
+ ProfileManager::CreateCallback callback_; |
DISALLOW_COPY_AND_ASSIGN(BrowserAddedForProfileObserver); |
}; |
void OpenBrowserWindowForProfile( |
- profiles::ProfileSwitchingDoneCallback callback, |
+ ProfileManager::CreateCallback callback, |
bool always_create, |
bool is_new_profile, |
chrome::HostDesktopType desktop_type, |
@@ -108,7 +108,7 @@ void OpenBrowserWindowForProfile( |
if (browser) { |
browser->window()->Activate(); |
if (!callback.is_null()) |
- callback.Run(); |
+ callback.Run(profile, Profile::CREATE_STATUS_ALREADY_CREATED); |
return; |
} |
} |
@@ -137,10 +137,12 @@ void OpenBrowserWindowForProfile( |
// Called after a |guest_profile| is available to be used by the user manager. |
// Based on the value of |tutorial_mode| we determine a url to be displayed |
-// by the webui and run the |callback|, if it exists. |
+// by the webui and run the |callback|, if it exists. After opening a profile, |
+// perform |profile_open_action|. |
void OnUserManagerGuestProfileCreated( |
const base::FilePath& profile_path_to_focus, |
profiles::UserManagerTutorialMode tutorial_mode, |
+ profiles::UserManagerProfileSelected profile_open_action, |
const base::Callback<void(Profile*, const std::string&)>& callback, |
Profile* guest_profile, |
Profile::CreateStatus status) { |
@@ -160,8 +162,13 @@ void OnUserManagerGuestProfileCreated( |
page += "#"; |
page += base::IntToString(index); |
} |
+ } else if (profile_open_action == |
+ profiles::USER_MANAGER_SELECT_PROFILE_TASK_MANAGER) { |
+ page += profiles::kUserManagerSelectProfileTaskManager; |
+ } else if (profile_open_action == |
+ profiles::USER_MANAGER_SELECT_PROFILE_ABOUT_CHROME) { |
+ page += profiles::kUserManagerSelectProfileAboutChrome; |
} |
- |
callback.Run(guest_profile, page); |
} |
@@ -178,6 +185,10 @@ void UpdateServicesWithNewProfileManagementFlag(Profile* profile, |
namespace profiles { |
+// User Manager parameters are prefixed with hash. |
+const char kUserManagerSelectProfileTaskManager[] = "#task-manager"; |
+const char kUserManagerSelectProfileAboutChrome[] = "#about-chrome"; |
+ |
void FindOrCreateNewWindowForProfile( |
Profile* profile, |
chrome::startup::IsProcessStartup process_startup, |
@@ -209,7 +220,7 @@ void FindOrCreateNewWindowForProfile( |
void SwitchToProfile(const base::FilePath& path, |
chrome::HostDesktopType desktop_type, |
bool always_create, |
- ProfileSwitchingDoneCallback callback, |
+ ProfileManager::CreateCallback callback, |
ProfileMetrics::ProfileOpen metric) { |
g_browser_process->profile_manager()->CreateProfileAsync( |
path, |
@@ -225,7 +236,7 @@ void SwitchToProfile(const base::FilePath& path, |
} |
void SwitchToGuestProfile(chrome::HostDesktopType desktop_type, |
- ProfileSwitchingDoneCallback callback) { |
+ ProfileManager::CreateCallback callback) { |
g_browser_process->profile_manager()->CreateProfileAsync( |
ProfileManager::GetGuestProfilePath(), |
base::Bind(&OpenBrowserWindowForProfile, |
@@ -240,7 +251,7 @@ void SwitchToGuestProfile(chrome::HostDesktopType desktop_type, |
} |
void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type, |
- ProfileSwitchingDoneCallback callback, |
+ ProfileManager::CreateCallback callback, |
ProfileMetrics::ProfileAdd metric) { |
ProfileInfoCache& cache = |
g_browser_process->profile_manager()->GetProfileInfoCache(); |
@@ -294,6 +305,7 @@ void LockProfile(Profile* profile) { |
void CreateGuestProfileForUserManager( |
const base::FilePath& profile_path_to_focus, |
profiles::UserManagerTutorialMode tutorial_mode, |
+ profiles::UserManagerProfileSelected profile_open_action, |
const base::Callback<void(Profile*, const std::string&)>& callback) { |
// Create the guest profile, if necessary, and open the User Manager |
// from the guest profile. |
@@ -302,6 +314,7 @@ void CreateGuestProfileForUserManager( |
base::Bind(&OnUserManagerGuestProfileCreated, |
profile_path_to_focus, |
tutorial_mode, |
+ profile_open_action, |
callback), |
base::string16(), |
base::string16(), |