| 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());
|
|
|