OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_AUTOCHECKOUT_WHITELIST_MANAGER_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOCHECKOUT_WHITELIST_MANAGER_FACTORY_H_ |
6 #define CHROME_BROWSER_AUTOFILL_AUTOCHECKOUT_WHITELIST_MANAGER_FACTORY_H_ | 6 #define CHROME_BROWSER_AUTOFILL_AUTOCHECKOUT_WHITELIST_MANAGER_FACTORY_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 9 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
10 #include "components/browser_context_keyed_service/browser_context_keyed_service
_factory.h" | 10 #include "components/browser_context_keyed_service/browser_context_keyed_service
_factory.h" |
11 | 11 |
12 template <typename T> struct DefaultSingletonTraits; | 12 template <typename T> struct DefaultSingletonTraits; |
13 class Profile; | 13 class Profile; |
14 | 14 |
15 namespace autofill { | 15 namespace autofill { |
16 namespace autocheckout { | 16 namespace autocheckout { |
17 | 17 |
18 class WhitelistManager; | 18 class WhitelistManager; |
19 | 19 |
20 // A wrapper of WhitelistManager so we can use it as a profiled | 20 // A wrapper of WhitelistManager so we can use it as a profiled |
21 // keyed service. Exposed in header file only for tests. | 21 // keyed service. Exposed in header file only for tests. |
22 class WhitelistManagerService : public ProfileKeyedService { | 22 class WhitelistManagerService : public BrowserContextKeyedService { |
23 public: | 23 public: |
24 virtual WhitelistManager* GetWhitelistManager() = 0; | 24 virtual WhitelistManager* GetWhitelistManager() = 0; |
25 }; | 25 }; |
26 | 26 |
27 // Singleton that owns all WhitelistManager and associates them | 27 // Singleton that owns all WhitelistManager and associates them |
28 // with Profiles. | 28 // with Profiles. |
29 // Listens for the Profile's destruction notification and cleans up the | 29 // Listens for the Profile's destruction notification and cleans up the |
30 // associated WhitelistManager. | 30 // associated WhitelistManager. |
31 class WhitelistManagerFactory : public ProfileKeyedServiceFactory { | 31 class WhitelistManagerFactory : public BrowserContextKeyedServiceFactory { |
32 public: | 32 public: |
33 // Returns the WhitelistManager for |profile|, creating it if | 33 // Returns the WhitelistManager for |profile|, creating it if |
34 // it is not yet created. | 34 // it is not yet created. |
35 static WhitelistManager* GetForProfile(Profile* profile); | 35 static WhitelistManager* GetForProfile(Profile* profile); |
36 | 36 |
37 static WhitelistManagerFactory* GetInstance(); | 37 static WhitelistManagerFactory* GetInstance(); |
38 | 38 |
39 private: | 39 private: |
40 friend struct DefaultSingletonTraits<WhitelistManagerFactory>; | 40 friend struct DefaultSingletonTraits<WhitelistManagerFactory>; |
41 | 41 |
42 WhitelistManagerFactory(); | 42 WhitelistManagerFactory(); |
43 virtual ~WhitelistManagerFactory(); | 43 virtual ~WhitelistManagerFactory(); |
44 | 44 |
45 // ProfileKeyedServiceFactory: | 45 // BrowserContextKeyedServiceFactory: |
46 virtual ProfileKeyedService* BuildServiceInstanceFor( | 46 virtual BrowserContextKeyedService* BuildServiceInstanceFor( |
47 content::BrowserContext* profile) const OVERRIDE; | 47 content::BrowserContext* profile) const OVERRIDE; |
48 virtual content::BrowserContext* GetBrowserContextToUse( | 48 virtual content::BrowserContext* GetBrowserContextToUse( |
49 content::BrowserContext* context) const OVERRIDE; | 49 content::BrowserContext* context) const OVERRIDE; |
50 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; | 50 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; |
51 }; | 51 }; |
52 | 52 |
53 } // namespace autocheckout | 53 } // namespace autocheckout |
54 } // namespace autofill | 54 } // namespace autofill |
55 | 55 |
56 #endif // CHROME_BROWSER_AUTOFILL_AUTOCHECKOUT_WHITELIST_MANAGER_FACTORY_H_ | 56 #endif // CHROME_BROWSER_AUTOFILL_AUTOCHECKOUT_WHITELIST_MANAGER_FACTORY_H_ |
OLD | NEW |