| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/login/existing_user_controller.h" | 5 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 ConfigurePublicSessionAutoLogin(); | 221 ConfigurePublicSessionAutoLogin(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void ExistingUserController::UpdateLoginDisplay( | 224 void ExistingUserController::UpdateLoginDisplay( |
| 225 const user_manager::UserList& users) { | 225 const user_manager::UserList& users) { |
| 226 bool show_users_on_signin; | 226 bool show_users_on_signin; |
| 227 user_manager::UserList filtered_users; | 227 user_manager::UserList filtered_users; |
| 228 | 228 |
| 229 cros_settings_->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, | 229 cros_settings_->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, |
| 230 &show_users_on_signin); | 230 &show_users_on_signin); |
| 231 for (user_manager::UserList::const_iterator it = users.begin(); | 231 for (const auto& user : users) { |
| 232 it != users.end(); | 232 // Skip kiosk apps for login screen user list. Kiosk apps as pods (aka new |
| 233 ++it) { | 233 // kiosk UI) is currently disabled and it gets the apps directly from |
| 234 // KioskAppManager. |
| 235 if (user->GetType() == user_manager::USER_TYPE_KIOSK_APP) |
| 236 continue; |
| 237 |
| 234 // TODO(xiyuan): Clean user profile whose email is not in whitelist. | 238 // TODO(xiyuan): Clean user profile whose email is not in whitelist. |
| 235 bool meets_supervised_requirements = | 239 const bool meets_supervised_requirements = |
| 236 (*it)->GetType() != user_manager::USER_TYPE_SUPERVISED || | 240 user->GetType() != user_manager::USER_TYPE_SUPERVISED || |
| 237 user_manager::UserManager::Get()->AreSupervisedUsersAllowed(); | 241 user_manager::UserManager::Get()->AreSupervisedUsersAllowed(); |
| 238 bool meets_whitelist_requirements = | 242 const bool meets_whitelist_requirements = |
| 239 CrosSettings::IsWhitelisted((*it)->email(), nullptr) || | 243 CrosSettings::IsWhitelisted(user->email(), nullptr) || |
| 240 !(*it)->HasGaiaAccount(); | 244 !user->HasGaiaAccount(); |
| 241 | 245 |
| 242 // Public session accounts are always shown on login screen. | 246 // Public session accounts are always shown on login screen. |
| 243 bool meets_show_users_requirements = | 247 const bool meets_show_users_requirements = |
| 244 show_users_on_signin || | 248 show_users_on_signin || |
| 245 (*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT; | 249 user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT; |
| 246 if (meets_supervised_requirements && | 250 if (meets_supervised_requirements && |
| 247 meets_whitelist_requirements && | 251 meets_whitelist_requirements && |
| 248 meets_show_users_requirements) { | 252 meets_show_users_requirements) { |
| 249 filtered_users.push_back(*it); | 253 filtered_users.push_back(user); |
| 250 } | 254 } |
| 251 } | 255 } |
| 252 | 256 |
| 253 // If no user pods are visible, fallback to single new user pod which will | 257 // If no user pods are visible, fallback to single new user pod which will |
| 254 // have guest session link. | 258 // have guest session link. |
| 255 bool show_guest; | 259 bool show_guest; |
| 256 cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &show_guest); | 260 cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &show_guest); |
| 257 show_users_on_signin |= !filtered_users.empty(); | 261 show_users_on_signin |= !filtered_users.empty(); |
| 258 show_guest &= !filtered_users.empty(); | 262 show_guest &= !filtered_users.empty(); |
| 259 bool show_new_user = true; | 263 bool show_new_user = true; |
| (...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 } | 1266 } |
| 1263 | 1267 |
| 1264 // Otherwise, show the unrecoverable cryptohome error UI and ask user's | 1268 // Otherwise, show the unrecoverable cryptohome error UI and ask user's |
| 1265 // permission to collect a feedback. | 1269 // permission to collect a feedback. |
| 1266 RecordPasswordChangeFlow(LOGIN_PASSWORD_CHANGE_FLOW_CRYPTOHOME_FAILURE); | 1270 RecordPasswordChangeFlow(LOGIN_PASSWORD_CHANGE_FLOW_CRYPTOHOME_FAILURE); |
| 1267 VLOG(1) << "Show unrecoverable cryptohome error dialog."; | 1271 VLOG(1) << "Show unrecoverable cryptohome error dialog."; |
| 1268 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); | 1272 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); |
| 1269 } | 1273 } |
| 1270 | 1274 |
| 1271 } // namespace chromeos | 1275 } // namespace chromeos |
| OLD | NEW |