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_ |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "sync/base/sync_export.h" | 14 #include "sync/base/sync_export.h" |
15 #include "sync/internal_api/public/base/model_type.h" | 15 #include "sync/internal_api/public/base/model_type.h" |
16 #include "sync/notifier/invalidation_util.h" | 16 #include "sync/notifier/invalidation_util.h" |
17 #include "sync/notifier/invalidator_state.h" | 17 #include "sync/notifier/invalidator_state.h" |
18 #include "sync/notifier/object_id_invalidation_map.h" | |
19 | 18 |
20 namespace syncer { | 19 namespace syncer { |
21 class InvalidationHandler; | 20 class InvalidationHandler; |
22 | 21 |
23 class SYNC_EXPORT Invalidator { | 22 class SYNC_EXPORT Invalidator { |
24 public: | 23 public: |
25 Invalidator() {} | 24 Invalidator() {} |
26 virtual ~Invalidator() {} | 25 virtual ~Invalidator() {} |
27 | 26 |
28 // Clients should follow the pattern below: | 27 // Clients should follow the pattern below: |
(...skipping 33 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 | 61 // not be NULL, and must already be registered. An ID must be registered for |
63 // at most one handler. | 62 // at most one handler. |
64 virtual void UpdateRegisteredIds(InvalidationHandler* handler, | 63 virtual void UpdateRegisteredIds(InvalidationHandler* handler, |
65 const ObjectIdSet& ids) = 0; | 64 const ObjectIdSet& ids) = 0; |
66 | 65 |
67 // Stops sending notifications to |handler|. |handler| must not be NULL, and | 66 // 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 | 67 // it must already be registered. Note that this doesn't unregister the IDs |
69 // associated with |handler|. | 68 // associated with |handler|. |
70 virtual void UnregisterHandler(InvalidationHandler* handler) = 0; | 69 virtual void UnregisterHandler(InvalidationHandler* handler) = 0; |
71 | 70 |
72 // Acknowledge that an invalidation for |id| was handled. | |
73 virtual void Acknowledge(const invalidation::ObjectId& id, | |
74 const AckHandle& ack_handle) = 0; | |
75 | |
76 // Returns the current invalidator state. When called from within | 71 // Returns the current invalidator state. When called from within |
77 // InvalidationHandler::OnInvalidatorStateChange(), this must return | 72 // InvalidationHandler::OnInvalidatorStateChange(), this must return |
78 // the updated state. | 73 // the updated state. |
79 virtual InvalidatorState GetInvalidatorState() const = 0; | 74 virtual InvalidatorState GetInvalidatorState() const = 0; |
80 | 75 |
81 // The observers won't be notified of any notifications until | 76 // The observers won't be notified of any notifications until |
82 // UpdateCredentials is called at least once. It can be called more than | 77 // UpdateCredentials is called at least once. It can be called more than |
83 // once. | 78 // once. |
84 virtual void UpdateCredentials( | 79 virtual void UpdateCredentials( |
85 const std::string& email, const std::string& token) = 0; | 80 const std::string& email, const std::string& token) = 0; |
86 }; | 81 }; |
87 } // namespace syncer | 82 } // namespace syncer |
88 | 83 |
89 #endif // SYNC_NOTIFIER_INVALIDATOR_H_ | 84 #endif // SYNC_NOTIFIER_INVALIDATOR_H_ |
OLD | NEW |