| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_PIN_STORAGE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_PIN_STORAGE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_PIN_STORAGE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_PIN_STORAGE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "components/keyed_service/core/keyed_service.h" | |
| 13 | 12 |
| 14 class PrefRegistrySimple; | 13 class PrefRegistrySimple; |
| 15 class PrefService; | 14 class PrefService; |
| 16 | 15 |
| 17 namespace chromeos { | 16 namespace chromeos { |
| 18 | 17 |
| 19 class PinStorageTestApi; | 18 class PinStorageTestApi; |
| 20 | 19 |
| 21 namespace quick_unlock { | 20 namespace quick_unlock { |
| 22 | 21 |
| 23 class PinStorage : public KeyedService { | 22 class PinStorage { |
| 24 public: | 23 public: |
| 25 // TODO(sammiequon): Pull this value in from policy. See crbug.com/612271. | 24 // TODO(sammiequon): Pull this value in from policy. See crbug.com/612271. |
| 26 static const int kMaximumUnlockAttempts = 3; | 25 static const int kMaximumUnlockAttempts = 3; |
| 27 | 26 |
| 28 // Registers profile prefs. | 27 // Registers profile prefs. |
| 29 static void RegisterProfilePrefs(PrefRegistrySimple* registry); | 28 static void RegisterProfilePrefs(PrefRegistrySimple* registry); |
| 30 | 29 |
| 31 explicit PinStorage(PrefService* pref_service); | 30 explicit PinStorage(PrefService* pref_service); |
| 32 ~PinStorage() override; | 31 ~PinStorage(); |
| 33 | 32 |
| 34 // Mark in storage that the user has had a strong authentication. This means | 33 // Mark in storage that the user has had a strong authentication. This means |
| 35 // that they authenticated with their password, for example. PIN unlock will | 34 // that they authenticated with their password, for example. PIN unlock will |
| 36 // timeout after a delay. | 35 // timeout after a delay. |
| 37 void MarkStrongAuth(); | 36 void MarkStrongAuth(); |
| 38 // Returns true if the user has been strongly authenticated. | 37 // Returns true if the user has been strongly authenticated. |
| 39 bool HasStrongAuth() const; | 38 bool HasStrongAuth() const; |
| 40 // Returns the time since the last strong authentication. This should not be | 39 // Returns the time since the last strong authentication. This should not be |
| 41 // called if HasStrongAuth returns false. | 40 // called if HasStrongAuth returns false. |
| 42 base::TimeDelta TimeSinceLastStrongAuth() const; | 41 base::TimeDelta TimeSinceLastStrongAuth() const; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 73 int unlock_attempt_count_ = 0; | 72 int unlock_attempt_count_ = 0; |
| 74 base::Time last_strong_auth_; | 73 base::Time last_strong_auth_; |
| 75 | 74 |
| 76 DISALLOW_COPY_AND_ASSIGN(PinStorage); | 75 DISALLOW_COPY_AND_ASSIGN(PinStorage); |
| 77 }; | 76 }; |
| 78 | 77 |
| 79 } // namespace quick_unlock | 78 } // namespace quick_unlock |
| 80 } // namespace chromeos | 79 } // namespace chromeos |
| 81 | 80 |
| 82 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_PIN_STORAGE_H_ | 81 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_PIN_STORAGE_H_ |
| OLD | NEW |