Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: chrome/browser/webdata/web_data_service_factory.h

Issue 355573008: Split keyword related parts of WebDataService as KeywordWebDataService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/keyed_service/content/browser_context_keyed_service_factory .h" 12 #include "components/keyed_service/content/browser_context_keyed_service_factory .h"
13 #include "components/keyed_service/core/keyed_service.h" 13 #include "components/keyed_service/core/keyed_service.h"
14 #include "components/webdata/common/web_database_service.h" 14 #include "components/webdata/common/web_database_service.h"
15 15
16 class KeywordWebDataService;
16 class TokenWebData; 17 class TokenWebData;
17 class WebDataService; 18 class WebDataService;
18 19
19 namespace autofill { 20 namespace autofill {
20 class AutofillWebDataService; 21 class AutofillWebDataService;
21 } // namespace autofill 22 } // namespace autofill
22 23
23 // A wrapper of WebDataService so that we can use it as a profile keyed service. 24 // A wrapper of WebDataService so that we can use it as a profile keyed service.
24 class WebDataServiceWrapper : public KeyedService { 25 class WebDataServiceWrapper : public KeyedService {
25 public: 26 public:
26 explicit WebDataServiceWrapper(Profile* profile); 27 explicit WebDataServiceWrapper(Profile* profile);
27 28
28 // For testing. 29 // For testing.
29 WebDataServiceWrapper(); 30 WebDataServiceWrapper();
30 31
31 virtual ~WebDataServiceWrapper(); 32 virtual ~WebDataServiceWrapper();
32 33
33 // KeyedService: 34 // KeyedService:
34 virtual void Shutdown() OVERRIDE; 35 virtual void Shutdown() OVERRIDE;
35 36
36 virtual scoped_refptr<autofill::AutofillWebDataService> GetAutofillWebData(); 37 virtual scoped_refptr<autofill::AutofillWebDataService> GetAutofillWebData();
37 38
39 virtual scoped_refptr<KeywordWebDataService> GetKeywordWebData();
40
38 virtual scoped_refptr<WebDataService> GetWebData(); 41 virtual scoped_refptr<WebDataService> GetWebData();
39 42
40 virtual scoped_refptr<TokenWebData> GetTokenWebData(); 43 virtual scoped_refptr<TokenWebData> GetTokenWebData();
41 44
42 private: 45 private:
43 scoped_refptr<WebDatabaseService> web_database_; 46 scoped_refptr<WebDatabaseService> web_database_;
44 47
45 scoped_refptr<autofill::AutofillWebDataService> autofill_web_data_; 48 scoped_refptr<autofill::AutofillWebDataService> autofill_web_data_;
49 scoped_refptr<KeywordWebDataService> keyword_web_data_;
46 scoped_refptr<TokenWebData> token_web_data_; 50 scoped_refptr<TokenWebData> token_web_data_;
47 scoped_refptr<WebDataService> web_data_; 51 scoped_refptr<WebDataService> web_data_;
48 52
49 DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper); 53 DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper);
50 }; 54 };
51 55
52 // Singleton that owns all WebDataServiceWrappers and associates them with 56 // Singleton that owns all WebDataServiceWrappers and associates them with
53 // Profiles. 57 // Profiles.
54 class WebDataServiceFactory : public BrowserContextKeyedServiceFactory { 58 class WebDataServiceFactory : public BrowserContextKeyedServiceFactory {
55 public: 59 public:
56 // Returns the WebDataServiceWrapper associated with the |profile|. 60 // Returns the WebDataServiceWrapper associated with the |profile|.
57 static WebDataServiceWrapper* GetForProfile( 61 static WebDataServiceWrapper* GetForProfile(
58 Profile* profile, 62 Profile* profile,
59 Profile::ServiceAccessType access_type); 63 Profile::ServiceAccessType access_type);
60 64
61 static WebDataServiceWrapper* GetForProfileIfExists( 65 static WebDataServiceWrapper* GetForProfileIfExists(
62 Profile* profile, 66 Profile* profile,
63 Profile::ServiceAccessType access_type); 67 Profile::ServiceAccessType access_type);
64 68
65 // Returns the AutofillWebDataService associated with the |profile|. 69 // Returns the AutofillWebDataService associated with the |profile|.
66 static scoped_refptr<autofill::AutofillWebDataService> 70 static scoped_refptr<autofill::AutofillWebDataService>
67 GetAutofillWebDataForProfile(Profile* profile, 71 GetAutofillWebDataForProfile(Profile* profile,
68 Profile::ServiceAccessType access_type); 72 Profile::ServiceAccessType access_type);
69 73
74 // Returns the KeywordWebDataService associated with the |profile|.
75 static scoped_refptr<KeywordWebDataService>
76 GetKeywordWebDataForProfile(Profile* profile,
77 Profile::ServiceAccessType access_type);
78
70 // Returns the TokenWebData associated with the |profile|. 79 // Returns the TokenWebData associated with the |profile|.
71 static scoped_refptr<TokenWebData> GetTokenWebDataForProfile(Profile* profile, 80 static scoped_refptr<TokenWebData> GetTokenWebDataForProfile(Profile* profile,
72 Profile::ServiceAccessType access_type); 81 Profile::ServiceAccessType access_type);
73 82
74 static WebDataServiceFactory* GetInstance(); 83 static WebDataServiceFactory* GetInstance();
75 84
76 private: 85 private:
77 friend struct DefaultSingletonTraits<WebDataServiceFactory>; 86 friend struct DefaultSingletonTraits<WebDataServiceFactory>;
78 87
79 WebDataServiceFactory(); 88 WebDataServiceFactory();
80 virtual ~WebDataServiceFactory(); 89 virtual ~WebDataServiceFactory();
81 90
82 // |BrowserContextKeyedBaseFactory| methods: 91 // |BrowserContextKeyedBaseFactory| methods:
83 virtual content::BrowserContext* GetBrowserContextToUse( 92 virtual content::BrowserContext* GetBrowserContextToUse(
84 content::BrowserContext* context) const OVERRIDE; 93 content::BrowserContext* context) const OVERRIDE;
85 virtual KeyedService* BuildServiceInstanceFor( 94 virtual KeyedService* BuildServiceInstanceFor(
86 content::BrowserContext* profile) const OVERRIDE; 95 content::BrowserContext* profile) const OVERRIDE;
87 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; 96 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
88 97
89 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory); 98 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory);
90 }; 99 };
91 100
92 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ 101 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__
OLDNEW
« no previous file with comments | « chrome/browser/webdata/web_data_service.cc ('k') | chrome/browser/webdata/web_data_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698