OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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_QUICK_UNLOCK_FACTORY_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_QUICK_UNLOCK_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 QuickUnlockStorage; |
| 22 |
| 23 // Singleton that owns all QuickUnlockStorage instances and associates them with |
| 24 // Profiles. Listens for the Profile's destruction notification and cleans up |
| 25 // the associated QuickUnlockStorage. |
| 26 class QuickUnlockFactory : public BrowserContextKeyedServiceFactory { |
| 27 public: |
| 28 // Returns the QuickUnlockStorage instance for |profile|. |
| 29 static QuickUnlockStorage* GetForProfile(Profile* profile); |
| 30 |
| 31 // Helper method that finds the QuickUnlockStorage instance for |user|. This |
| 32 // returns GetForProfile with the profile associated with |user|. |
| 33 static QuickUnlockStorage* GetForUser(const user_manager::User* user); |
| 34 |
| 35 // Helper method that returns the QuickUnlockStorage instance for |
| 36 // |account_id|. This returns GetForProfile with the profile associated with |
| 37 // |account_id|. |
| 38 static QuickUnlockStorage* GetForAccountId(const AccountId& account_id); |
| 39 |
| 40 static QuickUnlockFactory* GetInstance(); |
| 41 |
| 42 private: |
| 43 friend struct base::DefaultSingletonTraits<QuickUnlockFactory>; |
| 44 |
| 45 QuickUnlockFactory(); |
| 46 ~QuickUnlockFactory() override; |
| 47 |
| 48 // BrowserContextKeyedServiceFactory: |
| 49 KeyedService* BuildServiceInstanceFor( |
| 50 content::BrowserContext* profile) const override; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(QuickUnlockFactory); |
| 53 }; |
| 54 |
| 55 } // namespace quick_unlock |
| 56 } // namespace chromeos |
| 57 |
| 58 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_QUICK_UNLOCK_QUICK_UNLOCK_FACTORY_H_ |
OLD | NEW |