| 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 80be749151d61eaa050474e9cb91420248b72fa0..f5148df39515e48a9e3f9b89013d5aa06add4fa5 100644
|
| --- a/chrome/browser/webdata/web_data_service_factory.cc
|
| +++ b/chrome/browser/webdata/web_data_service_factory.cc
|
| @@ -8,11 +8,16 @@
|
| #include "base/files/file_path.h"
|
| #include "chrome/browser/profiles/profile_dependency_manager.h"
|
| #include "chrome/browser/ui/profile_error_dialog.h"
|
| +#include "chrome/browser/webdata/autocomplete_syncable_service.h"
|
| +#include "chrome/browser/webdata/autofill_profile_syncable_service.h"
|
| #include "chrome/browser/webdata/autofill_web_data_service_impl.h"
|
| #include "chrome/common/chrome_constants.h"
|
| +#include "content/public/browser/browser_thread.h"
|
| #include "grit/chromium_strings.h"
|
| #include "grit/generated_resources.h"
|
|
|
| +using content::BrowserThread;
|
| +
|
| namespace {
|
|
|
| // Callback to show error dialog on profile load error.
|
| @@ -22,13 +27,28 @@ void ProfileErrorCallback(sql::InitStatus status) {
|
| IDS_COULDNT_OPEN_PROFILE_ERROR : IDS_PROFILE_TOO_NEW_ERROR);
|
| }
|
|
|
| +void InitSyncableServicesOnDBThread(scoped_refptr<WebDataService> web_data) {
|
| + // Currently only Autocomplete and Autofill profiles use the new Sync API, but
|
| + // all the database data should migrate to this API over time.
|
| + AutocompleteSyncableService::AttachToWebData(
|
| + make_scoped_ptr(new AutocompleteSyncableService(web_data)),
|
| + web_data);
|
| + AutofillProfileSyncableService::AttachToWebData(
|
| + make_scoped_ptr(new AutofillProfileSyncableService(web_data)),
|
| + web_data);
|
| +}
|
| +
|
| } // namespace
|
|
|
| -WebDataServiceWrapper::WebDataServiceWrapper(Profile* profile){
|
| +WebDataServiceWrapper::WebDataServiceWrapper(Profile* profile) {
|
| base::FilePath path = profile->GetPath();
|
| path = path.Append(chrome::kWebDataFilename);
|
| web_data_service_ = new WebDataService(base::Bind(&ProfileErrorCallback));
|
| web_data_service_->Init(path);
|
| +
|
| + BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
|
| + base::Bind(&InitSyncableServicesOnDBThread,
|
| + web_data_service_));
|
| }
|
|
|
| // For testing.
|
| @@ -48,8 +68,8 @@ scoped_refptr<WebDataService> WebDataServiceWrapper::GetWebData() {
|
| }
|
|
|
| // static
|
| -scoped_refptr<AutofillWebDataService> AutofillWebDataService::FromBrowserContext(
|
| - content::BrowserContext* context) {
|
| +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.
|
|
|