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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 public: | 91 public: |
92 // The |send_notification_target| parameter was added to allow us to send | 92 // The |send_notification_target| parameter was added to allow us to send |
93 // self-notifications in some cases, but not others. The value should be | 93 // self-notifications in some cases, but not others. The value should be |
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 ~P2PInvalidator() override; |
102 | 102 |
103 // Invalidator implementation. | 103 // Invalidator implementation. |
104 virtual void RegisterHandler(InvalidationHandler* handler) override; | 104 void RegisterHandler(InvalidationHandler* handler) override; |
105 virtual void UpdateRegisteredIds(InvalidationHandler* handler, | 105 void UpdateRegisteredIds(InvalidationHandler* handler, |
106 const ObjectIdSet& ids) override; | 106 const ObjectIdSet& ids) override; |
107 virtual void UnregisterHandler(InvalidationHandler* handler) override; | 107 void UnregisterHandler(InvalidationHandler* handler) override; |
108 virtual InvalidatorState GetInvalidatorState() const override; | 108 InvalidatorState GetInvalidatorState() const override; |
109 virtual void UpdateCredentials( | 109 void UpdateCredentials(const std::string& email, |
110 const std::string& email, const std::string& token) override; | 110 const std::string& token) override; |
111 virtual void RequestDetailedStatus( | 111 void RequestDetailedStatus(base::Callback<void(const base::DictionaryValue&)> |
112 base::Callback<void(const base::DictionaryValue&)> callback) const | 112 callback) const override; |
113 override; | |
114 | 113 |
115 // PushClientObserver implementation. | 114 // PushClientObserver implementation. |
116 virtual void OnNotificationsEnabled() override; | 115 void OnNotificationsEnabled() override; |
117 virtual void OnNotificationsDisabled( | 116 void OnNotificationsDisabled( |
118 notifier::NotificationsDisabledReason reason) override; | 117 notifier::NotificationsDisabledReason reason) override; |
119 virtual void OnIncomingNotification( | 118 void OnIncomingNotification( |
120 const notifier::Notification& notification) override; | 119 const notifier::Notification& notification) override; |
121 | 120 |
122 void SendInvalidation(const ObjectIdSet& ids); | 121 void SendInvalidation(const ObjectIdSet& ids); |
123 | 122 |
124 void SendNotificationDataForTest( | 123 void SendNotificationDataForTest( |
125 const P2PNotificationData& notification_data); | 124 const P2PNotificationData& notification_data); |
126 | 125 |
127 private: | 126 private: |
128 void SendNotificationData(const P2PNotificationData& notification_data); | 127 void SendNotificationData(const P2PNotificationData& notification_data); |
129 | 128 |
(...skipping 10 matching lines...) Expand all Loading... |
140 bool notifications_enabled_; | 139 bool notifications_enabled_; |
141 // Which set of clients should be sent notifications. | 140 // Which set of clients should be sent notifications. |
142 P2PNotificationTarget send_notification_target_; | 141 P2PNotificationTarget send_notification_target_; |
143 | 142 |
144 DISALLOW_COPY_AND_ASSIGN(P2PInvalidator); | 143 DISALLOW_COPY_AND_ASSIGN(P2PInvalidator); |
145 }; | 144 }; |
146 | 145 |
147 } // namespace syncer | 146 } // namespace syncer |
148 | 147 |
149 #endif // COMPONENTS_INVALIDATION_P2P_INVALIDATOR_H_ | 148 #endif // COMPONENTS_INVALIDATION_P2P_INVALIDATOR_H_ |
OLD | NEW |