| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // An implementation of Invalidator that wraps an invalidation | 5 // An implementation of Invalidator that wraps an invalidation |
| 6 // client. Handles the details of connecting to XMPP and hooking it | 6 // client. Handles the details of connecting to XMPP and hooking it |
| 7 // up to the invalidation client. | 7 // up to the invalidation client. |
| 8 // | 8 // |
| 9 // You probably don't want to use this directly; use | 9 // You probably don't want to use this directly; use |
| 10 // NonBlockingInvalidationNotifier. | 10 // NonBlockingInvalidator. |
| 11 | 11 |
| 12 #ifndef SYNC_NOTIFIER_INVALIDATION_NOTIFIER_H_ | 12 #ifndef SYNC_NOTIFIER_INVALIDATION_NOTIFIER_H_ |
| 13 #define SYNC_NOTIFIER_INVALIDATION_NOTIFIER_H_ | 13 #define SYNC_NOTIFIER_INVALIDATION_NOTIFIER_H_ |
| 14 | 14 |
| 15 #include <string> | 15 #include <string> |
| 16 | 16 |
| 17 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
| 18 #include "base/compiler_specific.h" | 18 #include "base/compiler_specific.h" |
| 19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
| 20 #include "base/threading/non_thread_safe.h" | 20 #include "base/threading/non_thread_safe.h" |
| 21 #include "base/time/default_tick_clock.h" |
| 21 #include "sync/base/sync_export.h" | 22 #include "sync/base/sync_export.h" |
| 22 #include "sync/internal_api/public/base/model_type.h" | 23 #include "sync/internal_api/public/base/model_type.h" |
| 23 #include "sync/internal_api/public/util/weak_handle.h" | 24 #include "sync/internal_api/public/util/weak_handle.h" |
| 24 #include "sync/notifier/invalidation_state_tracker.h" | 25 #include "sync/notifier/invalidation_state_tracker.h" |
| 25 #include "sync/notifier/invalidator.h" | 26 #include "sync/notifier/invalidator.h" |
| 26 #include "sync/notifier/invalidator_registrar.h" | 27 #include "sync/notifier/invalidator_registrar.h" |
| 27 #include "sync/notifier/sync_invalidation_listener.h" | 28 #include "sync/notifier/sync_invalidation_listener.h" |
| 28 | 29 |
| 29 namespace notifier { | 30 namespace notifier { |
| 30 class PushClient; | 31 class PushClient; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 48 invalidation_state_tracker, | 49 invalidation_state_tracker, |
| 49 const std::string& client_info); | 50 const std::string& client_info); |
| 50 | 51 |
| 51 virtual ~InvalidationNotifier(); | 52 virtual ~InvalidationNotifier(); |
| 52 | 53 |
| 53 // Invalidator implementation. | 54 // Invalidator implementation. |
| 54 virtual void RegisterHandler(InvalidationHandler* handler) OVERRIDE; | 55 virtual void RegisterHandler(InvalidationHandler* handler) OVERRIDE; |
| 55 virtual void UpdateRegisteredIds(InvalidationHandler* handler, | 56 virtual void UpdateRegisteredIds(InvalidationHandler* handler, |
| 56 const ObjectIdSet& ids) OVERRIDE; | 57 const ObjectIdSet& ids) OVERRIDE; |
| 57 virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE; | 58 virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE; |
| 59 virtual void Acknowledge(const invalidation::ObjectId& id, |
| 60 const AckHandle& ack_handle) OVERRIDE; |
| 58 virtual InvalidatorState GetInvalidatorState() const OVERRIDE; | 61 virtual InvalidatorState GetInvalidatorState() const OVERRIDE; |
| 59 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE; | 62 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE; |
| 60 virtual void UpdateCredentials( | 63 virtual void UpdateCredentials( |
| 61 const std::string& email, const std::string& token) OVERRIDE; | 64 const std::string& email, const std::string& token) OVERRIDE; |
| 62 virtual void SendInvalidation( | 65 virtual void SendInvalidation( |
| 63 const ObjectIdInvalidationMap& invalidation_map) OVERRIDE; | 66 const ObjectIdInvalidationMap& invalidation_map) OVERRIDE; |
| 64 | 67 |
| 65 // SyncInvalidationListener::Delegate implementation. | 68 // SyncInvalidationListener::Delegate implementation. |
| 66 virtual void OnInvalidate( | 69 virtual void OnInvalidate( |
| 67 const ObjectIdInvalidationMap& invalidation_map) OVERRIDE; | 70 const ObjectIdInvalidationMap& invalidation_map) OVERRIDE; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 90 | 93 |
| 91 // Passed to |invalidation_listener_|. | 94 // Passed to |invalidation_listener_|. |
| 92 const std::string client_info_; | 95 const std::string client_info_; |
| 93 | 96 |
| 94 // The client ID to pass to |invalidation_listener_|. | 97 // The client ID to pass to |invalidation_listener_|. |
| 95 std::string client_id_; | 98 std::string client_id_; |
| 96 | 99 |
| 97 // The initial bootstrap data to pass to |invalidation_listener_|. | 100 // The initial bootstrap data to pass to |invalidation_listener_|. |
| 98 const std::string invalidation_bootstrap_data_; | 101 const std::string invalidation_bootstrap_data_; |
| 99 | 102 |
| 103 // TODO(akalin): Clean up this reference to DefaultTickClock. Ideally, we |
| 104 // should simply be using TaskRunner's tick clock. See http://crbug.com/179211 |
| 105 base::DefaultTickClock tick_clock_; |
| 106 |
| 100 // The invalidation listener. | 107 // The invalidation listener. |
| 101 SyncInvalidationListener invalidation_listener_; | 108 SyncInvalidationListener invalidation_listener_; |
| 102 | 109 |
| 103 DISALLOW_COPY_AND_ASSIGN(InvalidationNotifier); | 110 DISALLOW_COPY_AND_ASSIGN(InvalidationNotifier); |
| 104 }; | 111 }; |
| 105 | 112 |
| 106 } // namespace syncer | 113 } // namespace syncer |
| 107 | 114 |
| 108 #endif // SYNC_NOTIFIER_INVALIDATION_NOTIFIER_H_ | 115 #endif // SYNC_NOTIFIER_INVALIDATION_NOTIFIER_H_ |
| OLD | NEW |