| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 scoped_refptr<TokenWebData> token_web_data_; | 46 scoped_refptr<TokenWebData> token_web_data_; |
| 47 scoped_refptr<WebDataService> web_data_; | 47 scoped_refptr<WebDataService> web_data_; |
| 48 | 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper); | 49 DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper); |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 // Singleton that owns all WebDataServiceWrappers and associates them with | 52 // Singleton that owns all WebDataServiceWrappers and associates them with |
| 53 // Profiles. | 53 // Profiles. |
| 54 class WebDataServiceFactory : public BrowserContextKeyedServiceFactory { | 54 class WebDataServiceFactory : public BrowserContextKeyedServiceFactory { |
| 55 public: | 55 public: |
| 56 // Returns the |WebDataServiceWrapper| associated with the |profile|. | 56 // Returns the WebDataServiceWrapper associated with the |profile|. |
| 57 // |access_type| is either EXPLICIT_ACCESS or IMPLICIT_ACCESS | |
| 58 // (see its definition). | |
| 59 static WebDataServiceWrapper* GetForProfile( | 57 static WebDataServiceWrapper* GetForProfile( |
| 60 Profile* profile, Profile::ServiceAccessType access_type); | 58 Profile* profile, |
| 59 Profile::ServiceAccessType access_type); |
| 61 | 60 |
| 62 static WebDataServiceWrapper* GetForProfileIfExists( | 61 static WebDataServiceWrapper* GetForProfileIfExists( |
| 63 Profile* profile, Profile::ServiceAccessType access_type); | 62 Profile* profile, |
| 63 Profile::ServiceAccessType access_type); |
| 64 |
| 65 // Returns the AutofillWebDataService associated with the |profile|. |
| 66 static scoped_refptr<autofill::AutofillWebDataService> |
| 67 GetAutofillWebDataForProfile(Profile* profile, |
| 68 Profile::ServiceAccessType access_type); |
| 64 | 69 |
| 65 static WebDataServiceFactory* GetInstance(); | 70 static WebDataServiceFactory* GetInstance(); |
| 66 | 71 |
| 67 private: | 72 private: |
| 68 friend struct DefaultSingletonTraits<WebDataServiceFactory>; | 73 friend struct DefaultSingletonTraits<WebDataServiceFactory>; |
| 69 | 74 |
| 70 WebDataServiceFactory(); | 75 WebDataServiceFactory(); |
| 71 virtual ~WebDataServiceFactory(); | 76 virtual ~WebDataServiceFactory(); |
| 72 | 77 |
| 73 // |BrowserContextKeyedBaseFactory| methods: | 78 // |BrowserContextKeyedBaseFactory| methods: |
| 74 virtual content::BrowserContext* GetBrowserContextToUse( | 79 virtual content::BrowserContext* GetBrowserContextToUse( |
| 75 content::BrowserContext* context) const OVERRIDE; | 80 content::BrowserContext* context) const OVERRIDE; |
| 76 virtual BrowserContextKeyedService* BuildServiceInstanceFor( | 81 virtual BrowserContextKeyedService* BuildServiceInstanceFor( |
| 77 content::BrowserContext* profile) const OVERRIDE; | 82 content::BrowserContext* profile) const OVERRIDE; |
| 78 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; | 83 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; |
| 79 | 84 |
| 80 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory); | 85 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory); |
| 81 }; | 86 }; |
| 82 | 87 |
| 83 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ | 88 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ |
| OLD | NEW |