| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/screens/user_selection_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> |
| 10 |
| 9 #include "base/location.h" | 11 #include "base/location.h" |
| 10 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/ptr_util.h" |
| 11 #include "base/values.h" | 14 #include "base/values.h" |
| 12 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/browser_process_platform_part.h" | 16 #include "chrome/browser/browser_process_platform_part.h" |
| 14 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 17 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 15 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage.h" | 18 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage.h" |
| 16 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage_factory.h" | 19 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage_factory.h" |
| 17 #include "chrome/browser/chromeos/login/reauth_stats.h" | 20 #include "chrome/browser/chromeos/login/reauth_stats.h" |
| 18 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 21 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 19 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" | 22 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" |
| 20 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 23 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 const AccountId& account_id = (*it)->GetAccountId(); | 389 const AccountId& account_id = (*it)->GetAccountId(); |
| 387 bool is_owner = (account_id == owner); | 390 bool is_owner = (account_id == owner); |
| 388 const bool is_public_account = | 391 const bool is_public_account = |
| 389 ((*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT); | 392 ((*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT); |
| 390 const AuthType initial_auth_type = | 393 const AuthType initial_auth_type = |
| 391 is_public_account ? EXPAND_THEN_USER_CLICK | 394 is_public_account ? EXPAND_THEN_USER_CLICK |
| 392 : (ShouldForceOnlineSignIn(*it) ? ONLINE_SIGN_IN | 395 : (ShouldForceOnlineSignIn(*it) ? ONLINE_SIGN_IN |
| 393 : OFFLINE_PASSWORD); | 396 : OFFLINE_PASSWORD); |
| 394 user_auth_type_map_[account_id] = initial_auth_type; | 397 user_auth_type_map_[account_id] = initial_auth_type; |
| 395 | 398 |
| 396 base::DictionaryValue* user_dict = new base::DictionaryValue(); | 399 auto user_dict = base::MakeUnique<base::DictionaryValue>(); |
| 397 const std::vector<std::string>* public_session_recommended_locales = | 400 const std::vector<std::string>* public_session_recommended_locales = |
| 398 public_session_recommended_locales_.find(account_id) == | 401 public_session_recommended_locales_.find(account_id) == |
| 399 public_session_recommended_locales_.end() | 402 public_session_recommended_locales_.end() |
| 400 ? &kEmptyRecommendedLocales | 403 ? &kEmptyRecommendedLocales |
| 401 : &public_session_recommended_locales_[account_id]; | 404 : &public_session_recommended_locales_[account_id]; |
| 402 FillUserDictionary(*it, | 405 FillUserDictionary(*it, is_owner, is_signin_to_add, initial_auth_type, |
| 403 is_owner, | 406 public_session_recommended_locales, user_dict.get()); |
| 404 is_signin_to_add, | |
| 405 initial_auth_type, | |
| 406 public_session_recommended_locales, | |
| 407 user_dict); | |
| 408 bool signed_in = (*it)->is_logged_in(); | 407 bool signed_in = (*it)->is_logged_in(); |
| 409 | 408 |
| 410 // Single user check here is necessary because owner info might not be | 409 // Single user check here is necessary because owner info might not be |
| 411 // available when running into login screen on first boot. | 410 // available when running into login screen on first boot. |
| 412 // See http://crosbug.com/12723 | 411 // See http://crosbug.com/12723 |
| 413 bool can_remove_user = | 412 bool can_remove_user = |
| 414 ((!single_user || is_enterprise_managed) && account_id.is_valid() && | 413 ((!single_user || is_enterprise_managed) && account_id.is_valid() && |
| 415 !is_owner && !is_public_account && !signed_in && !is_signin_to_add); | 414 !is_owner && !is_public_account && !signed_in && !is_signin_to_add); |
| 416 user_dict->SetBoolean(kKeyCanRemove, can_remove_user); | 415 user_dict->SetBoolean(kKeyCanRemove, can_remove_user); |
| 417 users_list.Append(user_dict); | 416 users_list.Append(std::move(user_dict)); |
| 418 } | 417 } |
| 419 | 418 |
| 420 handler_->LoadUsers(users_list, show_guest_); | 419 handler_->LoadUsers(users_list, show_guest_); |
| 421 } | 420 } |
| 422 | 421 |
| 423 void UserSelectionScreen::HandleGetUsers() { | 422 void UserSelectionScreen::HandleGetUsers() { |
| 424 SendUserList(); | 423 SendUserList(); |
| 425 } | 424 } |
| 426 | 425 |
| 427 void UserSelectionScreen::CheckUserStatus(const AccountId& account_id) { | 426 void UserSelectionScreen::CheckUserStatus(const AccountId& account_id) { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 // The user profile should exist if and only if this is the lock screen. | 568 // The user profile should exist if and only if this is the lock screen. |
| 570 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); | 569 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); |
| 571 | 570 |
| 572 if (!profile) | 571 if (!profile) |
| 573 profile = profile_helper->GetSigninProfile(); | 572 profile = profile_helper->GetSigninProfile(); |
| 574 | 573 |
| 575 return EasyUnlockService::Get(profile); | 574 return EasyUnlockService::Get(profile); |
| 576 } | 575 } |
| 577 | 576 |
| 578 } // namespace chromeos | 577 } // namespace chromeos |
| OLD | NEW |