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

Side by Side Diff: chrome/browser/ui/ash/session_state_delegate_chromeos.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: Fixed initialization 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" 5 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h"
6 6
7 #include "ash/multi_profile_uma.h" 7 #include "ash/multi_profile_uma.h"
8 #include "ash/session/session_state_observer.h" 8 #include "ash/session/session_state_observer.h"
9 #include "ash/system/chromeos/multi_user/user_switch_util.h" 9 #include "ash/system/chromeos/multi_user/user_switch_util.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // actually added to a session. 76 // actually added to a session.
77 // TODO(nkostylev): Adjust this limitation based on device capabilites. 77 // TODO(nkostylev): Adjust this limitation based on device capabilites.
78 // http://crbug.com/230865 78 // http://crbug.com/230865
79 return 10; 79 return 10;
80 } 80 }
81 81
82 int SessionStateDelegateChromeos::NumberOfLoggedInUsers() const { 82 int SessionStateDelegateChromeos::NumberOfLoggedInUsers() const {
83 return user_manager::UserManager::Get()->GetLoggedInUsers().size(); 83 return user_manager::UserManager::Get()->GetLoggedInUsers().size();
84 } 84 }
85 85
86 bool SessionStateDelegateChromeos::CanAddUserToMultiProfile(
87 AddUserError* error) const {
88 if (user_manager::UserManager::Get()
89 ->GetUsersAdmittedForMultiProfile()
90 .size() == 0) {
91 if (error)
92 *error = ADD_USER_ERROR_OUT_OF_USERS;
93 return false;
94 }
95 return SessionStateDelegate::CanAddUserToMultiProfile(error);
96 }
97
86 bool SessionStateDelegateChromeos::IsActiveUserSessionStarted() const { 98 bool SessionStateDelegateChromeos::IsActiveUserSessionStarted() const {
87 return user_manager::UserManager::Get()->IsSessionStarted(); 99 return user_manager::UserManager::Get()->IsSessionStarted();
88 } 100 }
89 101
90 bool SessionStateDelegateChromeos::CanLockScreen() const { 102 bool SessionStateDelegateChromeos::CanLockScreen() const {
91 const user_manager::UserList unlock_users = 103 const user_manager::UserList unlock_users =
92 user_manager::UserManager::Get()->GetUnlockUsers(); 104 user_manager::UserManager::Get()->GetUnlockUsers();
93 return !unlock_users.empty(); 105 return !unlock_users.empty();
94 } 106 }
95 107
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 284 }
273 285
274 void DoSwitchUser(const std::string& user_id) { 286 void DoSwitchUser(const std::string& user_id) {
275 user_manager::UserManager::Get()->SwitchActiveUser(user_id); 287 user_manager::UserManager::Get()->SwitchActiveUser(user_id);
276 } 288 }
277 289
278 void SessionStateDelegateChromeos::TryToSwitchUser( 290 void SessionStateDelegateChromeos::TryToSwitchUser(
279 const std::string& user_id) { 291 const std::string& user_id) {
280 ash::TrySwitchingActiveUser(base::Bind(&DoSwitchUser, user_id)); 292 ash::TrySwitchingActiveUser(base::Bind(&DoSwitchUser, user_id));
281 } 293 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698