| Index: chrome/browser/webdata/autocomplete_syncable_service.cc
|
| diff --git a/chrome/browser/webdata/autocomplete_syncable_service.cc b/chrome/browser/webdata/autocomplete_syncable_service.cc
|
| index f635e60c0a67eca042c5f954956c91017967f2b5..9fca26e8d06fae4cf62dca939276f2ff30524d88 100644
|
| --- a/chrome/browser/webdata/autocomplete_syncable_service.cc
|
| +++ b/chrome/browser/webdata/autocomplete_syncable_service.cc
|
| @@ -11,9 +11,7 @@
|
| #include "chrome/browser/webdata/autofill_table.h"
|
| #include "chrome/browser/webdata/web_data_service.h"
|
| #include "chrome/browser/webdata/web_database.h"
|
| -#include "chrome/common/chrome_notification_types.h"
|
| #include "content/public/browser/browser_thread.h"
|
| -#include "content/public/browser/notification_service.h"
|
| #include "net/base/escape.h"
|
| #include "sync/api/sync_error.h"
|
| #include "sync/api/sync_error_factory.h"
|
| @@ -87,13 +85,13 @@ AutocompleteSyncableService::AutocompleteSyncableService(
|
| cull_expired_entries_(false) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
|
| DCHECK(web_data_service_);
|
| - notification_registrar_.Add(
|
| - this, chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED,
|
| - content::Source<WebDataService>(web_data_service));
|
| + web_data_service_->AddObserver(this);
|
| }
|
|
|
| AutocompleteSyncableService::~AutocompleteSyncableService() {
|
| DCHECK(CalledOnValidThread());
|
| + if (web_data_service_)
|
| + web_data_service_->RemoveObserver(this);
|
| }
|
|
|
| AutocompleteSyncableService::AutocompleteSyncableService()
|
| @@ -277,24 +275,14 @@ syncer::SyncError AutocompleteSyncableService::ProcessSyncChanges(
|
| return list_processing_error;
|
| }
|
|
|
| -void AutocompleteSyncableService::Observe(int type,
|
| - const content::NotificationSource& source,
|
| - const content::NotificationDetails& details) {
|
| - DCHECK_EQ(chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED, type);
|
| -
|
| +void AutocompleteSyncableService::AutofillEntriesChanged(
|
| + const AutofillChangeList& changes) {
|
| // Check if sync is on. If we receive notification prior to the sync being set
|
| // up we are going to process all when MergeData..() is called. If we receive
|
| // notification after the sync exited, it will be sinced next time Chrome
|
| // starts.
|
| - if (!sync_processor_.get())
|
| - return;
|
| - WebDataService* wds = content::Source<WebDataService>(source).ptr();
|
| -
|
| - DCHECK_EQ(web_data_service_, wds);
|
| -
|
| - AutofillChangeList* changes =
|
| - content::Details<AutofillChangeList>(details).ptr();
|
| - ActOnChanges(*changes);
|
| + if (sync_processor_.get())
|
| + ActOnChanges(changes);
|
| }
|
|
|
| bool AutocompleteSyncableService::LoadAutofillData(
|
|
|