Qihui Zhao | 0cfcf200 | 2022-09-09 22:17:29 | [diff] [blame^] | 1 | // Copyright 2022 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_AUTOFILL_IBAN_MANAGER_FACTORY_H_ |
| 6 | #define CHROME_BROWSER_AUTOFILL_IBAN_MANAGER_FACTORY_H_ |
| 7 | |
| 8 | #include "components/keyed_service/content/browser_context_keyed_service_factory.h" |
| 9 | #include "components/keyed_service/core/keyed_service.h" |
| 10 | |
| 11 | namespace base { |
| 12 | template <typename T> |
| 13 | struct DefaultSingletonTraits; |
| 14 | } |
| 15 | |
| 16 | class Profile; |
| 17 | |
| 18 | namespace autofill { |
| 19 | |
| 20 | class IBANManager; |
| 21 | |
| 22 | // Singleton that owns all IBANManagers and associates them with Profiles. |
| 23 | class IBANManagerFactory : public BrowserContextKeyedServiceFactory { |
| 24 | public: |
| 25 | // Returns the IBANManager for |profile|, creating it if it is not yet |
| 26 | // created. |
| 27 | static IBANManager* GetForProfile(Profile* profile); |
| 28 | |
| 29 | static IBANManagerFactory* GetInstance(); |
| 30 | |
| 31 | private: |
| 32 | friend struct base::DefaultSingletonTraits<IBANManagerFactory>; |
| 33 | |
| 34 | IBANManagerFactory(); |
| 35 | ~IBANManagerFactory() override; |
| 36 | |
| 37 | // BrowserContextKeyedServiceFactory: |
| 38 | KeyedService* BuildServiceInstanceFor( |
| 39 | content::BrowserContext* profile) const override; |
| 40 | content::BrowserContext* GetBrowserContextToUse( |
| 41 | content::BrowserContext* context) const override; |
| 42 | }; |
| 43 | |
| 44 | } // namespace autofill |
| 45 | |
| 46 | #endif // CHROME_BROWSER_AUTOFILL_IBAN_MANAGER_FACTORY_H_ |