| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // A simple wrapper around invalidation::InvalidationClient that | 5 // A simple wrapper around invalidation::InvalidationClient that |
| 6 // handles all the startup/shutdown details and hookups. | 6 // handles all the startup/shutdown details and hookups. |
| 7 | 7 |
| 8 #ifndef COMPONENTS_INVALIDATION_SYNC_INVALIDATION_LISTENER_H_ | 8 #ifndef COMPONENTS_INVALIDATION_SYNC_INVALIDATION_LISTENER_H_ |
| 9 #define COMPONENTS_INVALIDATION_SYNC_INVALIDATION_LISTENER_H_ | 9 #define COMPONENTS_INVALIDATION_SYNC_INVALIDATION_LISTENER_H_ |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 virtual void OnInvalidate( | 61 virtual void OnInvalidate( |
| 62 const ObjectIdInvalidationMap& invalidations) = 0; | 62 const ObjectIdInvalidationMap& invalidations) = 0; |
| 63 | 63 |
| 64 virtual void OnInvalidatorStateChange(InvalidatorState state) = 0; | 64 virtual void OnInvalidatorStateChange(InvalidatorState state) = 0; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 explicit SyncInvalidationListener( | 67 explicit SyncInvalidationListener( |
| 68 scoped_ptr<SyncNetworkChannel> network_channel); | 68 scoped_ptr<SyncNetworkChannel> network_channel); |
| 69 | 69 |
| 70 // Calls Stop(). | 70 // Calls Stop(). |
| 71 virtual ~SyncInvalidationListener(); | 71 ~SyncInvalidationListener() override; |
| 72 | 72 |
| 73 // Does not take ownership of |delegate| or |state_writer|. | 73 // Does not take ownership of |delegate| or |state_writer|. |
| 74 // |invalidation_state_tracker| must be initialized. | 74 // |invalidation_state_tracker| must be initialized. |
| 75 void Start( | 75 void Start( |
| 76 const CreateInvalidationClientCallback& | 76 const CreateInvalidationClientCallback& |
| 77 create_invalidation_client_callback, | 77 create_invalidation_client_callback, |
| 78 const std::string& client_id, | 78 const std::string& client_id, |
| 79 const std::string& client_info, | 79 const std::string& client_info, |
| 80 const std::string& invalidation_bootstrap_data, | 80 const std::string& invalidation_bootstrap_data, |
| 81 const UnackedInvalidationsMap& initial_object_states, | 81 const UnackedInvalidationsMap& initial_object_states, |
| 82 const base::WeakPtr<InvalidationStateTracker>& invalidation_state_tracker, | 82 const base::WeakPtr<InvalidationStateTracker>& invalidation_state_tracker, |
| 83 const scoped_refptr<base::SequencedTaskRunner>& | 83 const scoped_refptr<base::SequencedTaskRunner>& |
| 84 invalidation_state_tracker_task_runner, | 84 invalidation_state_tracker_task_runner, |
| 85 Delegate* delegate); | 85 Delegate* delegate); |
| 86 | 86 |
| 87 void UpdateCredentials(const std::string& email, const std::string& token); | 87 void UpdateCredentials(const std::string& email, const std::string& token); |
| 88 | 88 |
| 89 // Update the set of object IDs that we're interested in getting | 89 // Update the set of object IDs that we're interested in getting |
| 90 // notifications for. May be called at any time. | 90 // notifications for. May be called at any time. |
| 91 void UpdateRegisteredIds(const ObjectIdSet& ids); | 91 void UpdateRegisteredIds(const ObjectIdSet& ids); |
| 92 | 92 |
| 93 // invalidation::InvalidationListener implementation. | 93 // invalidation::InvalidationListener implementation. |
| 94 virtual void Ready( | 94 void Ready(invalidation::InvalidationClient* client) override; |
| 95 invalidation::InvalidationClient* client) override; | 95 void Invalidate(invalidation::InvalidationClient* client, |
| 96 virtual void Invalidate( | 96 const invalidation::Invalidation& invalidation, |
| 97 invalidation::InvalidationClient* client, | 97 const invalidation::AckHandle& ack_handle) override; |
| 98 const invalidation::Invalidation& invalidation, | 98 void InvalidateUnknownVersion( |
| 99 const invalidation::AckHandle& ack_handle) override; | |
| 100 virtual void InvalidateUnknownVersion( | |
| 101 invalidation::InvalidationClient* client, | 99 invalidation::InvalidationClient* client, |
| 102 const invalidation::ObjectId& object_id, | 100 const invalidation::ObjectId& object_id, |
| 103 const invalidation::AckHandle& ack_handle) override; | 101 const invalidation::AckHandle& ack_handle) override; |
| 104 virtual void InvalidateAll( | 102 void InvalidateAll(invalidation::InvalidationClient* client, |
| 105 invalidation::InvalidationClient* client, | 103 const invalidation::AckHandle& ack_handle) override; |
| 106 const invalidation::AckHandle& ack_handle) override; | 104 void InformRegistrationStatus( |
| 107 virtual void InformRegistrationStatus( | |
| 108 invalidation::InvalidationClient* client, | 105 invalidation::InvalidationClient* client, |
| 109 const invalidation::ObjectId& object_id, | 106 const invalidation::ObjectId& object_id, |
| 110 invalidation::InvalidationListener::RegistrationState reg_state) override; | 107 invalidation::InvalidationListener::RegistrationState reg_state) override; |
| 111 virtual void InformRegistrationFailure( | 108 void InformRegistrationFailure(invalidation::InvalidationClient* client, |
| 112 invalidation::InvalidationClient* client, | 109 const invalidation::ObjectId& object_id, |
| 113 const invalidation::ObjectId& object_id, | 110 bool is_transient, |
| 114 bool is_transient, | 111 const std::string& error_message) override; |
| 115 const std::string& error_message) override; | 112 void ReissueRegistrations(invalidation::InvalidationClient* client, |
| 116 virtual void ReissueRegistrations( | 113 const std::string& prefix, |
| 117 invalidation::InvalidationClient* client, | 114 int prefix_length) override; |
| 118 const std::string& prefix, | 115 void InformError(invalidation::InvalidationClient* client, |
| 119 int prefix_length) override; | 116 const invalidation::ErrorInfo& error_info) override; |
| 120 virtual void InformError( | |
| 121 invalidation::InvalidationClient* client, | |
| 122 const invalidation::ErrorInfo& error_info) override; | |
| 123 | 117 |
| 124 // AckHandler implementation. | 118 // AckHandler implementation. |
| 125 virtual void Acknowledge( | 119 void Acknowledge(const invalidation::ObjectId& id, |
| 126 const invalidation::ObjectId& id, | 120 const syncer::AckHandle& handle) override; |
| 127 const syncer::AckHandle& handle) override; | 121 void Drop(const invalidation::ObjectId& id, |
| 128 virtual void Drop( | 122 const syncer::AckHandle& handle) override; |
| 129 const invalidation::ObjectId& id, | |
| 130 const syncer::AckHandle& handle) override; | |
| 131 | 123 |
| 132 // StateWriter implementation. | 124 // StateWriter implementation. |
| 133 virtual void WriteState(const std::string& state) override; | 125 void WriteState(const std::string& state) override; |
| 134 | 126 |
| 135 // SyncNetworkChannel::Observer implementation. | 127 // SyncNetworkChannel::Observer implementation. |
| 136 virtual void OnNetworkChannelStateChanged( | 128 void OnNetworkChannelStateChanged( |
| 137 InvalidatorState invalidator_state) override; | 129 InvalidatorState invalidator_state) override; |
| 138 | 130 |
| 139 void DoRegistrationUpdate(); | 131 void DoRegistrationUpdate(); |
| 140 | 132 |
| 141 void RequestDetailedStatus( | 133 void RequestDetailedStatus( |
| 142 base::Callback<void(const base::DictionaryValue&)> callback) const; | 134 base::Callback<void(const base::DictionaryValue&)> callback) const; |
| 143 | 135 |
| 144 void StopForTest(); | 136 void StopForTest(); |
| 145 | 137 |
| 146 private: | 138 private: |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 InvalidatorState push_client_state_; | 183 InvalidatorState push_client_state_; |
| 192 | 184 |
| 193 base::WeakPtrFactory<SyncInvalidationListener> weak_ptr_factory_; | 185 base::WeakPtrFactory<SyncInvalidationListener> weak_ptr_factory_; |
| 194 | 186 |
| 195 DISALLOW_COPY_AND_ASSIGN(SyncInvalidationListener); | 187 DISALLOW_COPY_AND_ASSIGN(SyncInvalidationListener); |
| 196 }; | 188 }; |
| 197 | 189 |
| 198 } // namespace syncer | 190 } // namespace syncer |
| 199 | 191 |
| 200 #endif // COMPONENTS_INVALIDATION_SYNC_INVALIDATION_LISTENER_H_ | 192 #endif // COMPONENTS_INVALIDATION_SYNC_INVALIDATION_LISTENER_H_ |
| OLD | NEW |