Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_PIN_STORAGE_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_PIN_STORAGE_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/time/time.h" | |
| 11 #include "components/pref_registry/pref_registry_syncable.h" | |
| 12 | |
| 13 class Profile; | |
| 14 | |
| 15 namespace chromeos { | |
| 16 | |
| 17 // TODO(jdufault): Figure out the UX we want on the lock screen when there are | |
| 18 // multiple users. We will be storing either global or per-user unlock state. If | |
| 19 // we end up storing global unlock state, we can pull the unlock attempt and | |
| 20 // strong-auth code out of this class. | |
| 21 | |
| 22 class PinStorage { | |
| 23 public: | |
| 24 // Fetch the data for the given profile. Each profile can have different | |
| 25 // pin/unlock state. | |
| 26 static PinStorage* GetInstance(Profile* profile); | |
|
stevenjb
2016/05/16 16:33:34
We should use a BrowserContextKeyedServiceFactory
jdufault
2016/05/16 22:08:48
Ah, the factory separation cleans things up quite
| |
| 27 | |
| 28 // Registers profile prefs. | |
| 29 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | |
| 30 | |
| 31 PinStorage(); | |
| 32 virtual ~PinStorage(); | |
| 33 | |
| 34 // 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 | |
| 36 // timeout after a delay. | |
| 37 virtual void MarkStrongAuth() = 0; | |
| 38 virtual base::TimeDelta TimeSinceLastStrongAuth() = 0; | |
| 39 | |
| 40 // Add a PIN unlock attempt count. | |
| 41 virtual void AddUnlockAttempt() = 0; | |
| 42 virtual void ResetUnlockAttemptCount() = 0; | |
| 43 virtual int UnlockAttemptCount() = 0; | |
| 44 | |
| 45 // PIN storage management. | |
| 46 virtual bool HasPin() const = 0; | |
| 47 virtual void SetPin(const std::string& raw_pin) = 0; | |
| 48 virtual void RemovePin() = 0; | |
| 49 | |
| 50 // The salt and hash for the stored pin. These methods return empty values if | |
| 51 // HasPin returns false. | |
| 52 virtual std::string pin_salt() const = 0; | |
| 53 virtual std::string pin_secret() const = 0; | |
| 54 | |
| 55 private: | |
| 56 DISALLOW_COPY_AND_ASSIGN(PinStorage); | |
| 57 }; | |
| 58 | |
| 59 } // namespace chromeos | |
| 60 | |
| 61 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_PIN_STORAGE_H_ | |
| OLD | NEW |