Chromium Code Reviews| Index: chrome/browser/webdata/web_data_service.cc |
| diff --git a/chrome/browser/webdata/web_data_service.cc b/chrome/browser/webdata/web_data_service.cc |
| index 80fae6321842d23633af8abdc194a50135b32568..9401da45b2f6333dbd46009429f2b7db775c1fee 100644 |
| --- a/chrome/browser/webdata/web_data_service.cc |
| +++ b/chrome/browser/webdata/web_data_service.cc |
| @@ -15,6 +15,7 @@ |
| #include "chrome/browser/ui/profile_error_dialog.h" |
| #include "chrome/browser/webdata/autofill_change.h" |
| #include "chrome/browser/webdata/autofill_entry.h" |
| +#include "chrome/browser/webdata/autofill_profile_syncable_service.h" |
| #include "chrome/browser/webdata/autofill_table.h" |
| #include "chrome/browser/webdata/keyword_table.h" |
| #include "chrome/browser/webdata/logins_table.h" |
| @@ -74,6 +75,7 @@ WDKeywordsResult::~WDKeywordsResult() {} |
| WebDataService::WebDataService() |
| : is_running_(false), |
| db_(NULL), |
| + autofill_profile_syncable_service_(NULL), |
| failed_init_(false), |
| should_commit_(false), |
| next_request_handle_(1), |
| @@ -101,6 +103,7 @@ bool WebDataService::Init(const FilePath& profile_path) { |
| } |
| void WebDataService::Shutdown() { |
| + ScheduleTask(Bind(&WebDataService::ShutdownSyncableServices, this)); |
| UnloadDatabase(); |
| } |
| @@ -538,6 +541,7 @@ bool WebDataService::InitWithPath(const FilePath& path) { |
| path_ = path; |
| is_running_ = true; |
| ScheduleTask(Bind(&WebDataService::InitializeDatabaseIfNecessary, this)); |
| + ScheduleTask(Bind(&WebDataService::InitializeSyncableServices, this)); |
| return true; |
| } |
| @@ -628,6 +632,11 @@ void WebDataService::InitializeDatabaseIfNecessary() { |
| db_->BeginTransaction(); |
| } |
| +void WebDataService::InitializeSyncableServices() { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| + autofill_profile_syncable_service_ = new AutofillProfileSyncableService(this); |
|
dhollowa
2011/10/11 22:48:34
A DCHECK(!autofill_profile_syncable_service_) here
Ilya Sherman
2011/10/11 23:07:11
Done.
|
| +} |
| + |
| void WebDataService::NotifyDatabaseLoadedOnUIThread() { |
| // Notify that the database has been initialized. |
| NotificationService::current()->Notify( |
| @@ -645,6 +654,13 @@ void WebDataService::ShutdownDatabase() { |
| } |
| } |
| +void WebDataService::ShutdownSyncableServices() { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| + |
| + delete autofill_profile_syncable_service_; |
| + autofill_profile_syncable_service_ = NULL; |
| +} |
| + |
| void WebDataService::Commit() { |
| if (should_commit_) { |
| should_commit_ = false; |
| @@ -1360,6 +1376,14 @@ void WebDataService::RemoveAutofillProfilesAndCreditCardsModifiedBetweenImpl( |
| request->RequestComplete(); |
| } |
| +AutofillProfileSyncableService* |
| + WebDataService::GetAutofillProfileSyncableService() const { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| + DCHECK(autofill_profile_syncable_service_); // Make sure we're initialized. |
| + |
| + return autofill_profile_syncable_service_; |
| +} |
| + |
| //////////////////////////////////////////////////////////////////////////////// |
| // |
| // WebDataRequest implementation. |