OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_AUTOFILL_PERSONAL_DATA_MANAGER_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_FACTORY_H_ |
6 #define CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_FACTORY_H_ | 6 #define CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_FACTORY_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.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/keyed_service/core/keyed_service.h" | 10 #include "components/keyed_service/core/keyed_service.h" |
11 | 11 |
| 12 namespace base { |
12 template <typename T> struct DefaultSingletonTraits; | 13 template <typename T> struct DefaultSingletonTraits; |
| 14 } |
| 15 |
13 class Profile; | 16 class Profile; |
14 | 17 |
15 namespace autofill { | 18 namespace autofill { |
16 | 19 |
17 class PersonalDataManager; | 20 class PersonalDataManager; |
18 | 21 |
19 // Singleton that owns all PersonalDataManagers and associates them with | 22 // Singleton that owns all PersonalDataManagers and associates them with |
20 // Profiles. | 23 // Profiles. |
21 // Listens for the Profile's destruction notification and cleans up the | 24 // Listens for the Profile's destruction notification and cleans up the |
22 // associated PersonalDataManager. | 25 // associated PersonalDataManager. |
23 class PersonalDataManagerFactory : public BrowserContextKeyedServiceFactory { | 26 class PersonalDataManagerFactory : public BrowserContextKeyedServiceFactory { |
24 public: | 27 public: |
25 // Returns the PersonalDataManager for |profile|, creating it if it is not | 28 // Returns the PersonalDataManager for |profile|, creating it if it is not |
26 // yet created. | 29 // yet created. |
27 static PersonalDataManager* GetForProfile(Profile* profile); | 30 static PersonalDataManager* GetForProfile(Profile* profile); |
28 | 31 |
29 static PersonalDataManagerFactory* GetInstance(); | 32 static PersonalDataManagerFactory* GetInstance(); |
30 | 33 |
31 private: | 34 private: |
32 friend struct DefaultSingletonTraits<PersonalDataManagerFactory>; | 35 friend struct base::DefaultSingletonTraits<PersonalDataManagerFactory>; |
33 | 36 |
34 PersonalDataManagerFactory(); | 37 PersonalDataManagerFactory(); |
35 ~PersonalDataManagerFactory() override; | 38 ~PersonalDataManagerFactory() override; |
36 | 39 |
37 // BrowserContextKeyedServiceFactory: | 40 // BrowserContextKeyedServiceFactory: |
38 KeyedService* BuildServiceInstanceFor( | 41 KeyedService* BuildServiceInstanceFor( |
39 content::BrowserContext* profile) const override; | 42 content::BrowserContext* profile) const override; |
40 content::BrowserContext* GetBrowserContextToUse( | 43 content::BrowserContext* GetBrowserContextToUse( |
41 content::BrowserContext* context) const override; | 44 content::BrowserContext* context) const override; |
42 }; | 45 }; |
43 | 46 |
44 } // namespace autofill | 47 } // namespace autofill |
45 | 48 |
46 #endif // CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_FACTORY_H_ | 49 #endif // CHROME_BROWSER_AUTOFILL_PERSONAL_DATA_MANAGER_FACTORY_H_ |
OLD | NEW |