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_FACTORY_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_PIN_STORAGE_FACTORY_H_ | |
7 | |
8 #include "base/memory/singleton.h" | |
9 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | |
10 #include "components/signin/core/account_id/account_id.h" | |
11 | |
12 class Profile; | |
13 | |
14 namespace user_manager { | |
15 class User; | |
16 } | |
17 | |
18 namespace chromeos { | |
19 namespace quick_unlock { | |
20 | |
21 class PinStorage; | |
22 | |
23 // Singleton that owns all PinStorage instances and associates them with | |
24 // Profiles. Listens for the Profile's destruction notification and cleans up | |
25 // the associated PinStorage. | |
26 class PinStorageFactory : public BrowserContextKeyedServiceFactory { | |
27 public: | |
28 // Returns the PinStorage instance for |profile|. | |
29 static PinStorage* GetForProfile(Profile* profile); | |
30 | |
31 // Helper method that finds the PinStorage instance for |user|. This returns | |
32 // GetForProfile with the profile associated with |user|. | |
33 static PinStorage* GetForUser(const user_manager::User* user); | |
34 | |
35 // Helper method that returns the PinStorage instance for |account_id|. This | |
36 // returns GetForProfile with the profile associated with |account_id|. | |
37 static PinStorage* GetForAccountId(const AccountId& account_id); | |
38 | |
39 static PinStorageFactory* GetInstance(); | |
40 | |
41 private: | |
42 friend struct base::DefaultSingletonTraits<PinStorageFactory>; | |
43 | |
44 PinStorageFactory(); | |
45 ~PinStorageFactory() override; | |
46 | |
47 // BrowserContextKeyedServiceFactory: | |
48 KeyedService* BuildServiceInstanceFor( | |
49 content::BrowserContext* profile) const override; | |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(PinStorageFactory); | |
52 }; | |
53 | |
54 } // namespace quick_unlock | |
55 } // namespace chromeos | |
56 | |
57 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_PIN_STORAGE_FACTORY_H_ | |
OLD | NEW |