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

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: Rebase Created 7 years 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
« no previous file with comments | « chrome/browser/webdata/web_data_service_factory.h ('k') | components/autofill/core/browser/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « chrome/browser/webdata/web_data_service_factory.h ('k') | components/autofill/core/browser/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698