| 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 "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 // available when running into login screen on first boot. | 398 // available when running into login screen on first boot. |
| 399 // See http://crosbug.com/12723 | 399 // See http://crosbug.com/12723 |
| 400 bool can_remove_user = | 400 bool can_remove_user = |
| 401 ((!single_user || is_enterprise_managed) && !user_id.empty() && | 401 ((!single_user || is_enterprise_managed) && !user_id.empty() && |
| 402 !is_owner && !is_public_account && !signed_in && !is_signin_to_add); | 402 !is_owner && !is_public_account && !signed_in && !is_signin_to_add); |
| 403 user_dict->SetBoolean(kKeyCanRemove, can_remove_user); | 403 user_dict->SetBoolean(kKeyCanRemove, can_remove_user); |
| 404 users_list.Append(user_dict); | 404 users_list.Append(user_dict); |
| 405 } | 405 } |
| 406 | 406 |
| 407 handler_->LoadUsers(users_list, show_guest_); | 407 handler_->LoadUsers(users_list, show_guest_); |
| 408 |
| 409 CheckAllUserStatuses(); |
| 408 } | 410 } |
| 409 | 411 |
| 410 void UserSelectionScreen::HandleGetUsers() { | 412 void UserSelectionScreen::HandleGetUsers() { |
| 411 SendUserList(); | 413 SendUserList(); |
| 412 } | 414 } |
| 413 | 415 |
| 414 void UserSelectionScreen::CheckUserStatus(const std::string& user_id) { | 416 bool UserSelectionScreen::CheckUserStatus(const std::string& user_id) { |
| 415 // No checks on lock screen. | 417 // No checks on lock screen. |
| 416 if (ScreenLocker::default_screen_locker()) | 418 if (ScreenLocker::default_screen_locker()) |
| 417 return; | 419 return false; |
| 418 | 420 |
| 419 if (!token_handle_util_.get()) { | 421 if (!token_handle_util_.get()) { |
| 420 token_handle_util_.reset( | 422 token_handle_util_.reset( |
| 421 new TokenHandleUtil(user_manager::UserManager::Get())); | 423 new TokenHandleUtil(user_manager::UserManager::Get())); |
| 422 } | 424 } |
| 423 | 425 |
| 424 if (token_handle_util_->HasToken(user_id)) { | 426 if (token_handle_util_->HasToken(user_id)) { |
| 425 token_handle_util_->CheckToken( | 427 return token_handle_util_->CheckToken( |
| 426 user_id, base::Bind(&UserSelectionScreen::OnUserStatusChecked, | 428 user_id, base::Bind(&UserSelectionScreen::OnUserStatusChecked, |
| 427 weak_factory_.GetWeakPtr())); | 429 weak_factory_.GetWeakPtr())); |
| 428 } | 430 } |
| 431 return false; |
| 432 } |
| 433 |
| 434 void UserSelectionScreen::CheckAllUserStatuses() { |
| 435 const user_manager::UserList& users = GetUsers(); |
| 436 for (const user_manager::User* user : users) { |
| 437 // ignore return value. |
| 438 CheckUserStatus(user->email()); |
| 439 } |
| 429 } | 440 } |
| 430 | 441 |
| 431 void UserSelectionScreen::OnUserStatusChecked( | 442 void UserSelectionScreen::OnUserStatusChecked( |
| 432 const user_manager::UserID& user_id, | 443 const user_manager::UserID& user_id, |
| 433 TokenHandleUtil::TokenHandleStatus status) { | 444 TokenHandleUtil::TokenHandleStatus status) { |
| 434 if (status == TokenHandleUtil::INVALID) { | 445 if (status == TokenHandleUtil::INVALID) { |
| 435 RecordReauthReason(user_id, ReauthReason::INVALID_TOKEN_HANDLE); | 446 RecordReauthReason(user_id, ReauthReason::INVALID_TOKEN_HANDLE); |
| 436 token_handle_util_->MarkHandleInvalid(user_id); | 447 token_handle_util_->MarkHandleInvalid(user_id); |
| 437 SetAuthType(user_id, ONLINE_SIGN_IN, base::string16()); | 448 SetAuthType(user_id, ONLINE_SIGN_IN, base::string16()); |
| 438 } | 449 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 // The user profile should exist if and only if this is the lock screen. | 567 // The user profile should exist if and only if this is the lock screen. |
| 557 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); | 568 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); |
| 558 | 569 |
| 559 if (!profile) | 570 if (!profile) |
| 560 profile = profile_helper->GetSigninProfile(); | 571 profile = profile_helper->GetSigninProfile(); |
| 561 | 572 |
| 562 return EasyUnlockService::Get(profile); | 573 return EasyUnlockService::Get(profile); |
| 563 } | 574 } |
| 564 | 575 |
| 565 } // namespace chromeos | 576 } // namespace chromeos |
| OLD | NEW |