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 invalidator that uses p2p invalidations based on XMPP push | 5 // An invalidator that uses p2p invalidations based on XMPP push |
6 // notifications. Used only for sync integration tests. | 6 // notifications. Used only for sync integration tests. |
7 | 7 |
8 #ifndef SYNC_NOTIFIER_P2P_INVALIDATOR_H_ | 8 #ifndef SYNC_NOTIFIER_P2P_INVALIDATOR_H_ |
9 #define SYNC_NOTIFIER_P2P_INVALIDATOR_H_ | 9 #define SYNC_NOTIFIER_P2P_INVALIDATOR_H_ |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
18 #include "base/threading/thread_checker.h" | 18 #include "base/threading/thread_checker.h" |
19 #include "jingle/notifier/base/notifier_options.h" | |
20 #include "jingle/notifier/listener/push_client.h" | |
19 #include "jingle/notifier/listener/push_client_observer.h" | 21 #include "jingle/notifier/listener/push_client_observer.h" |
20 #include "sync/base/sync_export.h" | 22 #include "sync/base/sync_export.h" |
21 #include "sync/internal_api/public/base/model_type.h" | 23 #include "sync/internal_api/public/base/model_type.h" |
22 #include "sync/notifier/invalidator.h" | 24 #include "sync/notifier/invalidator.h" |
23 #include "sync/notifier/invalidator_registrar.h" | 25 #include "sync/notifier/invalidator_registrar.h" |
24 #include "sync/notifier/invalidator_state.h" | 26 #include "sync/notifier/invalidator_state.h" |
25 | 27 |
26 namespace notifier { | 28 namespace notifier { |
27 class PushClient; | 29 class PushClient; |
28 } // namespace notifier | 30 } // namespace notifier |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 // Invalidator implementation. | 103 // Invalidator implementation. |
102 virtual void RegisterHandler(InvalidationHandler* handler) OVERRIDE; | 104 virtual void RegisterHandler(InvalidationHandler* handler) OVERRIDE; |
103 virtual void UpdateRegisteredIds(InvalidationHandler* handler, | 105 virtual void UpdateRegisteredIds(InvalidationHandler* handler, |
104 const ObjectIdSet& ids) OVERRIDE; | 106 const ObjectIdSet& ids) OVERRIDE; |
105 virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE; | 107 virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE; |
106 virtual void Acknowledge(const invalidation::ObjectId& id, | 108 virtual void Acknowledge(const invalidation::ObjectId& id, |
107 const AckHandle& ack_handle) OVERRIDE; | 109 const AckHandle& ack_handle) OVERRIDE; |
108 virtual InvalidatorState GetInvalidatorState() const OVERRIDE; | 110 virtual InvalidatorState GetInvalidatorState() const OVERRIDE; |
109 virtual void UpdateCredentials( | 111 virtual void UpdateCredentials( |
110 const std::string& email, const std::string& token) OVERRIDE; | 112 const std::string& email, const std::string& token) OVERRIDE; |
111 virtual void SendInvalidation( | |
112 const ObjectIdInvalidationMap& invalidation_map) OVERRIDE; | |
113 | 113 |
114 // PushClientObserver implementation. | 114 // PushClientObserver implementation. |
115 virtual void OnNotificationsEnabled() OVERRIDE; | 115 virtual void OnNotificationsEnabled() OVERRIDE; |
116 virtual void OnNotificationsDisabled( | 116 virtual void OnNotificationsDisabled( |
117 notifier::NotificationsDisabledReason reason) OVERRIDE; | 117 notifier::NotificationsDisabledReason reason) OVERRIDE; |
118 virtual void OnIncomingNotification( | 118 virtual void OnIncomingNotification( |
119 const notifier::Notification& notification) OVERRIDE; | 119 const notifier::Notification& notification) OVERRIDE; |
120 | 120 |
121 virtual void SendInvalidation( | |
akalin
2013/05/24 22:58:46
still needs to be virtual?
rlarocque
2013/05/29 00:37:55
Nope. Fixed.
| |
122 const ObjectIdInvalidationMap& invalidation_map); | |
123 | |
121 void SendNotificationDataForTest( | 124 void SendNotificationDataForTest( |
122 const P2PNotificationData& notification_data); | 125 const P2PNotificationData& notification_data); |
123 | 126 |
124 private: | 127 private: |
125 void SendNotificationData(const P2PNotificationData& notification_data); | 128 void SendNotificationData(const P2PNotificationData& notification_data); |
126 | 129 |
127 base::ThreadChecker thread_checker_; | 130 base::ThreadChecker thread_checker_; |
128 | 131 |
129 InvalidatorRegistrar registrar_; | 132 InvalidatorRegistrar registrar_; |
130 | 133 |
131 // The push client. | 134 // The push client. |
132 scoped_ptr<notifier::PushClient> push_client_; | 135 scoped_ptr<notifier::PushClient> push_client_; |
133 // Our unique ID. | 136 // Our unique ID. |
134 std::string invalidator_client_id_; | 137 std::string invalidator_client_id_; |
135 // Whether we have called UpdateCredentials() yet. | 138 // Whether we have called UpdateCredentials() yet. |
136 bool logged_in_; | 139 bool logged_in_; |
137 bool notifications_enabled_; | 140 bool notifications_enabled_; |
138 // Which set of clients should be sent notifications. | 141 // Which set of clients should be sent notifications. |
139 P2PNotificationTarget send_notification_target_; | 142 P2PNotificationTarget send_notification_target_; |
140 | 143 |
141 DISALLOW_COPY_AND_ASSIGN(P2PInvalidator); | 144 DISALLOW_COPY_AND_ASSIGN(P2PInvalidator); |
142 }; | 145 }; |
143 | 146 |
144 } // namespace syncer | 147 } // namespace syncer |
145 | 148 |
146 #endif // SYNC_NOTIFIER_P2P_INVALIDATOR_H_ | 149 #endif // SYNC_NOTIFIER_P2P_INVALIDATOR_H_ |
OLD | NEW |