Index: chrome/browser/webdata/web_data_service_factory.cc |
diff --git a/chrome/browser/webdata/web_data_service_factory.cc b/chrome/browser/webdata/web_data_service_factory.cc |
index 6663daa0c228b140fc0777c99632b1ae6113b315..85a2feb13dd78f8e4f8c8007e1ad76999afa4891 100644 |
--- a/chrome/browser/webdata/web_data_service_factory.cc |
+++ b/chrome/browser/webdata/web_data_service_factory.cc |
@@ -141,21 +141,6 @@ scoped_refptr<TokenWebData> WebDataServiceWrapper::GetTokenWebData() { |
} |
// static |
-scoped_refptr<AutofillWebDataService> |
-AutofillWebDataService::FromBrowserContext(content::BrowserContext* context) { |
- // For this service, the implicit/explicit distinction doesn't |
- // really matter; it's just used for a DCHECK. So we currently |
- // cheat and always say EXPLICIT_ACCESS. |
- WebDataServiceWrapper* wrapper = |
- WebDataServiceFactory::GetForProfile( |
- static_cast<Profile*>(context), Profile::EXPLICIT_ACCESS); |
- if (wrapper) |
- return wrapper->GetAutofillWebData(); |
- // |wrapper| can be NULL in Incognito mode. |
- return scoped_refptr<AutofillWebDataService>(NULL); |
-} |
- |
-// static |
scoped_refptr<TokenWebData> TokenWebData::FromBrowserContext( |
content::BrowserContext* context) { |
// For this service, the implicit/explicit distinction doesn't |
@@ -196,10 +181,11 @@ WebDataServiceFactory::~WebDataServiceFactory() {} |
// static |
WebDataServiceWrapper* WebDataServiceFactory::GetForProfile( |
- Profile* profile, Profile::ServiceAccessType access_type) { |
+ Profile* profile, |
+ Profile::ServiceAccessType access_type) { |
// If |access_type| starts being used for anything other than this |
// DCHECK, we need to start taking it as a parameter to |
- // AutofillWebDataService::FromBrowserContext (see above). |
+ // the *WebDataService::FromBrowserContext() functions (see above). |
DCHECK(access_type != Profile::IMPLICIT_ACCESS || !profile->IsOffTheRecord()); |
return static_cast<WebDataServiceWrapper*>( |
GetInstance()->GetServiceForBrowserContext(profile, true)); |
@@ -207,16 +193,30 @@ WebDataServiceWrapper* WebDataServiceFactory::GetForProfile( |
// static |
WebDataServiceWrapper* WebDataServiceFactory::GetForProfileIfExists( |
- Profile* profile, Profile::ServiceAccessType access_type) { |
+ Profile* profile, |
+ Profile::ServiceAccessType access_type) { |
// If |access_type| starts being used for anything other than this |
// DCHECK, we need to start taking it as a parameter to |
- // AutofillWebDataService::FromBrowserContext (see above). |
+ // the *WebDataService::FromBrowserContext() functions (see above). |
DCHECK(access_type != Profile::IMPLICIT_ACCESS || !profile->IsOffTheRecord()); |
return static_cast<WebDataServiceWrapper*>( |
GetInstance()->GetServiceForBrowserContext(profile, false)); |
} |
// static |
+scoped_refptr<AutofillWebDataService> |
+WebDataServiceFactory::GetAutofillWebDataForProfile( |
+ Profile* profile, |
+ Profile::ServiceAccessType access_type) { |
+ WebDataServiceWrapper* wrapper = |
+ WebDataServiceFactory::GetForProfile(profile, access_type); |
+ // |wrapper| can be NULL in Incognito mode. |
+ return wrapper ? |
+ wrapper->GetAutofillWebData() : |
+ scoped_refptr<AutofillWebDataService>(NULL); |
+} |
+ |
+// static |
WebDataServiceFactory* WebDataServiceFactory::GetInstance() { |
return Singleton<WebDataServiceFactory>::get(); |
} |