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/quick_unlock/fingerprint_storage.h" |
| 6 |
| 7 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h" |
| 8 #include "chrome/common/pref_names.h" |
| 9 #include "components/prefs/pref_service.h" |
| 10 |
| 11 namespace chromeos { |
| 12 namespace quick_unlock { |
| 13 |
| 14 FingerprintStorage::FingerprintStorage(PrefService* pref_service) |
| 15 : pref_service_(pref_service) {} |
| 16 |
| 17 FingerprintStorage::~FingerprintStorage() {} |
| 18 |
| 19 bool FingerprintStorage::IsFingerprintAuthenticationAvailable() const { |
| 20 const bool exceeded_unlock_attempts = |
| 21 unlock_attempt_count() >= kMaximumUnlockAttempts; |
| 22 |
| 23 return IsFingerprintEnabled() && HasEnrollment() && !exceeded_unlock_attempts; |
| 24 } |
| 25 |
| 26 bool FingerprintStorage::HasEnrollment() const { |
| 27 return has_enrollments_; |
| 28 } |
| 29 |
| 30 void FingerprintStorage::AddUnlockAttempt() { |
| 31 ++unlock_attempt_count_; |
| 32 } |
| 33 |
| 34 void FingerprintStorage::ResetUnlockAttemptCount() { |
| 35 unlock_attempt_count_ = 0; |
| 36 } |
| 37 |
| 38 } // namespace quick_unlock |
| 39 } // namespace chromeos |
OLD | NEW |