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

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

Issue 12491017: Make WebDataService no longer depend on ProfileKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean-up 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/singleton.h" 10 #include "base/memory/singleton.h"
10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/profiles/refcounted_profile_keyed_service_factory.h" 12 #include "chrome/browser/profiles/profile_keyed_service_factory.h"
13 #include "chrome/browser/webdata/web_data_service.h"
12 14
13 class WebDataService; 15 // A wrapper of WebDataService so that we can use it as a profile keyed service.
16 class WebDataServiceWrapper : public ProfileKeyedService {
17 public:
18 WebDataServiceWrapper(Profile* profile);
14 19
15 class WebDataServiceFactory : public RefcountedProfileKeyedServiceFactory { 20 // For testing.
21 WebDataServiceWrapper() {};
22
23 virtual ~WebDataServiceWrapper();
24
25 // ProfileKeyedService:
26 virtual void Shutdown() OVERRIDE;
27
28 virtual scoped_refptr<WebDataService> GetWebData();
29
30 private:
31 scoped_refptr<WebDataService> web_data_service_;
32 };
dhollowa 2013/03/18 18:50:59 DISALLOW_COPY_AND_ASSIGN
Cait (Slow) 2013/03/18 19:10:35 Done.
33
34
35 // Singleton that owns all PersonalDataManagers and associates them with
36 // Profiles.
37 // Listens for the Profile's destruction notification and cleans up the
38 // associated PersonalDataManager.
39 class WebDataServiceFactory : public ProfileKeyedServiceFactory {
16 public: 40 public:
17 // Returns the |WebDataService| associated with the |profile|. 41 // Returns the |WebDataService| associated with the |profile|.
18 // |access_type| is either EXPLICIT_ACCESS or IMPLICIT_ACCESS 42 // |access_type| is either EXPLICIT_ACCESS or IMPLICIT_ACCESS
19 // (see its definition). 43 // (see its definition).
20 static scoped_refptr<WebDataService> GetForProfile( 44 static scoped_refptr<WebDataService> GetForProfile(
21 Profile* profile, Profile::ServiceAccessType access_type); 45 Profile* profile, Profile::ServiceAccessType access_type);
22 46
23 static scoped_refptr<WebDataService> GetForProfileIfExists( 47 static scoped_refptr<WebDataService> GetForProfileIfExists(
24 Profile* profile, Profile::ServiceAccessType access_type); 48 Profile* profile, Profile::ServiceAccessType access_type);
25 49
26 static WebDataServiceFactory* GetInstance(); 50 static WebDataServiceFactory* GetInstance();
27 51
28 private: 52 private:
29 friend struct DefaultSingletonTraits<WebDataServiceFactory>; 53 friend struct DefaultSingletonTraits<WebDataServiceFactory>;
30 54
31 WebDataServiceFactory(); 55 WebDataServiceFactory();
32 virtual ~WebDataServiceFactory(); 56 virtual ~WebDataServiceFactory();
33 57
34 // |ProfileKeyedBaseFactory| methods: 58 // |ProfileKeyedBaseFactory| methods:
35 virtual bool ServiceRedirectedInIncognito() const OVERRIDE; 59 virtual bool ServiceRedirectedInIncognito() const OVERRIDE;
36 virtual scoped_refptr<RefcountedProfileKeyedService> BuildServiceInstanceFor( 60 virtual ProfileKeyedService* BuildServiceInstanceFor(
37 Profile* profile) const OVERRIDE; 61 Profile* profile) const OVERRIDE;
38 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; 62 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
dhollowa 2013/03/18 18:50:59 DISALLOW_COPY_AND_ASSIGN
Cait (Slow) 2013/03/18 19:10:35 Done.
39 }; 63 };
40 64
41 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ 65 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698