| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/chromeos/login/lock/views_screen_locker.h" |
| 6 |
| 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h" |
| 9 #include "chrome/browser/chromeos/login/user_selection_screen_proxy.h" |
| 10 |
| 11 namespace chromeos { |
| 12 |
| 13 namespace { |
| 14 constexpr char kLockDisplay[] = "lock"; |
| 15 } // namespace |
| 16 |
| 17 ViewsScreenLocker::ViewsScreenLocker(ScreenLocker* screen_locker) |
| 18 : screen_locker_(screen_locker), weak_factory_(this) { |
| 19 LockScreenClient::Get()->SetDelegate(this); |
| 20 user_selection_screen_proxy_ = base::MakeUnique<UserSelectionScreenProxy>(); |
| 21 user_selection_screen_ = |
| 22 base::MakeUnique<ChromeUserSelectionScreen>(kLockDisplay); |
| 23 user_selection_screen_->SetView(user_selection_screen_proxy_.get()); |
| 24 } |
| 25 |
| 26 ViewsScreenLocker::~ViewsScreenLocker() { |
| 27 LockScreenClient::Get()->SetDelegate(nullptr); |
| 28 } |
| 29 |
| 30 void ViewsScreenLocker::SetPasswordInputEnabled(bool enabled) { |
| 31 NOTIMPLEMENTED(); |
| 32 } |
| 33 |
| 34 void ViewsScreenLocker::ShowErrorMessage( |
| 35 int error_msg_id, |
| 36 HelpAppLauncher::HelpTopic help_topic_id) { |
| 37 // TODO(xiaoyinh): Complete the implementation here. |
| 38 LockScreenClient::Get()->ShowErrorMessage(0 /* login_attempts */, |
| 39 std::string(), std::string(), |
| 40 static_cast<int>(help_topic_id)); |
| 41 } |
| 42 |
| 43 void ViewsScreenLocker::ClearErrors() { |
| 44 LockScreenClient::Get()->ClearErrors(); |
| 45 } |
| 46 |
| 47 void ViewsScreenLocker::AnimateAuthenticationSuccess() { |
| 48 NOTIMPLEMENTED(); |
| 49 } |
| 50 |
| 51 void ViewsScreenLocker::OnLockWebUIReady() { |
| 52 NOTIMPLEMENTED(); |
| 53 } |
| 54 |
| 55 void ViewsScreenLocker::OnLockBackgroundDisplayed() { |
| 56 NOTIMPLEMENTED(); |
| 57 } |
| 58 |
| 59 void ViewsScreenLocker::OnHeaderBarVisible() { |
| 60 NOTIMPLEMENTED(); |
| 61 } |
| 62 |
| 63 void ViewsScreenLocker::OnAshLockAnimationFinished() { |
| 64 NOTIMPLEMENTED(); |
| 65 } |
| 66 |
| 67 void ViewsScreenLocker::SetFingerprintState( |
| 68 const AccountId& account_id, |
| 69 ScreenLocker::FingerprintState state) { |
| 70 NOTIMPLEMENTED(); |
| 71 } |
| 72 |
| 73 content::WebContents* ViewsScreenLocker::GetWebContents() { |
| 74 return nullptr; |
| 75 } |
| 76 |
| 77 void ViewsScreenLocker::Init() { |
| 78 lock_time_ = base::TimeTicks::Now(); |
| 79 user_selection_screen_->Init(screen_locker_->users()); |
| 80 LockScreenClient::Get()->LoadUsers(user_selection_screen_->PrepareUserList(), |
| 81 false /* show_guests */); |
| 82 } |
| 83 |
| 84 void ViewsScreenLocker::OnLockScreenReady() { |
| 85 user_selection_screen_->InitEasyUnlock(); |
| 86 UMA_HISTOGRAM_TIMES("LockScreen.LockReady", |
| 87 base::TimeTicks::Now() - lock_time_); |
| 88 screen_locker_->ScreenLockReady(); |
| 89 } |
| 90 |
| 91 void ViewsScreenLocker::HandleAttemptUnlock(const AccountId& account_id) { |
| 92 user_selection_screen_->AttemptEasyUnlock(account_id); |
| 93 } |
| 94 |
| 95 void ViewsScreenLocker::HandleHardlockPod(const AccountId& account_id) { |
| 96 user_selection_screen_->HardLockPod(account_id); |
| 97 } |
| 98 |
| 99 void ViewsScreenLocker::HandleRecordClickOnLockIcon( |
| 100 const AccountId& account_id) { |
| 101 user_selection_screen_->RecordClickOnLockIcon(account_id); |
| 102 } |
| 103 |
| 104 } // namespace chromeos |
| OLD | NEW |