| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sync/notifier/invalidation_notifier.h" | 5 #include "sync/notifier/invalidation_notifier.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "google/cacheinvalidation/include/invalidation-client-factory.h" | 11 #include "google/cacheinvalidation/include/invalidation-client-factory.h" |
| 12 #include "jingle/notifier/listener/push_client.h" | 12 #include "jingle/notifier/listener/push_client.h" |
| 13 #include "net/url_request/url_request_context.h" | 13 #include "net/url_request/url_request_context.h" |
| 14 #include "sync/internal_api/public/base/model_type_payload_map.h" | |
| 15 #include "sync/notifier/sync_notifier_observer.h" | 14 #include "sync/notifier/sync_notifier_observer.h" |
| 16 #include "talk/xmpp/jid.h" | 15 #include "talk/xmpp/jid.h" |
| 17 #include "talk/xmpp/xmppclientsettings.h" | 16 #include "talk/xmpp/xmppclientsettings.h" |
| 18 | 17 |
| 19 namespace syncer { | 18 namespace syncer { |
| 20 | 19 |
| 21 InvalidationNotifier::InvalidationNotifier( | 20 InvalidationNotifier::InvalidationNotifier( |
| 22 scoped_ptr<notifier::PushClient> push_client, | 21 scoped_ptr<notifier::PushClient> push_client, |
| 23 const InvalidationVersionMap& initial_max_invalidation_versions, | 22 const InvalidationVersionMap& initial_max_invalidation_versions, |
| 24 const std::string& initial_invalidation_state, | 23 const std::string& initial_invalidation_state, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 state_ = STARTED; | 92 state_ = STARTED; |
| 94 } | 93 } |
| 95 invalidation_client_.UpdateCredentials(email, token); | 94 invalidation_client_.UpdateCredentials(email, token); |
| 96 } | 95 } |
| 97 | 96 |
| 98 void InvalidationNotifier::SendNotification(ModelTypeSet changed_types) { | 97 void InvalidationNotifier::SendNotification(ModelTypeSet changed_types) { |
| 99 DCHECK(CalledOnValidThread()); | 98 DCHECK(CalledOnValidThread()); |
| 100 // Do nothing. | 99 // Do nothing. |
| 101 } | 100 } |
| 102 | 101 |
| 103 void InvalidationNotifier::OnInvalidate(const ObjectIdPayloadMap& id_payloads) { | 102 void InvalidationNotifier::OnInvalidate(const ObjectIdStateMap& id_state_map) { |
| 104 DCHECK(CalledOnValidThread()); | 103 DCHECK(CalledOnValidThread()); |
| 105 registrar_.DispatchInvalidationsToHandlers(id_payloads, REMOTE_NOTIFICATION); | 104 registrar_.DispatchInvalidationsToHandlers(id_state_map, REMOTE_NOTIFICATION); |
| 106 } | 105 } |
| 107 | 106 |
| 108 void InvalidationNotifier::OnNotificationsEnabled() { | 107 void InvalidationNotifier::OnNotificationsEnabled() { |
| 109 DCHECK(CalledOnValidThread()); | 108 DCHECK(CalledOnValidThread()); |
| 110 registrar_.EmitOnNotificationsEnabled(); | 109 registrar_.EmitOnNotificationsEnabled(); |
| 111 } | 110 } |
| 112 | 111 |
| 113 void InvalidationNotifier::OnNotificationsDisabled( | 112 void InvalidationNotifier::OnNotificationsDisabled( |
| 114 NotificationsDisabledReason reason) { | 113 NotificationsDisabledReason reason) { |
| 115 DCHECK(CalledOnValidThread()); | 114 DCHECK(CalledOnValidThread()); |
| 116 registrar_.EmitOnNotificationsDisabled(reason); | 115 registrar_.EmitOnNotificationsDisabled(reason); |
| 117 } | 116 } |
| 118 | 117 |
| 119 } // namespace syncer | 118 } // namespace syncer |
| OLD | NEW |