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

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

Issue 12897009: Autofill Webdata Split TRY ONLY (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Try again 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_database_service.h"
14
15 class AutofillWebDataService;
16 class WebDataService;
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
31 virtual scoped_refptr<AutofillWebDataService> GetAutofillWebData();
32
28 virtual scoped_refptr<WebDataService> GetWebData(); 33 virtual scoped_refptr<WebDataService> GetWebData();
29 34
30 private: 35 private:
31 scoped_refptr<WebDataService> web_data_service_; 36 scoped_refptr<WebDatabaseService> web_database_;
37
38 scoped_refptr<AutofillWebDataService> autofill_web_data_;
39 scoped_refptr<WebDataService> web_data_;
32 40
33 DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper); 41 DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper);
34 }; 42 };
35 43
36 // Singleton that owns all WebDataServiceWrappers and associates them with 44 // Singleton that owns all WebDataServiceWrappers and associates them with
37 // Profiles. 45 // Profiles.
38 class WebDataServiceFactory : public ProfileKeyedServiceFactory { 46 class WebDataServiceFactory : public ProfileKeyedServiceFactory {
39 public: 47 public:
40 // Returns the |WebDataService| associated with the |profile|. 48 // Returns the |WebDataServiceWrapper| associated with the |profile|.
41 // |access_type| is either EXPLICIT_ACCESS or IMPLICIT_ACCESS 49 // |access_type| is either EXPLICIT_ACCESS or IMPLICIT_ACCESS
42 // (see its definition). 50 // (see its definition).
43 static scoped_refptr<WebDataService> GetForProfile( 51 static WebDataServiceWrapper* GetForProfile(
44 Profile* profile, Profile::ServiceAccessType access_type); 52 Profile* profile, Profile::ServiceAccessType access_type);
45 53
46 static scoped_refptr<WebDataService> GetForProfileIfExists( 54 static WebDataServiceWrapper* GetForProfileIfExists(
47 Profile* profile, Profile::ServiceAccessType access_type); 55 Profile* profile, Profile::ServiceAccessType access_type);
48 56
49 static WebDataServiceFactory* GetInstance(); 57 static WebDataServiceFactory* GetInstance();
50 58
51 private: 59 private:
52 friend struct DefaultSingletonTraits<WebDataServiceFactory>; 60 friend struct DefaultSingletonTraits<WebDataServiceFactory>;
53 61
54 WebDataServiceFactory(); 62 WebDataServiceFactory();
55 virtual ~WebDataServiceFactory(); 63 virtual ~WebDataServiceFactory();
56 64
57 // |ProfileKeyedBaseFactory| methods: 65 // |ProfileKeyedBaseFactory| methods:
58 virtual bool ServiceRedirectedInIncognito() const OVERRIDE; 66 virtual bool ServiceRedirectedInIncognito() const OVERRIDE;
59 virtual ProfileKeyedService* BuildServiceInstanceFor( 67 virtual ProfileKeyedService* BuildServiceInstanceFor(
60 Profile* profile) const OVERRIDE; 68 Profile* profile) const OVERRIDE;
61 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; 69 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
62 70
63 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory); 71 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory);
64 }; 72 };
65 73
66 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ 74 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__
OLDNEW
« no previous file with comments | « chrome/browser/webdata/web_data_service_base.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