Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5376)

Unified Diff: chrome/browser/chromeos/login/quick_unlock/fingerprint_storage.h

Issue 2715823004: Add FingerprintUnlock KeyedService for each profile (Closed)
Patch Set: Incorporate comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/quick_unlock/fingerprint_storage.h
diff --git a/chrome/browser/chromeos/login/quick_unlock/fingerprint_storage.h b/chrome/browser/chromeos/login/quick_unlock/fingerprint_storage.h
new file mode 100644
index 0000000000000000000000000000000000000000..fc4251ea02099b7a6cf6de41bcd0684b9a084692
--- /dev/null
+++ b/chrome/browser/chromeos/login/quick_unlock/fingerprint_storage.h
@@ -0,0 +1,66 @@
+// 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_STORAGE_H_
+#define CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_FINGERPRINT_STORAGE_H_
+
+#include "base/time/time.h"
+
+class PrefService;
+
+namespace chromeos {
+
+class FingerprintStorageTestApi;
+
+namespace quick_unlock {
+
+class FingerprintStorage {
+ public:
+ static const int kMaximumUnlockAttempts = 5;
+
+ explicit FingerprintStorage(PrefService* pref_service);
+ ~FingerprintStorage();
+
+ // Mark in storage 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 the time since the last strong authentication. This should not be
+ // called if HasStrongAuth returns false.
+ base::TimeDelta TimeSinceLastStrongAuth() const;
+
+ // Returns true if fingerprint unlock is currently available.
+ bool IsFingerprintAuthenticationAvailable() const;
+
+ // Returns true if the user has fingerprint enrollments registered.
+ bool HasEnrollment() const;
+
+ // Add a fingerprint unlock attempt count.
+ void AddUnlockAttempt();
+
+ // Reset the number of unlock attempts to 0.
+ void ResetUnlockAttemptCount();
+
+ int unlock_attempt_count() const { return unlock_attempt_count_; }
+
+ private:
+ friend class chromeos::FingerprintStorageTestApi;
+
+ PrefService* pref_service_;
+ // Number of fingerprint unlock attempt.
+ int unlock_attempt_count_ = 0;
+ bool has_enrollments_ = false;
+ base::Time last_strong_auth_;
+
+ DISALLOW_COPY_AND_ASSIGN(FingerprintStorage);
+};
+
+} // namespace quick_unlock
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_FINGERPRINT_STORAGE_H_

Powered by Google App Engine
This is Rietveld 408576698