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

Side by Side Diff: chrome/browser/ui/ash/session_state_delegate_chromeos.cc

Issue 2512693003: ash: Replace SessionStateDelegate::CanAddUserToMultiProfile (Closed)
Patch Set: for #2 Created 4 years, 1 month 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/aura/wm_window_aura.h" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/session/session_state_observer.h" 8 #include "ash/common/session/session_state_observer.h"
9 #include "ash/content/shell_content_state.h" 9 #include "ash/content/shell_content_state.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // actually added to a session. 70 // actually added to a session.
71 // TODO(nkostylev): Adjust this limitation based on device capabilites. 71 // TODO(nkostylev): Adjust this limitation based on device capabilites.
72 // http://crbug.com/230865 72 // http://crbug.com/230865
73 return 10; 73 return 10;
74 } 74 }
75 75
76 int SessionStateDelegateChromeos::NumberOfLoggedInUsers() const { 76 int SessionStateDelegateChromeos::NumberOfLoggedInUsers() const {
77 return user_manager::UserManager::Get()->GetLoggedInUsers().size(); 77 return user_manager::UserManager::Get()->GetLoggedInUsers().size();
78 } 78 }
79 79
80 bool SessionStateDelegateChromeos::CanAddUserToMultiProfile( 80 ash::AddUserSessionPolicy
81 AddUserError* error) const { 81 SessionStateDelegateChromeos::GetAddUserSessionPolicy() const {
82 if (user_manager::UserManager::Get() 82 if (user_manager::UserManager::Get()
83 ->GetUsersAllowedForMultiProfile() 83 ->GetUsersAllowedForMultiProfile()
84 .size() == 0) { 84 .size() == 0) {
85 if (error) 85 return ash::AddUserSessionPolicy::ERROR_NO_ELIGIBLE_USERS;
86 *error = ADD_USER_ERROR_OUT_OF_USERS;
87 return false;
88 } 86 }
89 return SessionStateDelegate::CanAddUserToMultiProfile(error); 87 return SessionStateDelegate::GetAddUserSessionPolicy();
90 } 88 }
91 89
92 bool SessionStateDelegateChromeos::IsActiveUserSessionStarted() const { 90 bool SessionStateDelegateChromeos::IsActiveUserSessionStarted() const {
93 return session_manager::SessionManager::Get() && 91 return session_manager::SessionManager::Get() &&
94 session_manager::SessionManager::Get()->IsSessionStarted(); 92 session_manager::SessionManager::Get()->IsSessionStarted();
95 } 93 }
96 94
97 bool SessionStateDelegateChromeos::CanLockScreen() const { 95 bool SessionStateDelegateChromeos::CanLockScreen() const {
98 const user_manager::UserList unlock_users = 96 const user_manager::UserList unlock_users =
99 user_manager::UserManager::Get()->GetUnlockUsers(); 97 user_manager::UserManager::Get()->GetUnlockUsers();
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 281 }
284 282
285 void DoSwitchUser(const AccountId& account_id) { 283 void DoSwitchUser(const AccountId& account_id) {
286 user_manager::UserManager::Get()->SwitchActiveUser(account_id); 284 user_manager::UserManager::Get()->SwitchActiveUser(account_id);
287 } 285 }
288 286
289 void SessionStateDelegateChromeos::TryToSwitchUser( 287 void SessionStateDelegateChromeos::TryToSwitchUser(
290 const AccountId& account_id) { 288 const AccountId& account_id) {
291 TrySwitchingActiveUser(base::Bind(&DoSwitchUser, account_id)); 289 TrySwitchingActiveUser(base::Bind(&DoSwitchUser, account_id));
292 } 290 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698