Index: chrome/browser/sync/profile_sync_service.cc |
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc |
index ca3926fc6acb27490d83a7f577754ec6b2792c48..d18185fb20d35e134e01b0bd1555fcb57fa510b7 100644 |
--- a/chrome/browser/sync/profile_sync_service.cc |
+++ b/chrome/browser/sync/profile_sync_service.cc |
@@ -428,7 +428,8 @@ void ProfileSyncService::StartUp() { |
// TODO(akalin): Fix this horribly non-intuitive behavior (see |
// http://crbug.com/140354). |
if (backend_.get()) { |
- backend_->UpdateRegisteredInvalidationIds(all_registered_ids_); |
+ backend_->UpdateRegisteredInvalidationIds( |
+ notifier_registrar_.GetAllRegisteredIds()); |
} |
if (!sync_global_error_.get()) { |
@@ -441,17 +442,29 @@ void ProfileSyncService::StartUp() { |
} |
} |
+void ProfileSyncService::RegisterInvalidationHandler( |
+ syncer::SyncNotifierObserver* handler) { |
+ notifier_registrar_.RegisterHandler(handler); |
+} |
+ |
void ProfileSyncService::UpdateRegisteredInvalidationIds( |
syncer::SyncNotifierObserver* handler, |
const syncer::ObjectIdSet& ids) { |
- all_registered_ids_ = notifier_helper_.UpdateRegisteredIds(handler, ids); |
+ notifier_registrar_.UpdateRegisteredIds(handler, ids); |
+ |
// If |backend_| is NULL, its registered IDs will be updated when |
// it's created and initialized. |
if (backend_.get()) { |
- backend_->UpdateRegisteredInvalidationIds(all_registered_ids_); |
+ backend_->UpdateRegisteredInvalidationIds( |
+ notifier_registrar_.GetAllRegisteredIds()); |
} |
} |
+void ProfileSyncService::UnregisterInvalidationHandler( |
+ syncer::SyncNotifierObserver* handler) { |
+ notifier_registrar_.UnregisterHandler(handler); |
+} |
+ |
void ProfileSyncService::Shutdown() { |
ShutdownImpl(false); |
} |
@@ -464,7 +477,6 @@ void ProfileSyncService::ShutdownImpl(bool sync_disabled) { |
base::Time shutdown_start_time = base::Time::Now(); |
if (backend_.get()) { |
backend_->StopSyncingForShutdown(); |
- backend_->UpdateRegisteredInvalidationIds(syncer::ObjectIdSet()); |
} |
// Stop all data type controllers, if needed. Note that until Stop |
@@ -659,18 +671,18 @@ void ProfileSyncService::DisableBrokenDatatype( |
} |
void ProfileSyncService::OnNotificationsEnabled() { |
- notifier_helper_.EmitOnNotificationsEnabled(); |
+ notifier_registrar_.EmitOnNotificationsEnabled(); |
} |
void ProfileSyncService::OnNotificationsDisabled( |
syncer::NotificationsDisabledReason reason) { |
- notifier_helper_.EmitOnNotificationsDisabled(reason); |
+ notifier_registrar_.EmitOnNotificationsDisabled(reason); |
} |
void ProfileSyncService::OnIncomingNotification( |
const syncer::ObjectIdPayloadMap& id_payloads, |
syncer::IncomingNotificationSource source) { |
- notifier_helper_.DispatchInvalidationsToHandlers(id_payloads, source); |
+ notifier_registrar_.DispatchInvalidationsToHandlers(id_payloads, source); |
} |
void ProfileSyncService::OnBackendInitialized( |