| 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" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/browser_process_platform_part.h" | 12 #include "chrome/browser/browser_process_platform_part.h" |
| 13 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 13 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 14 #include "chrome/browser/chromeos/login/reauth_stats.h" |
| 14 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 15 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 15 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" | 16 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" |
| 16 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 17 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 17 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 18 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
| 18 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 19 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 19 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 20 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 20 #include "chrome/browser/signin/easy_unlock_service.h" | 21 #include "chrome/browser/signin/easy_unlock_service.h" |
| 21 #include "chrome/browser/signin/proximity_auth_facade.h" | 22 #include "chrome/browser/signin/proximity_auth_facade.h" |
| 22 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 23 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
| 23 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 24 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT; | 230 user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT; |
| 230 | 231 |
| 231 if (is_supervised_user && | 232 if (is_supervised_user && |
| 232 token_status == user_manager::User::OAUTH_TOKEN_STATUS_UNKNOWN) { | 233 token_status == user_manager::User::OAUTH_TOKEN_STATUS_UNKNOWN) { |
| 233 return false; | 234 return false; |
| 234 } | 235 } |
| 235 | 236 |
| 236 if (is_public_session) | 237 if (is_public_session) |
| 237 return false; | 238 return false; |
| 238 | 239 |
| 240 // At this point the reason for invalid token should be already set. If not, |
| 241 // this might be a leftover from an old version. |
| 242 if (token_status == user_manager::User::OAUTH2_TOKEN_STATUS_INVALID) |
| 243 RecordReauthReason(user->email(), ReauthReason::OTHER); |
| 244 |
| 239 return user->force_online_signin() || | 245 return user->force_online_signin() || |
| 240 (token_status == user_manager::User::OAUTH2_TOKEN_STATUS_INVALID) || | 246 (token_status == user_manager::User::OAUTH2_TOKEN_STATUS_INVALID) || |
| 241 (token_status == user_manager::User::OAUTH_TOKEN_STATUS_UNKNOWN); | 247 (token_status == user_manager::User::OAUTH_TOKEN_STATUS_UNKNOWN); |
| 242 } | 248 } |
| 243 | 249 |
| 244 void UserSelectionScreen::SetHandler(LoginDisplayWebUIHandler* handler) { | 250 void UserSelectionScreen::SetHandler(LoginDisplayWebUIHandler* handler) { |
| 245 handler_ = handler; | 251 handler_ = handler; |
| 246 } | 252 } |
| 247 | 253 |
| 248 void UserSelectionScreen::SetView(UserBoardView* view) { | 254 void UserSelectionScreen::SetView(UserBoardView* view) { |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 token_handle_util_->CheckToken( | 425 token_handle_util_->CheckToken( |
| 420 user_id, base::Bind(&UserSelectionScreen::OnUserStatusChecked, | 426 user_id, base::Bind(&UserSelectionScreen::OnUserStatusChecked, |
| 421 weak_factory_.GetWeakPtr())); | 427 weak_factory_.GetWeakPtr())); |
| 422 } | 428 } |
| 423 } | 429 } |
| 424 | 430 |
| 425 void UserSelectionScreen::OnUserStatusChecked( | 431 void UserSelectionScreen::OnUserStatusChecked( |
| 426 const user_manager::UserID& user_id, | 432 const user_manager::UserID& user_id, |
| 427 TokenHandleUtil::TokenHandleStatus status) { | 433 TokenHandleUtil::TokenHandleStatus status) { |
| 428 if (status == TokenHandleUtil::INVALID) { | 434 if (status == TokenHandleUtil::INVALID) { |
| 435 RecordReauthReason(user_id, ReauthReason::INVALID_TOKEN_HANDLE); |
| 429 user_manager::UserManager::Get()->SaveUserOAuthStatus( | 436 user_manager::UserManager::Get()->SaveUserOAuthStatus( |
| 430 user_id, user_manager::User::OAUTH2_TOKEN_STATUS_INVALID); | 437 user_id, user_manager::User::OAUTH2_TOKEN_STATUS_INVALID); |
| 431 token_handle_util_->DeleteToken(user_id); | 438 token_handle_util_->DeleteToken(user_id); |
| 432 SetAuthType(user_id, ONLINE_SIGN_IN, base::string16()); | 439 SetAuthType(user_id, ONLINE_SIGN_IN, base::string16()); |
| 433 } | 440 } |
| 434 } | 441 } |
| 435 | 442 |
| 436 // EasyUnlock stuff | 443 // EasyUnlock stuff |
| 437 | 444 |
| 438 void UserSelectionScreen::SetAuthType(const std::string& user_id, | 445 void UserSelectionScreen::SetAuthType(const std::string& user_id, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 // The user profile should exist if and only if this is the lock screen. | 558 // The user profile should exist if and only if this is the lock screen. |
| 552 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); | 559 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); |
| 553 | 560 |
| 554 if (!profile) | 561 if (!profile) |
| 555 profile = profile_helper->GetSigninProfile(); | 562 profile = profile_helper->GetSigninProfile(); |
| 556 | 563 |
| 557 return EasyUnlockService::Get(profile); | 564 return EasyUnlockService::Get(profile); |
| 558 } | 565 } |
| 559 | 566 |
| 560 } // namespace chromeos | 567 } // namespace chromeos |
| OLD | NEW |