Chromium Code Reviews| Index: chrome/browser/chromeos/login/quick_unlock/pin_storage.h |
| diff --git a/chrome/browser/chromeos/login/quick_unlock/pin_storage.h b/chrome/browser/chromeos/login/quick_unlock/pin_storage.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2a630307f84b885dc73db2e9038c297661a78cfc |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/login/quick_unlock/pin_storage.h |
| @@ -0,0 +1,61 @@ |
| +// Copyright 2016 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_PIN_STORAGE_H_ |
| +#define CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_PIN_STORAGE_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/time/time.h" |
| +#include "components/pref_registry/pref_registry_syncable.h" |
| + |
| +class Profile; |
| + |
| +namespace chromeos { |
| + |
| +// TODO(jdufault): Figure out the UX we want on the lock screen when there are |
| +// multiple users. We will be storing either global or per-user unlock state. If |
| +// we end up storing global unlock state, we can pull the unlock attempt and |
| +// strong-auth code out of this class. |
| + |
| +class PinStorage { |
| + public: |
| + // Fetch the data for the given profile. Each profile can have different |
| + // pin/unlock state. |
| + 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
|
| + |
| + // Registers profile prefs. |
| + static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| + |
| + PinStorage(); |
| + virtual ~PinStorage(); |
| + |
| + // Mark in storage that the user has had a strong authentication. This means |
| + // that they authenticated with their password, for example. PIN unlock will |
| + // timeout after a delay. |
| + virtual void MarkStrongAuth() = 0; |
| + virtual base::TimeDelta TimeSinceLastStrongAuth() = 0; |
| + |
| + // Add a PIN unlock attempt count. |
| + virtual void AddUnlockAttempt() = 0; |
| + virtual void ResetUnlockAttemptCount() = 0; |
| + virtual int UnlockAttemptCount() = 0; |
| + |
| + // PIN storage management. |
| + virtual bool HasPin() const = 0; |
| + virtual void SetPin(const std::string& raw_pin) = 0; |
| + virtual void RemovePin() = 0; |
| + |
| + // The salt and hash for the stored pin. These methods return empty values if |
| + // HasPin returns false. |
| + virtual std::string pin_salt() const = 0; |
| + virtual std::string pin_secret() const = 0; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(PinStorage); |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_PIN_STORAGE_H_ |