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

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

Issue 2715823004: Add FingerprintUnlock KeyedService for each profile (Closed)
Patch Set: 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_unlock_factory.h
diff --git a/chrome/browser/chromeos/login/quick_unlock/fingerprint_unlock_factory.h b/chrome/browser/chromeos/login/quick_unlock/fingerprint_unlock_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..765fc8f2f79cf0fbfed8c3ac86990d569f852fc3
--- /dev/null
+++ b/chrome/browser/chromeos/login/quick_unlock/fingerprint_unlock_factory.h
@@ -0,0 +1,57 @@
+// 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_UNLOCK_FACTORY_H_
+#define CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_FINGERPRINT_UNLOCK_FACTORY_H_
+
+#include "base/memory/singleton.h"
+#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
+#include "components/signin/core/account_id/account_id.h"
+
+class Profile;
+
+namespace user_manager {
+class User;
+}
+
+namespace chromeos {
+namespace quick_unlock {
+
+class FingerprintUnlock;
+
+// Singleton that owns all FingerprintUnlock instances and associates them with
+// Profiles. Listens for the Profile's destruction notification and cleans up
+// the associated FingerprintUnlock.
+class FingerprintUnlockFactory : public BrowserContextKeyedServiceFactory {
+ public:
+ // Returns the FingerprintUnlock instance for |profile|.
+ static FingerprintUnlock* GetForProfile(Profile* profile);
+
+ // Helper method that finds the FingerprintUnlock instance for |user|. This
+ // returns GetForProfile with the profile associated with |user|.
+ static FingerprintUnlock* GetForUser(const user_manager::User* user);
+
+ // Helper method that returns the FingerprintUnlock instance for |account_id|.
+ // This returns GetForProfile with the profile associated with |account_id|.
+ static FingerprintUnlock* GetForAccountId(const AccountId& account_id);
+
+ static FingerprintUnlockFactory* GetInstance();
+
+ private:
+ friend struct base::DefaultSingletonTraits<FingerprintUnlockFactory>;
+
+ FingerprintUnlockFactory();
+ ~FingerprintUnlockFactory() override;
+
+ // BrowserContextKeyedServiceFactory:
+ KeyedService* BuildServiceInstanceFor(
+ content::BrowserContext* profile) const override;
+
+ DISALLOW_COPY_AND_ASSIGN(FingerprintUnlockFactory);
+};
+
+} // namespace quick_unlock
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_FINGERPRINT_UNLOCK_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698