Commit d71e067d authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Chromium LUCI CQ

Revert "[profiles] The profile picker supports the force signin policy"

This reverts commit 9b04f2c2.

Reason for revert: Most likely broke AppControllerProfilePickerBrowserTest.LockedProfileReopenWithNoWindows on Mac 10.11
https://ci.chromium.org/p/chromium/builders/ci/Mac10.11%20Tests/59140

Original change's description:
> [profiles] The profile picker supports the force signin policy
>
> This CL removes the restriction that disables the profile picker if the
> force signin enterprise policy is enabled.
>
> Force signin dialogs will be hosted by the profile picker if the
> corresponding feature is enabled.
>
> Bug: 1156096
> Change-Id: I19ec58afc7a451fbd868eae5e3d8d13899e78719
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2595412
> Reviewed-by: David Roger <droger@chromium.org>
> Commit-Queue: Alex Ilin <alexilin@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#840575}

TBR=droger@chromium.org,alexilin@chromium.org,chromium-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I698a89a9214fd179994706d40ae58498cff4b9c7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1156096
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2611270Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840611}
parent 67ab34e3
...@@ -54,6 +54,9 @@ ProfilePicker::AvailabilityOnStartup GetAvailabilityOnStartup() { ...@@ -54,6 +54,9 @@ ProfilePicker::AvailabilityOnStartup GetAvailabilityOnStartup() {
bool ProfilePicker::ShouldShowAtLaunch() { bool ProfilePicker::ShouldShowAtLaunch() {
AvailabilityOnStartup availability_on_startup = GetAvailabilityOnStartup(); AvailabilityOnStartup availability_on_startup = GetAvailabilityOnStartup();
if (signin_util::IsForceSigninEnabled())
return false;
if (!base::FeatureList::IsEnabled(features::kNewProfilePicker)) if (!base::FeatureList::IsEnabled(features::kNewProfilePicker))
return false; return false;
......
...@@ -324,7 +324,8 @@ bool ShouldShowProfilePickerAtProcessLaunch( ...@@ -324,7 +324,8 @@ bool ShouldShowProfilePickerAtProcessLaunch(
void ShowUserManager(bool is_process_startup) { void ShowUserManager(bool is_process_startup) {
#if !BUILDFLAG(IS_CHROMEOS_ASH) #if !BUILDFLAG(IS_CHROMEOS_ASH)
if (base::FeatureList::IsEnabled(features::kNewProfilePicker)) { if (!signin_util::IsForceSigninEnabled() &&
base::FeatureList::IsEnabled(features::kNewProfilePicker)) {
ProfilePicker::Show( ProfilePicker::Show(
is_process_startup is_process_startup
? ProfilePicker::EntryPoint::kOnStartup ? ProfilePicker::EntryPoint::kOnStartup
......
...@@ -73,7 +73,8 @@ void UserManager::Show( ...@@ -73,7 +73,8 @@ void UserManager::Show(
profiles::UserManagerAction user_manager_action) { profiles::UserManagerAction user_manager_action) {
DCHECK(profile_path_to_focus != ProfileManager::GetGuestProfilePath()); DCHECK(profile_path_to_focus != ProfileManager::GetGuestProfilePath());
if ((user_manager_action == profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION || if (!signin_util::IsForceSigninEnabled() &&
(user_manager_action == profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION ||
user_manager_action == profiles::USER_MANAGER_OPEN_CREATE_USER_PAGE) && user_manager_action == profiles::USER_MANAGER_OPEN_CREATE_USER_PAGE) &&
base::FeatureList::IsEnabled(features::kNewProfilePicker)) { base::FeatureList::IsEnabled(features::kNewProfilePicker)) {
// Use the new profile picker instead. // Use the new profile picker instead.
...@@ -169,10 +170,10 @@ void UserManager::AddOnUserManagerShownCallbackForTesting( ...@@ -169,10 +170,10 @@ void UserManager::AddOnUserManagerShownCallbackForTesting(
// static // static
base::FilePath UserManager::GetSigninProfilePath() { base::FilePath UserManager::GetSigninProfilePath() {
if (g_user_manager_view) if (!g_user_manager_view)
return g_user_manager_view->GetSigninProfilePath(); return base::FilePath();
return ProfilePicker::GetForceSigninProfilePath(); return g_user_manager_view->GetSigninProfilePath();
} }
// UserManagerProfileDialog // UserManagerProfileDialog
...@@ -206,54 +207,34 @@ void UserManagerProfileDialog::ShowUnlockDialogWithProfilePath( ...@@ -206,54 +207,34 @@ void UserManagerProfileDialog::ShowUnlockDialogWithProfilePath(
void UserManagerProfileDialog::ShowForceSigninDialog( void UserManagerProfileDialog::ShowForceSigninDialog(
content::BrowserContext* browser_context, content::BrowserContext* browser_context,
const base::FilePath& profile_path) { const base::FilePath& profile_path) {
if (!UserManager::IsShowing())
return;
GURL url = signin::GetEmbeddedPromoURL( GURL url = signin::GetEmbeddedPromoURL(
signin_metrics::AccessPoint::ACCESS_POINT_USER_MANAGER, signin_metrics::AccessPoint::ACCESS_POINT_USER_MANAGER,
signin_metrics::Reason::REASON_FORCED_SIGNIN_PRIMARY_ACCOUNT, true); signin_metrics::Reason::REASON_FORCED_SIGNIN_PRIMARY_ACCOUNT, true);
if (base::FeatureList::IsEnabled(features::kNewProfilePicker)) {
// Use the new profile picker instead.
ProfilePicker::ShowDialog(browser_context, url, profile_path);
return;
}
if (!UserManager::IsShowing())
return;
g_user_manager_view->ShowDialog(browser_context, url, profile_path); g_user_manager_view->ShowDialog(browser_context, url, profile_path);
} }
void UserManagerProfileDialog::ShowDialogAndDisplayErrorMessage( void UserManagerProfileDialog::ShowDialogAndDisplayErrorMessage(
content::BrowserContext* browser_context) { content::BrowserContext* browser_context) {
GURL url(chrome::kChromeUISigninErrorURL);
if (base::FeatureList::IsEnabled(features::kNewProfilePicker)) {
// Use the new profile picker instead.
ProfilePicker::ShowDialog(browser_context, url, base::FilePath());
return;
}
if (!UserManager::IsShowing()) if (!UserManager::IsShowing())
return; return;
// The error occurred before sign in happened, use an empty profile path // The error occurred before sign in happened, use an empty profile path
// so that the error page will show the error message that is assoicated with // so that the error page will show the error message that is assoicated with
// the system profile. // the system profile.
g_user_manager_view->ShowDialog(browser_context, url, base::FilePath()); g_user_manager_view->ShowDialog(
browser_context, GURL(chrome::kChromeUISigninErrorURL), base::FilePath());
} }
// static // static
void UserManagerProfileDialog::DisplayErrorMessage() { void UserManagerProfileDialog::DisplayErrorMessage() {
ProfilePicker::DisplayErrorMessage(); // This method should only be called if the user manager is already showing.
DCHECK(g_user_manager_view);
if (g_user_manager_view) { g_user_manager_view->DisplayErrorMessage();
g_user_manager_view->DisplayErrorMessage();
}
} }
// static // static
void UserManagerProfileDialog::HideDialog() { void UserManagerProfileDialog::HideDialog() {
// Hide the profile picker dialog, in case it was opened by
// UserManagerProfileDialog::ShowDialog*().
ProfilePicker::HideDialog();
if (g_user_manager_view && g_user_manager_view->GetWidget()->IsVisible()) if (g_user_manager_view && g_user_manager_view->GetWidget()->IsVisible())
g_user_manager_view->HideDialog(); g_user_manager_view->HideDialog();
} }
......
...@@ -26,6 +26,32 @@ ...@@ -26,6 +26,32 @@
namespace webui { namespace webui {
namespace { namespace {
void ShowUserManager(const ProfileManager::CreateCallback& callback) {
if (!UserManager::IsShowing()) {
UserManager::Show(base::FilePath(),
profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION);
}
g_browser_process->profile_manager()->CreateProfileAsync(
ProfileManager::GetSystemProfilePath(), callback, base::string16(),
std::string());
}
std::string GetProfileUserName(Profile* profile) {
ProfileAttributesEntry* entry;
if (!g_browser_process->profile_manager()
->GetProfileAttributesStorage()
.GetProfileAttributesWithPath(profile->GetPath(), &entry))
return std::string();
return base::UTF16ToUTF8(entry->GetUserName());
}
void ShowUnlockDialog(const std::string& user_name,
Profile* system_profile,
Profile::CreateStatus status) {
UserManagerProfileDialog::ShowUnlockDialog(system_profile, user_name);
}
void DeleteProfileCallback(std::unique_ptr<ScopedKeepAlive> keep_alive, void DeleteProfileCallback(std::unique_ptr<ScopedKeepAlive> keep_alive,
Profile* profile) { Profile* profile) {
OpenNewWindowForProfile(profile); OpenNewWindowForProfile(profile);
...@@ -35,16 +61,17 @@ void DeleteProfileCallback(std::unique_ptr<ScopedKeepAlive> keep_alive, ...@@ -35,16 +61,17 @@ void DeleteProfileCallback(std::unique_ptr<ScopedKeepAlive> keep_alive,
void OpenNewWindowForProfile(Profile* profile) { void OpenNewWindowForProfile(Profile* profile) {
if (profiles::IsProfileLocked(profile->GetPath())) { if (profiles::IsProfileLocked(profile->GetPath())) {
DCHECK(signin_util::IsForceSigninEnabled()); // The profile picker does not support locked profiles.
// Displays the UserManager without any sign-in dialog opened. DCHECK(!ProfilePicker::IsOpen());
if (!UserManager::IsShowing() && !ProfilePicker::IsOpen()) {
UserManager::Show(base::FilePath(),
profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION);
}
g_browser_process->profile_manager()->CreateProfileAsync( if (signin_util::IsForceSigninEnabled()) {
ProfileManager::GetSystemProfilePath(), // If force-sign-in policy is enabled, UserManager will be displayed
ProfileManager::CreateCallback(), base::string16(), std::string()); // without any sign-in dialog opened.
ShowUserManager(ProfileManager::CreateCallback());
} else {
ShowUserManager(
base::BindRepeating(&ShowUnlockDialog, GetProfileUserName(profile)));
}
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment