Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: sync/notifier/p2p_invalidator.h

Issue 13197004: Draft: InvalidationService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Passes tests Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/listener/push_client_observer.h" 19 #include "jingle/notifier/listener/push_client_observer.h"
20 #include "sync/base/sync_export.h" 20 #include "sync/base/sync_export.h"
21 #include "sync/internal_api/public/base/model_type.h" 21 #include "sync/internal_api/public/base/model_type.h"
22 #include "sync/notifier/invalidator.h" 22 #include "sync/notifier/invalidator.h"
23 #include "sync/notifier/invalidator_registrar.h" 23 #include "sync/notifier/invalidator_registrar.h"
24 #include "sync/notifier/invalidator_state.h" 24 #include "sync/notifier/invalidator_state.h"
25 25
26 // FIXME: These are included only for the sake of p2p_invalidation_service...
27 #include "jingle/notifier/base/notifier_options.h"
28 #include "jingle/notifier/listener/push_client.h"
29
26 namespace notifier { 30 namespace notifier {
27 class PushClient; 31 class PushClient;
28 } // namespace notifier 32 } // namespace notifier
29 33
30 namespace syncer { 34 namespace syncer {
31 35
32 // The channel to use for sync notifications. 36 // The channel to use for sync notifications.
33 SYNC_EXPORT extern const char kSyncP2PNotificationChannel[]; 37 SYNC_EXPORT extern const char kSyncP2PNotificationChannel[];
34 38
35 // The intended recipient(s) of a P2P notification. 39 // The intended recipient(s) of a P2P notification.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // Invalidator implementation. 105 // Invalidator implementation.
102 virtual void RegisterHandler(InvalidationHandler* handler) OVERRIDE; 106 virtual void RegisterHandler(InvalidationHandler* handler) OVERRIDE;
103 virtual void UpdateRegisteredIds(InvalidationHandler* handler, 107 virtual void UpdateRegisteredIds(InvalidationHandler* handler,
104 const ObjectIdSet& ids) OVERRIDE; 108 const ObjectIdSet& ids) OVERRIDE;
105 virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE; 109 virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE;
106 virtual void Acknowledge(const invalidation::ObjectId& id, 110 virtual void Acknowledge(const invalidation::ObjectId& id,
107 const AckHandle& ack_handle) OVERRIDE; 111 const AckHandle& ack_handle) OVERRIDE;
108 virtual InvalidatorState GetInvalidatorState() const OVERRIDE; 112 virtual InvalidatorState GetInvalidatorState() const OVERRIDE;
109 virtual void UpdateCredentials( 113 virtual void UpdateCredentials(
110 const std::string& email, const std::string& token) OVERRIDE; 114 const std::string& email, const std::string& token) OVERRIDE;
111 virtual void SendInvalidation(
112 const ObjectIdInvalidationMap& invalidation_map) OVERRIDE;
113 115
114 // PushClientObserver implementation. 116 // PushClientObserver implementation.
115 virtual void OnNotificationsEnabled() OVERRIDE; 117 virtual void OnNotificationsEnabled() OVERRIDE;
116 virtual void OnNotificationsDisabled( 118 virtual void OnNotificationsDisabled(
117 notifier::NotificationsDisabledReason reason) OVERRIDE; 119 notifier::NotificationsDisabledReason reason) OVERRIDE;
118 virtual void OnIncomingNotification( 120 virtual void OnIncomingNotification(
119 const notifier::Notification& notification) OVERRIDE; 121 const notifier::Notification& notification) OVERRIDE;
120 122
123 virtual void SendInvalidation(
124 const ObjectIdInvalidationMap& invalidation_map);
125
121 void SendNotificationDataForTest( 126 void SendNotificationDataForTest(
122 const P2PNotificationData& notification_data); 127 const P2PNotificationData& notification_data);
123 128
124 private: 129 private:
125 void SendNotificationData(const P2PNotificationData& notification_data); 130 void SendNotificationData(const P2PNotificationData& notification_data);
126 131
127 base::ThreadChecker thread_checker_; 132 base::ThreadChecker thread_checker_;
128 133
129 InvalidatorRegistrar registrar_; 134 InvalidatorRegistrar registrar_;
130 135
131 // The push client. 136 // The push client.
132 scoped_ptr<notifier::PushClient> push_client_; 137 scoped_ptr<notifier::PushClient> push_client_;
133 // Our unique ID. 138 // Our unique ID.
134 std::string invalidator_client_id_; 139 std::string invalidator_client_id_;
135 // Whether we have called UpdateCredentials() yet. 140 // Whether we have called UpdateCredentials() yet.
136 bool logged_in_; 141 bool logged_in_;
137 bool notifications_enabled_; 142 bool notifications_enabled_;
138 // Which set of clients should be sent notifications. 143 // Which set of clients should be sent notifications.
139 P2PNotificationTarget send_notification_target_; 144 P2PNotificationTarget send_notification_target_;
140 145
141 DISALLOW_COPY_AND_ASSIGN(P2PInvalidator); 146 DISALLOW_COPY_AND_ASSIGN(P2PInvalidator);
142 }; 147 };
143 148
144 } // namespace syncer 149 } // namespace syncer
145 150
146 #endif // SYNC_NOTIFIER_P2P_INVALIDATOR_H_ 151 #endif // SYNC_NOTIFIER_P2P_INVALIDATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698