Index: chrome/browser/chromeos/login/quick_unlock/fingerprint_unlock.h |
diff --git a/chrome/browser/chromeos/login/quick_unlock/fingerprint_unlock.h b/chrome/browser/chromeos/login/quick_unlock/fingerprint_unlock.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..48cad00064a25e556992bab70ac6043b21bc9c68 |
--- /dev/null |
+++ b/chrome/browser/chromeos/login/quick_unlock/fingerprint_unlock.h |
@@ -0,0 +1,65 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_FINGERPRINT_UNLOCK_H_ |
+#define CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_FINGERPRINT_UNLOCK_H_ |
+ |
+#include <string> |
+#include <vector> |
+ |
+#include "base/time/time.h" |
+#include "components/keyed_service/core/keyed_service.h" |
+ |
+class PrefService; |
+ |
+namespace chromeos { |
+ |
+class FingerprintUnlockTestApi; |
+ |
+namespace quick_unlock { |
+ |
+class FingerprintUnlock : public KeyedService { |
+ public: |
+ static const int kMaximumUnlockAttempts = 5; |
+ |
+ explicit FingerprintUnlock(PrefService* pref_service); |
+ ~FingerprintUnlock() override; |
+ |
+ // Mark that the user has had a strong authentication. This means |
+ // that they authenticated with their password, for example. Fingerprint |
+ // unlock will timeout after a delay. |
+ void MarkStrongAuth(); |
+ // Returns true if the user has been strongly authenticated. |
+ bool HasStrongAuth() const; |
+ // Returns true if the user has fingerprint enrollments registered. |
+ bool HasEnrollment() const; |
+ // Returns the time since the last strong authentication. This should not be |
+ // called if HasStrongAuth returns false. |
+ base::TimeDelta TimeSinceLastStrongAuth() const; |
+ |
+ // Add a fingerprint unlock attempt count. |
+ void AddUnlockAttempt(); |
+ // Reset the number of unlock attempts to 0. |
+ void ResetUnlockAttemptCount(); |
+ // Returns the number of unlock attempts. |
+ 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.
|
+ |
+ // Returns true if fingerprint unlock is currently available. |
+ 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.
|
+ |
+ private: |
+ friend class chromeos::FingerprintUnlockTestApi; |
+ |
+ PrefService* pref_service_; |
+ int unlock_attempt_count_ = 0; |
+ bool has_enrollments_ = false; |
+ base::Time last_strong_auth_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(FingerprintUnlock); |
+}; |
+ |
+} // namespace quick_unlock |
+} // namespace chromeos |
+ |
+#endif // CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_FINGERPRINT_UNLOCK_H_ |