Index: sync/internal_api/sync_manager.cc |
diff --git a/sync/internal_api/sync_manager.cc b/sync/internal_api/sync_manager.cc |
index 5921739ccfd933245f226819ded818745c50085d..def878067920f8f60601bfb484dc7f6ebc71f123 100644 |
--- a/sync/internal_api/sync_manager.cc |
+++ b/sync/internal_api/sync_manager.cc |
@@ -318,12 +318,11 @@ class SyncManager::SyncInternal |
bool encrypt_everything) OVERRIDE; |
// SyncNotifierObserver implementation. |
- virtual void OnNotificationStateChange( |
- bool notifications_enabled) OVERRIDE; |
- |
virtual void OnIncomingNotification( |
const syncable::ModelTypePayloadMap& type_payloads, |
sync_notifier::IncomingNotificationSource source) OVERRIDE; |
+ virtual void OnSyncNotifierStateChange( |
+ sync_notifier::SyncNotifierState sync_notifier_state) OVERRIDE; |
void AddObserver(SyncManager::Observer* observer); |
void RemoveObserver(SyncManager::Observer* observer); |
@@ -2295,10 +2294,23 @@ void SyncManager::SyncInternal::OnEncryptedTypesChanged( |
OnEncryptedTypesChanged(encrypted_types, encrypt_everything)); |
} |
-void SyncManager::SyncInternal::OnNotificationStateChange( |
- bool notifications_enabled) { |
- DVLOG(1) << "P2P: Notifications enabled = " |
- << (notifications_enabled ? "true" : "false"); |
+void SyncManager::SyncInternal::UpdateNotificationInfo( |
+ const syncable::ModelTypePayloadMap& type_payloads) { |
+ for (syncable::ModelTypePayloadMap::const_iterator it = type_payloads.begin(); |
+ it != type_payloads.end(); ++it) { |
+ NotificationInfo* info = ¬ification_info_map_[it->first]; |
+ info->total_count++; |
+ info->payload = it->second; |
+ } |
+} |
+ |
+void SyncManager::SyncInternal::OnSyncNotifierStateChange( |
+ sync_notifier::SyncNotifierState sync_notifier_state) { |
+ DVLOG(1) << "SyncNotifierState: " |
+ << sync_notifier::SyncNotifierStateToString( |
+ sync_notifier_state); |
+ const bool notifications_enabled = |
+ (sync_notifier_state == sync_notifier::NOTIFICATIONS_ON); |
allstatus_.SetNotificationsEnabled(notifications_enabled); |
if (scheduler()) { |
scheduler()->set_notifications_enabled(notifications_enabled); |
@@ -2311,16 +2323,8 @@ void SyncManager::SyncInternal::OnNotificationStateChange( |
"onNotificationStateChange", |
JsEventDetails(&details)); |
} |
-} |
- |
-void SyncManager::SyncInternal::UpdateNotificationInfo( |
- const syncable::ModelTypePayloadMap& type_payloads) { |
- for (syncable::ModelTypePayloadMap::const_iterator it = type_payloads.begin(); |
- it != type_payloads.end(); ++it) { |
- NotificationInfo* info = ¬ification_info_map_[it->first]; |
- info->total_count++; |
- info->payload = it->second; |
- } |
+ // TODO(akalin): Treat a CREDENTIALS_REJECTED state as an auth |
+ // error. |
} |
void SyncManager::SyncInternal::OnIncomingNotification( |
@@ -2434,10 +2438,10 @@ bool SyncManager::HasUnsyncedItems() const { |
return (trans.GetWrappedTrans()->directory()->unsynced_entity_count() != 0); |
} |
-void SyncManager::TriggerOnNotificationStateChangeForTest( |
- bool notifications_enabled) { |
+void SyncManager::TriggerOnSyncNotifierStateChangeForTest( |
+ sync_notifier::SyncNotifierState sync_notifier_state) { |
DCHECK(thread_checker_.CalledOnValidThread()); |
- data_->OnNotificationStateChange(notifications_enabled); |
+ data_->OnSyncNotifierStateChange(sync_notifier_state); |
} |
void SyncManager::TriggerOnIncomingNotificationForTest( |