OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ | 5 #ifndef CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ |
6 #define CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ | 6 #define CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 12 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
13 #include "components/browser_context_keyed_service/browser_context_keyed_service
_factory.h" | 13 #include "components/browser_context_keyed_service/browser_context_keyed_service
_factory.h" |
14 #include "components/webdata/common/web_database_service.h" | 14 #include "components/webdata/common/web_database_service.h" |
15 | 15 |
| 16 class TokenWebData; |
16 class WebDataService; | 17 class WebDataService; |
17 | 18 |
18 namespace autofill { | 19 namespace autofill { |
19 class AutofillWebDataService; | 20 class AutofillWebDataService; |
20 } // namespace autofill | 21 } // namespace autofill |
21 | 22 |
22 // A wrapper of WebDataService so that we can use it as a profile keyed service. | 23 // A wrapper of WebDataService so that we can use it as a profile keyed service. |
23 class WebDataServiceWrapper : public BrowserContextKeyedService { | 24 class WebDataServiceWrapper : public BrowserContextKeyedService { |
24 public: | 25 public: |
25 explicit WebDataServiceWrapper(Profile* profile); | 26 explicit WebDataServiceWrapper(Profile* profile); |
26 | 27 |
27 // For testing. | 28 // For testing. |
28 WebDataServiceWrapper(); | 29 WebDataServiceWrapper(); |
29 | 30 |
30 virtual ~WebDataServiceWrapper(); | 31 virtual ~WebDataServiceWrapper(); |
31 | 32 |
32 // BrowserContextKeyedService: | 33 // BrowserContextKeyedService: |
33 virtual void Shutdown() OVERRIDE; | 34 virtual void Shutdown() OVERRIDE; |
34 | 35 |
35 virtual scoped_refptr<autofill::AutofillWebDataService> GetAutofillWebData(); | 36 virtual scoped_refptr<autofill::AutofillWebDataService> GetAutofillWebData(); |
36 | 37 |
37 virtual scoped_refptr<WebDataService> GetWebData(); | 38 virtual scoped_refptr<WebDataService> GetWebData(); |
38 | 39 |
| 40 virtual scoped_refptr<TokenWebData> GetTokenWebData(); |
| 41 |
39 private: | 42 private: |
40 scoped_refptr<WebDatabaseService> web_database_; | 43 scoped_refptr<WebDatabaseService> web_database_; |
41 | 44 |
42 scoped_refptr<autofill::AutofillWebDataService> autofill_web_data_; | 45 scoped_refptr<autofill::AutofillWebDataService> autofill_web_data_; |
| 46 scoped_refptr<TokenWebData> token_web_data_; |
43 scoped_refptr<WebDataService> web_data_; | 47 scoped_refptr<WebDataService> web_data_; |
44 | 48 |
45 DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper); | 49 DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper); |
46 }; | 50 }; |
47 | 51 |
48 // Singleton that owns all WebDataServiceWrappers and associates them with | 52 // Singleton that owns all WebDataServiceWrappers and associates them with |
49 // Profiles. | 53 // Profiles. |
50 class WebDataServiceFactory : public BrowserContextKeyedServiceFactory { | 54 class WebDataServiceFactory : public BrowserContextKeyedServiceFactory { |
51 public: | 55 public: |
52 // Returns the |WebDataServiceWrapper| associated with the |profile|. | 56 // Returns the |WebDataServiceWrapper| associated with the |profile|. |
(...skipping 17 matching lines...) Expand all Loading... |
70 virtual content::BrowserContext* GetBrowserContextToUse( | 74 virtual content::BrowserContext* GetBrowserContextToUse( |
71 content::BrowserContext* context) const OVERRIDE; | 75 content::BrowserContext* context) const OVERRIDE; |
72 virtual BrowserContextKeyedService* BuildServiceInstanceFor( | 76 virtual BrowserContextKeyedService* BuildServiceInstanceFor( |
73 content::BrowserContext* profile) const OVERRIDE; | 77 content::BrowserContext* profile) const OVERRIDE; |
74 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; | 78 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; |
75 | 79 |
76 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory); | 80 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory); |
77 }; | 81 }; |
78 | 82 |
79 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ | 83 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ |
OLD | NEW |