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 // 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 COMPONENTS_INVALIDATION_P2P_INVALIDATOR_H_ | 8 #ifndef COMPONENTS_INVALIDATION_P2P_INVALIDATOR_H_ |
9 #define COMPONENTS_INVALIDATION_P2P_INVALIDATOR_H_ | 9 #define COMPONENTS_INVALIDATION_P2P_INVALIDATOR_H_ |
10 | 10 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // either NOTIFY_ALL to send notifications to all clients, or NOTIFY_OTHERS | 94 // either NOTIFY_ALL to send notifications to all clients, or NOTIFY_OTHERS |
95 // to send notifications to all clients except for the one that triggered the | 95 // to send notifications to all clients except for the one that triggered the |
96 // notification. See crbug.com/97780. | 96 // notification. See crbug.com/97780. |
97 P2PInvalidator(scoped_ptr<notifier::PushClient> push_client, | 97 P2PInvalidator(scoped_ptr<notifier::PushClient> push_client, |
98 const std::string& invalidator_client_id, | 98 const std::string& invalidator_client_id, |
99 P2PNotificationTarget send_notification_target); | 99 P2PNotificationTarget send_notification_target); |
100 | 100 |
101 virtual ~P2PInvalidator(); | 101 virtual ~P2PInvalidator(); |
102 | 102 |
103 // Invalidator implementation. | 103 // Invalidator implementation. |
104 virtual void RegisterHandler(InvalidationHandler* handler) OVERRIDE; | 104 virtual void RegisterHandler(InvalidationHandler* handler) override; |
105 virtual void UpdateRegisteredIds(InvalidationHandler* handler, | 105 virtual void UpdateRegisteredIds(InvalidationHandler* handler, |
106 const ObjectIdSet& ids) OVERRIDE; | 106 const ObjectIdSet& ids) override; |
107 virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE; | 107 virtual void UnregisterHandler(InvalidationHandler* handler) override; |
108 virtual InvalidatorState GetInvalidatorState() const OVERRIDE; | 108 virtual InvalidatorState GetInvalidatorState() const override; |
109 virtual void UpdateCredentials( | 109 virtual void UpdateCredentials( |
110 const std::string& email, const std::string& token) OVERRIDE; | 110 const std::string& email, const std::string& token) override; |
111 virtual void RequestDetailedStatus( | 111 virtual void RequestDetailedStatus( |
112 base::Callback<void(const base::DictionaryValue&)> callback) const | 112 base::Callback<void(const base::DictionaryValue&)> callback) const |
113 OVERRIDE; | 113 override; |
114 | 114 |
115 // PushClientObserver implementation. | 115 // PushClientObserver implementation. |
116 virtual void OnNotificationsEnabled() OVERRIDE; | 116 virtual void OnNotificationsEnabled() override; |
117 virtual void OnNotificationsDisabled( | 117 virtual void OnNotificationsDisabled( |
118 notifier::NotificationsDisabledReason reason) OVERRIDE; | 118 notifier::NotificationsDisabledReason reason) override; |
119 virtual void OnIncomingNotification( | 119 virtual void OnIncomingNotification( |
120 const notifier::Notification& notification) OVERRIDE; | 120 const notifier::Notification& notification) override; |
121 | 121 |
122 void SendInvalidation(const ObjectIdSet& ids); | 122 void SendInvalidation(const ObjectIdSet& ids); |
123 | 123 |
124 void SendNotificationDataForTest( | 124 void SendNotificationDataForTest( |
125 const P2PNotificationData& notification_data); | 125 const P2PNotificationData& notification_data); |
126 | 126 |
127 private: | 127 private: |
128 void SendNotificationData(const P2PNotificationData& notification_data); | 128 void SendNotificationData(const P2PNotificationData& notification_data); |
129 | 129 |
130 base::ThreadChecker thread_checker_; | 130 base::ThreadChecker thread_checker_; |
131 | 131 |
132 InvalidatorRegistrar registrar_; | 132 InvalidatorRegistrar registrar_; |
133 | 133 |
134 // The push client. | 134 // The push client. |
135 scoped_ptr<notifier::PushClient> push_client_; | 135 scoped_ptr<notifier::PushClient> push_client_; |
136 // Our unique ID. | 136 // Our unique ID. |
137 std::string invalidator_client_id_; | 137 std::string invalidator_client_id_; |
138 // Whether we have called UpdateCredentials() yet. | 138 // Whether we have called UpdateCredentials() yet. |
139 bool logged_in_; | 139 bool logged_in_; |
140 bool notifications_enabled_; | 140 bool notifications_enabled_; |
141 // Which set of clients should be sent notifications. | 141 // Which set of clients should be sent notifications. |
142 P2PNotificationTarget send_notification_target_; | 142 P2PNotificationTarget send_notification_target_; |
143 | 143 |
144 DISALLOW_COPY_AND_ASSIGN(P2PInvalidator); | 144 DISALLOW_COPY_AND_ASSIGN(P2PInvalidator); |
145 }; | 145 }; |
146 | 146 |
147 } // namespace syncer | 147 } // namespace syncer |
148 | 148 |
149 #endif // COMPONENTS_INVALIDATION_P2P_INVALIDATOR_H_ | 149 #endif // COMPONENTS_INVALIDATION_P2P_INVALIDATOR_H_ |
OLD | NEW |