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

Side by Side 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, 9 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 unified diff | Download patch
OLDNEW
(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_STORAGE_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_FINGERPRINT_STORAGE_H_
7
8 #include "base/time/time.h"
9
10 class PrefService;
11
12 namespace chromeos {
13
14 class FingerprintStorageTestApi;
15
16 namespace quick_unlock {
17
18 class FingerprintStorage {
19 public:
20 static const int kMaximumUnlockAttempts = 5;
21
22 explicit FingerprintStorage(PrefService* pref_service);
23 ~FingerprintStorage();
24
25 // Mark in storage that the user has had a strong authentication. This means
26 // that they authenticated with their password, for example. Fingerprint
27 // unlock will timeout after a delay.
28 void MarkStrongAuth();
29
30 // Returns true if the user has been strongly authenticated.
31 bool HasStrongAuth() const;
32
33 // Returns the time since the last strong authentication. This should not be
34 // called if HasStrongAuth returns false.
35 base::TimeDelta TimeSinceLastStrongAuth() const;
36
37 // Returns true if fingerprint unlock is currently available.
38 bool IsFingerprintAuthenticationAvailable() const;
39
40 // Returns true if the user has fingerprint enrollments registered.
41 bool HasEnrollment() const;
42
43 // Add a fingerprint unlock attempt count.
44 void AddUnlockAttempt();
45
46 // Reset the number of unlock attempts to 0.
47 void ResetUnlockAttemptCount();
48
49 int unlock_attempt_count() const { return unlock_attempt_count_; }
50
51 private:
52 friend class chromeos::FingerprintStorageTestApi;
53
54 PrefService* pref_service_;
55 // Number of fingerprint unlock attempt.
56 int unlock_attempt_count_ = 0;
57 bool has_enrollments_ = false;
58 base::Time last_strong_auth_;
59
60 DISALLOW_COPY_AND_ASSIGN(FingerprintStorage);
61 };
62
63 } // namespace quick_unlock
64 } // namespace chromeos
65
66 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_FINGERPRINT_STORAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698