Chromium Code Reviews| 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 std::unique_ptr<base::ListValue> users_list = | |
|
xiyuan
2017/06/05 17:30:40
nit: get rid of |users_list| and use it in-place i
xiaoyinh(OOO Sep 11-29)
2017/06/06 16:36:05
Done.
| |
| 81 user_selection_screen_->PrepareUserList(); | |
| 82 LockScreenClient::Get()->LoadUsers(std::move(users_list), | |
|
xiyuan
2017/06/05 17:30:40
nit: #include <utility> for std::move
xiaoyinh(OOO Sep 11-29)
2017/06/06 16:36:05
Thanks for your comment! This is no longer needed
| |
| 83 false /* show_guests */); | |
| 84 } | |
| 85 | |
| 86 void ViewsScreenLocker::OnLockScreenReady() { | |
| 87 user_selection_screen_->InitEasyUnlock(); | |
| 88 UMA_HISTOGRAM_TIMES("LockScreen.LockReady", | |
| 89 base::TimeTicks::Now() - lock_time_); | |
| 90 screen_locker_->ScreenLockReady(); | |
| 91 } | |
| 92 | |
| 93 void ViewsScreenLocker::HandleAttemptUnlock(const AccountId& account_id) { | |
| 94 user_selection_screen_->AttemptEasyUnlock(account_id); | |
| 95 } | |
| 96 | |
| 97 void ViewsScreenLocker::HandleHardlockPod(const AccountId& account_id) { | |
| 98 user_selection_screen_->HardLockPod(account_id); | |
| 99 } | |
| 100 | |
| 101 void ViewsScreenLocker::HandleRecordClickOnLockIcon( | |
| 102 const AccountId& account_id) { | |
| 103 user_selection_screen_->RecordClickOnLockIcon(account_id); | |
| 104 } | |
| 105 | |
| 106 } // namespace chromeos | |
| OLD | NEW |