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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 service->SetHardlockState(EasyUnlockScreenlockStateHandler::USER_HARDLOCK); | 464 service->SetHardlockState(EasyUnlockScreenlockStateHandler::USER_HARDLOCK); |
465 } | 465 } |
466 | 466 |
467 void UserSelectionScreen::AttemptEasyUnlock(const std::string& user_id) { | 467 void UserSelectionScreen::AttemptEasyUnlock(const std::string& user_id) { |
468 EasyUnlockService* service = GetEasyUnlockServiceForUser(user_id); | 468 EasyUnlockService* service = GetEasyUnlockServiceForUser(user_id); |
469 if (!service) | 469 if (!service) |
470 return; | 470 return; |
471 service->AttemptAuth(user_id); | 471 service->AttemptAuth(user_id); |
472 } | 472 } |
473 | 473 |
| 474 void UserSelectionScreen::RecordClickOnLockIcon(const std::string& user_id) { |
| 475 EasyUnlockService* service = GetEasyUnlockServiceForUser(user_id); |
| 476 if (!service) |
| 477 return; |
| 478 service->RecordClickOnLockIcon(); |
| 479 } |
| 480 |
474 EasyUnlockService* UserSelectionScreen::GetEasyUnlockServiceForUser( | 481 EasyUnlockService* UserSelectionScreen::GetEasyUnlockServiceForUser( |
475 const std::string& user_id) const { | 482 const std::string& user_id) const { |
476 if (GetScreenType() == OTHER_SCREEN) | 483 if (GetScreenType() == OTHER_SCREEN) |
477 return nullptr; | 484 return nullptr; |
478 | 485 |
479 const user_manager::User* unlock_user = nullptr; | 486 const user_manager::User* unlock_user = nullptr; |
480 for (const user_manager::User* user : GetUsers()) { | 487 for (const user_manager::User* user : GetUsers()) { |
481 if (user->email() == user_id) { | 488 if (user->email() == user_id) { |
482 unlock_user = user; | 489 unlock_user = user; |
483 break; | 490 break; |
484 } | 491 } |
485 } | 492 } |
486 if (!unlock_user) | 493 if (!unlock_user) |
487 return nullptr; | 494 return nullptr; |
488 | 495 |
489 ProfileHelper* profile_helper = ProfileHelper::Get(); | 496 ProfileHelper* profile_helper = ProfileHelper::Get(); |
490 Profile* profile = profile_helper->GetProfileByUser(unlock_user); | 497 Profile* profile = profile_helper->GetProfileByUser(unlock_user); |
491 | 498 |
492 // The user profile should exist if and only if this is the lock screen. | 499 // The user profile should exist if and only if this is the lock screen. |
493 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); | 500 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); |
494 | 501 |
495 if (!profile) | 502 if (!profile) |
496 profile = profile_helper->GetSigninProfile(); | 503 profile = profile_helper->GetSigninProfile(); |
497 | 504 |
498 return EasyUnlockService::Get(profile); | 505 return EasyUnlockService::Get(profile); |
499 } | 506 } |
500 | 507 |
501 } // namespace chromeos | 508 } // namespace chromeos |
OLD | NEW |