Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1261)

Unified Diff: chrome/browser/ui/webui/signin/user_manager_screen_handler.cc

Issue 2025433002: MD User Manager: Display error message when all profiles are locked. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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() {

Powered by Google App Engine
This is Rietveld 408576698