| OLD | NEW |
| 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" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 ProfileKeyedServiceFactory { |
| 51 public: | 51 public: |
| 52 // Returns the |WebDataServiceWrapper| associated with the |profile|. | 52 static scoped_refptr<WebDataService> GetWebDataServiceForProfile( |
| 53 // |access_type| is either EXPLICIT_ACCESS or IMPLICIT_ACCESS | 53 Profile* profile); |
| 54 // (see its definition). | 54 static scoped_refptr<WebDataService> GetWebDataServiceForProfileIfExists( |
| 55 static WebDataServiceWrapper* GetForProfile( | 55 Profile* profile); |
| 56 Profile* profile, Profile::ServiceAccessType access_type); | |
| 57 | 56 |
| 58 static WebDataServiceWrapper* GetForProfileIfExists( | 57 static scoped_refptr<autofill::AutofillWebDataService> |
| 59 Profile* profile, Profile::ServiceAccessType access_type); | 58 GetAutofillWebDataServiceForProfile(Profile* profile); |
| 60 | 59 |
| 61 static WebDataServiceFactory* GetInstance(); | 60 static WebDataServiceFactory* GetInstance(); |
| 62 | 61 |
| 63 private: | 62 private: |
| 64 friend struct DefaultSingletonTraits<WebDataServiceFactory>; | 63 friend struct DefaultSingletonTraits<WebDataServiceFactory>; |
| 65 | 64 |
| 65 // Returns the |WebDataServiceWrapper| associated with the |profile|. |
| 66 // |access_type| is either EXPLICIT_ACCESS or IMPLICIT_ACCESS |
| 67 // (see its definition). |
| 68 static WebDataServiceWrapper* GetForProfile( |
| 69 Profile* profile, |
| 70 Profile::ServiceAccessType access_type, |
| 71 bool create_if_not_exist); |
| 72 |
| 66 WebDataServiceFactory(); | 73 WebDataServiceFactory(); |
| 67 virtual ~WebDataServiceFactory(); | 74 virtual ~WebDataServiceFactory(); |
| 68 | 75 |
| 69 // |ProfileKeyedBaseFactory| methods: | 76 // |ProfileKeyedBaseFactory| methods: |
| 70 virtual bool ServiceRedirectedInIncognito() const OVERRIDE; | 77 virtual bool ServiceRedirectedInIncognito() const OVERRIDE; |
| 71 virtual ProfileKeyedService* BuildServiceInstanceFor( | 78 virtual ProfileKeyedService* BuildServiceInstanceFor( |
| 72 Profile* profile) const OVERRIDE; | 79 Profile* profile) const OVERRIDE; |
| 73 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; | 80 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; |
| 74 | 81 |
| 75 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory); | 82 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory); |
| 76 }; | 83 }; |
| 77 | 84 |
| 78 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ | 85 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ |
| OLD | NEW |