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

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

Issue 2637403007: cros: Change max users to be a constant (Closed)
Patch Set: fix test Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_controller_client.h" 5 #include "chrome/browser/ui/ash/session_controller_client.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/public/cpp/session_types.h" 10 #include "ash/public/cpp/session_types.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 UserManager* const user_manager = UserManager::Get(); 163 UserManager* const user_manager = UserManager::Get();
164 if (user_manager->GetUsersAllowedForMultiProfile().empty()) 164 if (user_manager->GetUsersAllowedForMultiProfile().empty())
165 return ash::AddUserSessionPolicy::ERROR_NO_ELIGIBLE_USERS; 165 return ash::AddUserSessionPolicy::ERROR_NO_ELIGIBLE_USERS;
166 166
167 if (chromeos::MultiProfileUserController::GetPrimaryUserPolicy() != 167 if (chromeos::MultiProfileUserController::GetPrimaryUserPolicy() !=
168 chromeos::MultiProfileUserController::ALLOWED) { 168 chromeos::MultiProfileUserController::ALLOWED) {
169 return ash::AddUserSessionPolicy::ERROR_NOT_ALLOWED_PRIMARY_USER; 169 return ash::AddUserSessionPolicy::ERROR_NOT_ALLOWED_PRIMARY_USER;
170 } 170 }
171 171
172 if (UserManager::Get()->GetLoggedInUsers().size() >= 172 if (UserManager::Get()->GetLoggedInUsers().size() >=
173 SessionManager::Get()->GetMaximumNumberOfUserSessions()) 173 session_manager::kMaxmiumNumberOfUserSessions)
174 return ash::AddUserSessionPolicy::ERROR_MAXIMUM_USERS_REACHED; 174 return ash::AddUserSessionPolicy::ERROR_MAXIMUM_USERS_REACHED;
175 175
176 return ash::AddUserSessionPolicy::ALLOWED; 176 return ash::AddUserSessionPolicy::ALLOWED;
177 } 177 }
178 178
179 // static 179 // static
180 void SessionControllerClient::DoLockScreen() { 180 void SessionControllerClient::DoLockScreen() {
181 if (!CanLockScreen()) 181 if (!CanLockScreen())
182 return; 182 return;
183 183
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 ->BindInterface(ash_util::GetAshServiceName(), &session_controller_); 249 ->BindInterface(ash_util::GetAshServiceName(), &session_controller_);
250 250
251 // Set as |session_controller_|'s client. 251 // Set as |session_controller_|'s client.
252 session_controller_->SetClient(binding_.CreateInterfacePtrAndBind()); 252 session_controller_->SetClient(binding_.CreateInterfacePtrAndBind());
253 } 253 }
254 254
255 void SessionControllerClient::SendSessionInfoIfChanged() { 255 void SessionControllerClient::SendSessionInfoIfChanged() {
256 SessionManager* const session_manager = SessionManager::Get(); 256 SessionManager* const session_manager = SessionManager::Get();
257 257
258 ash::mojom::SessionInfoPtr info = ash::mojom::SessionInfo::New(); 258 ash::mojom::SessionInfoPtr info = ash::mojom::SessionInfo::New();
259 info->max_users = session_manager->GetMaximumNumberOfUserSessions();
260 info->can_lock_screen = CanLockScreen(); 259 info->can_lock_screen = CanLockScreen();
261 info->should_lock_screen_automatically = ShouldLockScreenAutomatically(); 260 info->should_lock_screen_automatically = ShouldLockScreenAutomatically();
262 info->add_user_session_policy = GetAddUserSessionPolicy(); 261 info->add_user_session_policy = GetAddUserSessionPolicy();
263 info->state = session_manager->session_state(); 262 info->state = session_manager->session_state();
264 263
265 if (info != last_sent_session_info_) { 264 if (info != last_sent_session_info_) {
266 last_sent_session_info_ = info->Clone(); 265 last_sent_session_info_ = info->Clone();
267 session_controller_->SetSessionInfo(std::move(info)); 266 session_controller_->SetSessionInfo(std::move(info));
268 } 267 }
269 } 268 }
(...skipping 17 matching lines...) Expand all
287 const UserList logged_in_users = user_manager->GetLoggedInUsers(); 286 const UserList logged_in_users = user_manager->GetLoggedInUsers();
288 std::vector<uint32_t> user_session_ids; 287 std::vector<uint32_t> user_session_ids;
289 for (auto* user : user_manager->GetLRULoggedInUsers()) { 288 for (auto* user : user_manager->GetLRULoggedInUsers()) {
290 const uint32_t user_session_id = GetSessionId(*user); 289 const uint32_t user_session_id = GetSessionId(*user);
291 DCHECK_NE(0u, user_session_id); 290 DCHECK_NE(0u, user_session_id);
292 user_session_ids.push_back(user_session_id); 291 user_session_ids.push_back(user_session_id);
293 } 292 }
294 293
295 session_controller_->SetUserSessionOrder(user_session_ids); 294 session_controller_->SetUserSessionOrder(user_session_ids);
296 } 295 }
OLDNEW
« no previous file with comments | « ash/public/interfaces/session_controller.mojom ('k') | chrome/browser/ui/ash/session_state_delegate_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698