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 // Interface to the invalidator, which is an object that receives | 5 // Interface to the invalidator, which is an object that receives |
6 // invalidations for registered object IDs. The corresponding | 6 // invalidations for registered object IDs. The corresponding |
7 // InvalidationHandler is notifier when such an event occurs. | 7 // InvalidationHandler is notifier when such an event occurs. |
8 | 8 |
9 #ifndef SYNC_NOTIFIER_INVALIDATOR_H_ | 9 #ifndef SYNC_NOTIFIER_INVALIDATOR_H_ |
10 #define SYNC_NOTIFIER_INVALIDATOR_H_ | 10 #define SYNC_NOTIFIER_INVALIDATOR_H_ |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // not be NULL, and must already be registered. An ID must be registered for | 62 // not be NULL, and must already be registered. An ID must be registered for |
63 // at most one handler. | 63 // at most one handler. |
64 virtual void UpdateRegisteredIds(InvalidationHandler* handler, | 64 virtual void UpdateRegisteredIds(InvalidationHandler* handler, |
65 const ObjectIdSet& ids) = 0; | 65 const ObjectIdSet& ids) = 0; |
66 | 66 |
67 // Stops sending notifications to |handler|. |handler| must not be NULL, and | 67 // Stops sending notifications to |handler|. |handler| must not be NULL, and |
68 // it must already be registered. Note that this doesn't unregister the IDs | 68 // it must already be registered. Note that this doesn't unregister the IDs |
69 // associated with |handler|. | 69 // associated with |handler|. |
70 virtual void UnregisterHandler(InvalidationHandler* handler) = 0; | 70 virtual void UnregisterHandler(InvalidationHandler* handler) = 0; |
71 | 71 |
| 72 // Acknowledge that an invalidation for |id| was handled. |
| 73 virtual void Acknowledge(const invalidation::ObjectId& id, |
| 74 const AckHandle& ack_handle) = 0; |
| 75 |
72 // Returns the current invalidator state. When called from within | 76 // Returns the current invalidator state. When called from within |
73 // InvalidationHandler::OnInvalidatorStateChange(), this must return | 77 // InvalidationHandler::OnInvalidatorStateChange(), this must return |
74 // the updated state. | 78 // the updated state. |
75 virtual InvalidatorState GetInvalidatorState() const = 0; | 79 virtual InvalidatorState GetInvalidatorState() const = 0; |
76 | 80 |
77 // SetUniqueId must be called once, before any call to | 81 // SetUniqueId must be called once, before any call to |
78 // UpdateCredentials. |unique_id| should be a non-empty globally | 82 // UpdateCredentials. |unique_id| should be a non-empty globally |
79 // unique string. | 83 // unique string. |
80 virtual void SetUniqueId(const std::string& unique_id) = 0; | 84 virtual void SetUniqueId(const std::string& unique_id) = 0; |
81 | 85 |
82 // The observers won't be notified of any notifications until | 86 // The observers won't be notified of any notifications until |
83 // UpdateCredentials is called at least once. It can be called more than | 87 // UpdateCredentials is called at least once. It can be called more than |
84 // once. | 88 // once. |
85 virtual void UpdateCredentials( | 89 virtual void UpdateCredentials( |
86 const std::string& email, const std::string& token) = 0; | 90 const std::string& email, const std::string& token) = 0; |
87 | 91 |
88 // This is here only to support the old p2p notification implementation, | 92 // This is here only to support the old p2p notification implementation, |
89 // which is still used by sync integration tests. | 93 // which is still used by sync integration tests. |
90 // TODO(akalin): Remove this once we move the integration tests off p2p | 94 // TODO(akalin): Remove this once we move the integration tests off p2p |
91 // notifications. | 95 // notifications. |
92 virtual void SendInvalidation( | 96 virtual void SendInvalidation( |
93 const ObjectIdInvalidationMap& invalidation_map) = 0; | 97 const ObjectIdInvalidationMap& invalidation_map) = 0; |
94 }; | 98 }; |
95 } // namespace syncer | 99 } // namespace syncer |
96 | 100 |
97 #endif // SYNC_NOTIFIER_INVALIDATOR_H_ | 101 #endif // SYNC_NOTIFIER_INVALIDATOR_H_ |
OLD | NEW |