Chromium Code Reviews| Index: chrome/browser/ui/webui/signin/signin_create_profile_handler.cc |
| diff --git a/chrome/browser/ui/webui/signin/signin_create_profile_handler.cc b/chrome/browser/ui/webui/signin/signin_create_profile_handler.cc |
| index 78ede5e0f759f853f998328fa3a72a4e536c2d6c..cb384ec4b40d5b79c39713fc68e7ad4ce5ddb5a6 100644 |
| --- a/chrome/browser/ui/webui/signin/signin_create_profile_handler.cc |
| +++ b/chrome/browser/ui/webui/signin/signin_create_profile_handler.cc |
| @@ -31,6 +31,7 @@ |
| #include "chrome/browser/ui/browser_finder.h" |
| #include "chrome/browser/ui/user_manager.h" |
| #include "chrome/browser/ui/webui/profile_helper.h" |
| +#include "chrome/browser/ui/webui/signin/signin_utils.h" |
| #include "chrome/common/pref_names.h" |
| #include "chrome/common/url_constants.h" |
| #include "chrome/grit/chromium_strings.h" |
| @@ -366,7 +367,8 @@ void SigninCreateProfileHandler::CreateShortcutAndShowSuccess( |
| dict.SetString("name", profile->GetPrefs()->GetString(prefs::kProfileName)); |
| dict.Set("filePath", base::CreateFilePathValue(profile->GetPath())); |
| - bool open_new_window = true; |
| + bool is_force_signin_enabled = signin::IsForceSigninEnabled(); |
| + bool open_new_window = !is_force_signin_enabled; |
| #if defined(ENABLE_SUPERVISED_USERS) |
| // If the new profile is a supervised user, instead of opening a new window |
| @@ -374,8 +376,12 @@ void SigninCreateProfileHandler::CreateShortcutAndShowSuccess( |
| // dialog. If we are importing an existing supervised profile or creating a |
| // new non-supervised user profile we don't show any confirmation, so open |
| // the new window now. |
| - open_new_window = profile_creation_type_ != SUPERVISED_PROFILE_CREATION; |
| - dict.SetBoolean("showConfirmation", !open_new_window); |
| + |
| + open_new_window = |
| + open_new_window && profile_creation_type_ != SUPERVISED_PROFILE_CREATION; |
| + |
| + dict.SetBoolean("showConfirmation", |
| + profile_creation_type_ == SUPERVISED_PROFILE_CREATION); |
| bool is_supervised = profile_creation_type_ == SUPERVISED_PROFILE_CREATION || |
| profile_creation_type_ == SUPERVISED_PROFILE_IMPORT; |
| @@ -398,6 +404,8 @@ void SigninCreateProfileHandler::CreateShortcutAndShowSuccess( |
| // Opening the new window must be the last action, after all callbacks |
| // have been run, to give them a chance to initialize the profile. |
| OpenNewWindowForProfile(profile, Profile::CREATE_STATUS_INITIALIZED); |
| + } else if (is_force_signin_enabled) { |
| + OpenSigninDialogForProfile(profile); |
| } |
| profile_creation_type_ = NO_CREATION_IN_PROGRESS; |
| } |
| @@ -414,6 +422,14 @@ void SigninCreateProfileHandler::OpenNewWindowForProfile( |
| status); |
| } |
| +void SigninCreateProfileHandler::OpenSigninDialogForProfile(Profile* profile) { |
| +// TODO(zmin): Remove the swither once the UserManager API is finished on Mac. |
|
anthonyvd
2016/09/30 17:30:15
nit: typo in "swither"
zmin
2016/09/30 17:41:48
Done.
|
| +#if !defined(OS_MACOSX) |
| + UserManager::ShowSigninDialog(web_ui()->GetWebContents()->GetBrowserContext(), |
| + profile->GetPath()); |
| +#endif |
| +} |
| + |
| void SigninCreateProfileHandler::ShowProfileCreationError( |
| Profile* profile, |
| const base::string16& error) { |