Chromium Code Reviews| 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..a02fde1ece79e50eecf39e5ce873ba352599e396 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 |
| @@ -199,7 +184,7 @@ WebDataServiceWrapper* WebDataServiceFactory::GetForProfile( |
| 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). |
| + // WebDataServiceFactory::GetAutofillWebDataForProfile (see below). |
| DCHECK(access_type != Profile::IMPLICIT_ACCESS || !profile->IsOffTheRecord()); |
| return static_cast<WebDataServiceWrapper*>( |
| GetInstance()->GetServiceForBrowserContext(profile, true)); |
| @@ -210,13 +195,27 @@ WebDataServiceWrapper* WebDataServiceFactory::GetForProfileIfExists( |
| 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). |
| + // WebDataServiceFactory::GetAutofillWebDataForProfile (see below). |
| DCHECK(access_type != Profile::IMPLICIT_ACCESS || !profile->IsOffTheRecord()); |
| return static_cast<WebDataServiceWrapper*>( |
| GetInstance()->GetServiceForBrowserContext(profile, false)); |
| } |
| // static |
| +scoped_refptr<AutofillWebDataService> |
| +WebDataServiceFactory::GetAutofillWebDataForProfile(Profile* profile) { |
|
Peter Kasting
2013/11/15 01:30:59
Nit: Indent 4
blundell
2013/11/19 14:05:37
No indentation after return type: http://google-st
|
| + // 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. |
|
Peter Kasting
2013/11/15 01:30:59
"Just a DCHECK" sounds kind of worrisome; DCHECKs
Jói
2013/11/15 13:25:34
It would be OK to bring back the parameter and DCH
blundell
2013/11/19 14:05:37
Added in the parameter.
On 2013/11/15 13:25:34, J
|
| + WebDataServiceWrapper* wrapper = |
| + WebDataServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); |
| + if (wrapper) |
| + return wrapper->GetAutofillWebData(); |
| + // |wrapper| can be NULL in Incognito mode. |
| + return scoped_refptr<AutofillWebDataService>(NULL); |
|
Peter Kasting
2013/11/15 01:30:59
Nit: Simpler:
// |wrapper| can be NULL in Incog
blundell
2013/11/19 14:05:37
Done.
|
| +} |
| + |
| +// static |
| WebDataServiceFactory* WebDataServiceFactory::GetInstance() { |
| return Singleton<WebDataServiceFactory>::get(); |
| } |