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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_FINGERPRINT_UNLOCK_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_FINGERPRINT_UNLOCK_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/time/time.h" | |
| 12 #include "components/keyed_service/core/keyed_service.h" | |
| 13 | |
| 14 class PrefService; | |
| 15 | |
| 16 namespace chromeos { | |
| 17 | |
| 18 class FingerprintUnlockTestApi; | |
| 19 | |
| 20 namespace quick_unlock { | |
| 21 | |
| 22 class FingerprintUnlock : public KeyedService { | |
| 23 public: | |
| 24 static const int kMaximumUnlockAttempts = 5; | |
| 25 | |
| 26 explicit FingerprintUnlock(PrefService* pref_service); | |
| 27 ~FingerprintUnlock() override; | |
| 28 | |
| 29 // Mark that the user has had a strong authentication. This means | |
| 30 // that they authenticated with their password, for example. Fingerprint | |
| 31 // unlock will timeout after a delay. | |
| 32 void MarkStrongAuth(); | |
| 33 // Returns true if the user has been strongly authenticated. | |
| 34 bool HasStrongAuth() const; | |
| 35 // Returns true if the user has fingerprint enrollments registered. | |
| 36 bool HasEnrollment() const; | |
| 37 // Returns the time since the last strong authentication. This should not be | |
| 38 // called if HasStrongAuth returns false. | |
| 39 base::TimeDelta TimeSinceLastStrongAuth() const; | |
| 40 | |
| 41 // Add a fingerprint unlock attempt count. | |
| 42 void AddUnlockAttempt(); | |
| 43 // Reset the number of unlock attempts to 0. | |
| 44 void ResetUnlockAttemptCount(); | |
| 45 // Returns the number of unlock attempts. | |
| 46 int unlock_attempt_count() const { return unlock_attempt_count_; } | |
|
stevenjb
2017/02/27 17:25:34
nit: comment the variable instead (if at all, the
xiaoyinh(OOO Sep 11-29)
2017/02/27 21:36:42
Done.
| |
| 47 | |
| 48 // Returns true if fingerprint unlock is currently available. | |
| 49 bool IsFingerprintAuthenticationAvailable() const; | |
|
stevenjb
2017/02/27 17:25:34
The grouping of the public methods is unclear. I w
xiaoyinh(OOO Sep 11-29)
2017/02/27 21:36:42
Done.
| |
| 50 | |
| 51 private: | |
| 52 friend class chromeos::FingerprintUnlockTestApi; | |
| 53 | |
| 54 PrefService* pref_service_; | |
| 55 int unlock_attempt_count_ = 0; | |
| 56 bool has_enrollments_ = false; | |
| 57 base::Time last_strong_auth_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(FingerprintUnlock); | |
| 60 }; | |
| 61 | |
| 62 } // namespace quick_unlock | |
| 63 } // namespace chromeos | |
| 64 | |
| 65 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_FINGERPRINT_UNLOCK_H_ | |
| OLD | NEW |