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

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

Issue 15517005: Remove references to Profile from browser_context_keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & style Created 7 years, 7 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/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 WebDataService; 16 class WebDataService;
17 17
18 namespace autofill { 18 namespace autofill {
19 class AutofillWebDataService; 19 class AutofillWebDataService;
20 } // namespace autofill 20 } // namespace autofill
21 21
22 // A wrapper of WebDataService so that we can use it as a profile keyed service. 22 // A wrapper of WebDataService so that we can use it as a profile keyed service.
23 class WebDataServiceWrapper : public ProfileKeyedService { 23 class WebDataServiceWrapper : public BrowserContextKeyedService {
24 public: 24 public:
25 explicit WebDataServiceWrapper(Profile* profile); 25 explicit WebDataServiceWrapper(Profile* profile);
26 26
27 // For testing. 27 // For testing.
28 WebDataServiceWrapper(); 28 WebDataServiceWrapper();
29 29
30 virtual ~WebDataServiceWrapper(); 30 virtual ~WebDataServiceWrapper();
31 31
32 // ProfileKeyedService: 32 // BrowserContextKeyedService:
33 virtual void Shutdown() OVERRIDE; 33 virtual void Shutdown() OVERRIDE;
34 34
35 virtual scoped_refptr<autofill::AutofillWebDataService> GetAutofillWebData(); 35 virtual scoped_refptr<autofill::AutofillWebDataService> GetAutofillWebData();
36 36
37 virtual scoped_refptr<WebDataService> GetWebData(); 37 virtual scoped_refptr<WebDataService> GetWebData();
38 38
39 private: 39 private:
40 scoped_refptr<WebDatabaseService> web_database_; 40 scoped_refptr<WebDatabaseService> web_database_;
41 41
42 scoped_refptr<autofill::AutofillWebDataService> autofill_web_data_; 42 scoped_refptr<autofill::AutofillWebDataService> autofill_web_data_;
43 scoped_refptr<WebDataService> web_data_; 43 scoped_refptr<WebDataService> web_data_;
44 44
45 DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper); 45 DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper);
46 }; 46 };
47 47
48 // Singleton that owns all WebDataServiceWrappers and associates them with 48 // Singleton that owns all WebDataServiceWrappers and associates them with
49 // Profiles. 49 // Profiles.
50 class WebDataServiceFactory : public ProfileKeyedServiceFactory { 50 class WebDataServiceFactory : public BrowserContextKeyedServiceFactory {
51 public: 51 public:
52 // Returns the |WebDataServiceWrapper| associated with the |profile|. 52 // Returns the |WebDataServiceWrapper| associated with the |profile|.
53 // |access_type| is either EXPLICIT_ACCESS or IMPLICIT_ACCESS 53 // |access_type| is either EXPLICIT_ACCESS or IMPLICIT_ACCESS
54 // (see its definition). 54 // (see its definition).
55 static WebDataServiceWrapper* GetForProfile( 55 static WebDataServiceWrapper* GetForProfile(
56 Profile* profile, Profile::ServiceAccessType access_type); 56 Profile* profile, Profile::ServiceAccessType access_type);
57 57
58 static WebDataServiceWrapper* GetForProfileIfExists( 58 static WebDataServiceWrapper* GetForProfileIfExists(
59 Profile* profile, Profile::ServiceAccessType access_type); 59 Profile* profile, Profile::ServiceAccessType access_type);
60 60
61 static WebDataServiceFactory* GetInstance(); 61 static WebDataServiceFactory* GetInstance();
62 62
63 private: 63 private:
64 friend struct DefaultSingletonTraits<WebDataServiceFactory>; 64 friend struct DefaultSingletonTraits<WebDataServiceFactory>;
65 65
66 WebDataServiceFactory(); 66 WebDataServiceFactory();
67 virtual ~WebDataServiceFactory(); 67 virtual ~WebDataServiceFactory();
68 68
69 // |ProfileKeyedBaseFactory| methods: 69 // |BrowserContextKeyedBaseFactory| methods:
70 virtual content::BrowserContext* GetBrowserContextToUse( 70 virtual content::BrowserContext* GetBrowserContextToUse(
71 content::BrowserContext* context) const OVERRIDE; 71 content::BrowserContext* context) const OVERRIDE;
72 virtual ProfileKeyedService* BuildServiceInstanceFor( 72 virtual BrowserContextKeyedService* BuildServiceInstanceFor(
73 content::BrowserContext* profile) const OVERRIDE; 73 content::BrowserContext* profile) const OVERRIDE;
74 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; 74 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
75 75
76 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory); 76 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory);
77 }; 77 };
78 78
79 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ 79 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698