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

Unified Diff: chrome/browser/webdata/web_data_service_factory.cc

Issue 72613006: Eliminate AutofillWebDataService::FromBrowserContext(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to reviews Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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..e6e043655933c47b672047246f34b66bc21728b3 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) {
Peter Kasting 2013/11/19 19:14:15 Nit: While here: Same comment about one arg per li
blundell 2013/12/02 16:10:59 Done.
// 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));
@@ -210,13 +195,25 @@ 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).
+ // 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(
Peter Kasting 2013/11/19 19:14:15 Nit: Indent 4
blundell 2013/12/02 16:10:59 No indentation after return type: http://google-st
+ Profile* profile, Profile::ServiceAccessType access_type) {
+ WebDataServiceWrapper* wrapper =
+ WebDataServiceFactory::GetForProfile(profile, access_type);
+ // |wrapper| can be NULL in Incognito mode.
+ return wrapper ?
+ wrapper->GetAutofillWebData() :
Peter Kasting 2013/11/19 19:14:15 Nit: Indent 4, not 2
blundell 2013/12/02 16:10:59 Done.
+ scoped_refptr<AutofillWebDataService>(NULL);
+}
+
+// static
WebDataServiceFactory* WebDataServiceFactory::GetInstance() {
return Singleton<WebDataServiceFactory>::get();
}

Powered by Google App Engine
This is Rietveld 408576698