Chromium Code Reviews| Index: chrome/browser/ui/webui/signin/user_manager_screen_handler.cc |
| diff --git a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc |
| index 9fef1a147ed3dc52f8e0e4e4d5052785e3c128f4..a2c676037ad19a2cffb3f30a5fea528d9873a8af 100644 |
| --- a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc |
| +++ b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc |
| @@ -374,7 +374,8 @@ void UserManagerScreenHandler::HandleInitialize(const base::ListValue* args) { |
| SendUserList(); |
| web_ui()->CallJavascriptFunction("cr.ui.UserManager.showUserManagerScreen", |
| base::FundamentalValue(IsGuestModeEnabled()), |
| - base::FundamentalValue(IsAddPersonEnabled())); |
| + base::FundamentalValue(IsAddPersonEnabled()), |
| + base::FundamentalValue(profiles::AreAllProfilesLocked())); |
| proximity_auth::ScreenlockBridge::Get()->SetLockHandler(this); |
| } |
| @@ -465,6 +466,14 @@ void UserManagerScreenHandler::HandleRemoveUser(const base::ListValue* args) { |
| DCHECK(profiles::IsMultipleProfilesEnabled()); |
| + if (profiles::AreAllProfilesLocked()) { |
| + web_ui()->CallJavascriptFunction( |
| + "cr.ui.UserManager.showErrorDialog", |
| + base::StringValue(l10n_util::GetStringUTF8( |
| + IDS_USER_MANAGER_REMOVE_PROFILE_PROFILES_LOCKED_ERROR))); |
| + return; |
| + } |
| + |
| // The callback is run if the only profile has been deleted, and a new |
| // profile has been created to replace it. |
| webui::DeleteProfileAtPath(profile_path, |
| @@ -474,6 +483,13 @@ void UserManagerScreenHandler::HandleRemoveUser(const base::ListValue* args) { |
| void UserManagerScreenHandler::HandleLaunchGuest(const base::ListValue* args) { |
| if (IsGuestModeEnabled()) { |
| + if (profiles::AreAllProfilesLocked()) { |
| + web_ui()->CallJavascriptFunction( |
| + "cr.ui.UserManager.showErrorDialog", |
|
dpapad
2016/05/27 23:59:42
Makes me sad that we are calling JS methods by nam
Moe
2016/05/30 18:33:06
My bad. I do use WebUI events and the browser prox
|
| + base::StringValue(l10n_util::GetStringUTF8( |
| + IDS_USER_MANAGER_GO_GUEST_PROFILES_LOCKED_ERROR))); |
| + return; |
| + } |
| profiles::SwitchToGuestProfile( |
| base::Bind(&UserManagerScreenHandler::OnSwitchToProfileComplete, |
| weak_ptr_factory_.GetWeakPtr())); |
| @@ -826,6 +842,11 @@ void UserManagerScreenHandler::GetLocalizedValues( |
| base::string16()); |
| localized_strings->SetString("multiProfilesOwnerPrimaryOnlyMsg", |
| base::string16()); |
| + |
| + // Error message when trying to add a profile while all profiles are locked. |
| + localized_strings->SetString("AddProfileAllProfilesLockedError", |
| + l10n_util::GetStringUTF16( |
| + IDS_USER_MANAGER_ADD_PROFILE_PROFILES_LOCKED_ERROR)); |
| } |
| void UserManagerScreenHandler::SendUserList() { |