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

Unified Diff: ash/system/user/user_view.cc

Issue 560033002: Fixed suggesting adding more users into multi-profile session when we don't have more (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor fix Created 6 years, 3 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: ash/system/user/user_view.cc
diff --git a/ash/system/user/user_view.cc b/ash/system/user/user_view.cc
index 52f128da1a52fd41b6430984cfed08dbb0682306..04d758b4f4026a06d5813f244343e566c6466336 100644
--- a/ash/system/user/user_view.cc
+++ b/ash/system/user/user_view.cc
@@ -499,9 +499,13 @@ void UserView::ToggleAddUserMenuOption() {
bool multi_profile_allowed =
delegate->IsMultiProfileAllowedByPrimaryUserPolicy();
- add_user_disabled_ = (delegate->NumberOfLoggedInUsers() >=
- delegate->GetMaximumNumberOfLoggedInUsers()) ||
- !multi_profile_allowed;
+ int admitted_users_to_be_added =
+ delegate->GetNumberOfUsersAdmittedForMultiProfile();
+ DCHECK(admitted_users_to_be_added >= 0);
+ add_user_disabled_ = !multi_profile_allowed ||
James Cook 2014/09/22 19:52:23 Please change this to add_user_enabled_ and invert
Roman Sorokin (ftl) 2014/09/23 15:42:37 Done.
+ admitted_users_to_be_added == 0 ||
+ (delegate->NumberOfLoggedInUsers() >=
+ delegate->GetMaximumNumberOfLoggedInUsers());
James Cook 2014/09/22 19:52:23 Given that all the data to decide whether or not a
Roman Sorokin (ftl) 2014/09/23 15:42:37 Done.
ButtonFromView* button = new ButtonFromView(
add_user_view,
@@ -519,6 +523,8 @@ void UserView::ToggleAddUserMenuOption() {
int message_id;
if (!multi_profile_allowed)
message_id = IDS_ASH_STATUS_TRAY_MESSAGE_NOT_ALLOWED_PRIMARY_USER;
+ else if (admitted_users_to_be_added == 0)
+ message_id = IDS_ASH_STATUS_TRAY_MESSAGE_OUT_OF_USERS;
else
message_id = IDS_ASH_STATUS_TRAY_MESSAGE_CANNOT_ADD_USER;

Powered by Google App Engine
This is Rietveld 408576698