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

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

Issue 10908065: Introduce a couple of abstract bases for WebDataService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to comments Created 8 years, 3 months 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') | chrome/chrome_browser.gypi » ('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 f86f28fd12b88c0580eb5f88245ef94eaedaf5aa..81b1dee818e53eb1dfc9495c556baeddcf4f5824 100644
--- a/chrome/browser/webdata/web_data_service_factory.cc
+++ b/chrome/browser/webdata/web_data_service_factory.cc
@@ -6,9 +6,27 @@
#include "base/file_path.h"
#include "chrome/browser/profiles/profile_dependency_manager.h"
+#include "chrome/browser/webdata/autofill_web_data_service_impl.h"
#include "chrome/browser/webdata/web_data_service.h"
#include "chrome/common/chrome_constants.h"
+// static
+scoped_ptr<AutofillWebDataService> AutofillWebDataService::ForContext(
+ 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.
+ scoped_refptr<WebDataService> service = WebDataServiceFactory::GetForProfile(
+ static_cast<Profile*>(context), Profile::EXPLICIT_ACCESS);
+
+ if (service.get()) {
+ return scoped_ptr<AutofillWebDataService>(
+ new AutofillWebDataServiceImpl(service));
+ } else {
+ return scoped_ptr<AutofillWebDataService>(NULL);
+ }
+}
+
WebDataServiceFactory::WebDataServiceFactory()
: RefcountedProfileKeyedServiceFactory(
"WebDataService",
@@ -21,6 +39,9 @@ WebDataServiceFactory::~WebDataServiceFactory() {}
// static
scoped_refptr<WebDataService> 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
+ // AutofillWebDataServiceImpl::ForContext (see above).
DCHECK(access_type != Profile::IMPLICIT_ACCESS || !profile->IsOffTheRecord());
return static_cast<WebDataService*>(
GetInstance()->GetServiceForProfile(profile, true).get());
« no previous file with comments | « chrome/browser/webdata/web_data_service_factory.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698