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