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

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

Issue 12695015: Split Autofill webdata (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 "chrome/browser/profiles/profile_keyed_service_factory.h" 12 #include "chrome/browser/profiles/profile_keyed_service_factory.h"
13 #include "chrome/browser/webdata/web_data_service.h" 13 #include "chrome/browser/webdata/web_data_service.h"
14 #include "chrome/browser/webdata/web_database_service.h"
15
16 class AutofillWebDataService;
14 17
15 // A wrapper of WebDataService so that we can use it as a profile keyed service. 18 // A wrapper of WebDataService so that we can use it as a profile keyed service.
16 class WebDataServiceWrapper : public ProfileKeyedService { 19 class WebDataServiceWrapper : public ProfileKeyedService {
17 public: 20 public:
18 explicit WebDataServiceWrapper(Profile* profile); 21 explicit WebDataServiceWrapper(Profile* profile);
19 22
20 // For testing. 23 // For testing.
21 WebDataServiceWrapper(); 24 WebDataServiceWrapper();
22 25
23 virtual ~WebDataServiceWrapper(); 26 virtual ~WebDataServiceWrapper();
24 27
25 // ProfileKeyedService: 28 // ProfileKeyedService:
26 virtual void Shutdown() OVERRIDE; 29 virtual void Shutdown() OVERRIDE;
27 30
28 virtual scoped_refptr<WebDataService> GetWebData(); 31 virtual scoped_refptr<WebDataService> GetWebData();
29 32
33 virtual scoped_refptr<AutofillWebDataService> GetAutofillWebData();
34
30 private: 35 private:
31 scoped_refptr<WebDataService> web_data_service_; 36 scoped_refptr<WebDataService> web_data_service_;
37 scoped_refptr<WebDatabaseService> web_database_;
38 scoped_refptr<AutofillWebDataService> autofill_web_data_;
32 39
33 DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper); 40 DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper);
34 }; 41 };
35 42
36 // Singleton that owns all WebDataServiceWrappers and associates them with 43 // Singleton that owns all WebDataServiceWrappers and associates them with
37 // Profiles. 44 // Profiles.
38 class WebDataServiceFactory : public ProfileKeyedServiceFactory { 45 class WebDataServiceFactory : public ProfileKeyedServiceFactory {
39 public: 46 public:
47 // Returns the wrapper class.
48 static WebDataServiceWrapper* GetWrapper(
49 Profile* profile, Profile::ServiceAccessType access_type);
50
40 // Returns the |WebDataService| associated with the |profile|. 51 // Returns the |WebDataService| associated with the |profile|.
41 // |access_type| is either EXPLICIT_ACCESS or IMPLICIT_ACCESS 52 // |access_type| is either EXPLICIT_ACCESS or IMPLICIT_ACCESS
42 // (see its definition). 53 // (see its definition).
43 static scoped_refptr<WebDataService> GetForProfile( 54 static scoped_refptr<WebDataService> GetForProfile(
Jói 2013/03/19 20:53:58 Returning WebDataService here (and next one) no lo
Cait (Slow) 2013/03/20 22:21:10 Done.
44 Profile* profile, Profile::ServiceAccessType access_type); 55 Profile* profile, Profile::ServiceAccessType access_type);
45 56
46 static scoped_refptr<WebDataService> GetForProfileIfExists( 57 static scoped_refptr<WebDataService> GetForProfileIfExists(
47 Profile* profile, Profile::ServiceAccessType access_type); 58 Profile* profile, Profile::ServiceAccessType access_type);
48 59
49 static WebDataServiceFactory* GetInstance(); 60 static WebDataServiceFactory* GetInstance();
50 61
51 private: 62 private:
52 friend struct DefaultSingletonTraits<WebDataServiceFactory>; 63 friend struct DefaultSingletonTraits<WebDataServiceFactory>;
53 64
54 WebDataServiceFactory(); 65 WebDataServiceFactory();
55 virtual ~WebDataServiceFactory(); 66 virtual ~WebDataServiceFactory();
56 67
57 // |ProfileKeyedBaseFactory| methods: 68 // |ProfileKeyedBaseFactory| methods:
58 virtual bool ServiceRedirectedInIncognito() const OVERRIDE; 69 virtual bool ServiceRedirectedInIncognito() const OVERRIDE;
59 virtual ProfileKeyedService* BuildServiceInstanceFor( 70 virtual ProfileKeyedService* BuildServiceInstanceFor(
60 Profile* profile) const OVERRIDE; 71 Profile* profile) const OVERRIDE;
61 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; 72 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
62 73
63 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory); 74 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory);
64 }; 75 };
65 76
66 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ 77 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698