OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This class is the (hackish) way to use the XMPP parts of | 5 // This class is the (hackish) way to use the XMPP parts of |
6 // MediatorThread for server-issued notifications. | 6 // MediatorThread for server-issued notifications. |
7 // | 7 // |
8 // TODO(akalin): Decomp MediatorThread into an XMPP service part and a | 8 // TODO(akalin): Decomp MediatorThread into an XMPP service part and a |
9 // notifications-specific part and use the XMPP service part for | 9 // notifications-specific part and use the XMPP service part for |
10 // server-issued notifications. | 10 // server-issued notifications. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 virtual void SubscribeForUpdates( | 52 virtual void SubscribeForUpdates( |
53 const std::vector<std::string>& subscribed_services_list); | 53 const std::vector<std::string>& subscribed_services_list); |
54 | 54 |
55 // Overridden to stop listening to server notifications. | 55 // Overridden to stop listening to server notifications. |
56 virtual void Logout(); | 56 virtual void Logout(); |
57 | 57 |
58 // Must not be called. | 58 // Must not be called. |
59 virtual void SendNotification(const OutgoingNotificationData& data); | 59 virtual void SendNotification(const OutgoingNotificationData& data); |
60 | 60 |
61 // ChromeInvalidationClient::Listener implementation. | 61 // ChromeInvalidationClient::Listener implementation. |
62 virtual void OnInvalidate(syncable::ModelType model_type); | 62 virtual void OnInvalidate(syncable::ModelType model_type, |
| 63 const std::string& payload); |
63 virtual void OnInvalidateAll(); | 64 virtual void OnInvalidateAll(); |
64 | 65 |
65 // StateWriter implementation. | 66 // StateWriter implementation. |
66 virtual void WriteState(const std::string& state); | 67 virtual void WriteState(const std::string& state); |
67 | 68 |
68 private: | 69 private: |
69 // Posted to the worker thread by ListenForUpdates(). | 70 // Posted to the worker thread by ListenForUpdates(). |
70 void DoListenForUpdates(); | 71 void DoListenForUpdates(); |
71 | 72 |
72 // Posted to the worker thread by SubscribeForUpdates(). | 73 // Posted to the worker thread by SubscribeForUpdates(). |
73 void RegisterTypesAndSignalSubscribed(); | 74 void RegisterTypesAndSignalSubscribed(); |
74 | 75 |
75 // Posted to the worker thread by Logout(). | 76 // Posted to the worker thread by Logout(). |
76 void StopInvalidationListener(); | 77 void StopInvalidationListener(); |
77 | 78 |
78 std::string state_; | 79 std::string state_; |
79 // Hack to get the nice thread-safe behavior for |state_writer_|. | 80 // Hack to get the nice thread-safe behavior for |state_writer_|. |
80 scoped_refptr<ObserverListThreadSafe<StateWriter> > state_writers_; | 81 scoped_refptr<ObserverListThreadSafe<StateWriter> > state_writers_; |
81 // We still need to keep |state_writer_| around to remove it from | 82 // We still need to keep |state_writer_| around to remove it from |
82 // |state_writers_|. | 83 // |state_writers_|. |
83 StateWriter* state_writer_; | 84 StateWriter* state_writer_; |
84 scoped_ptr<ChromeInvalidationClient> chrome_invalidation_client_; | 85 scoped_ptr<ChromeInvalidationClient> chrome_invalidation_client_; |
85 }; | 86 }; |
86 | 87 |
87 } // namespace sync_notifier | 88 } // namespace sync_notifier |
88 | 89 |
89 DISABLE_RUNNABLE_METHOD_REFCOUNT(sync_notifier::ServerNotifierThread); | 90 DISABLE_RUNNABLE_METHOD_REFCOUNT(sync_notifier::ServerNotifierThread); |
90 | 91 |
91 #endif // CHROME_BROWSER_SYNC_NOTIFIER_SERVER_NOTIFIER_THREAD_H_ | 92 #endif // CHROME_BROWSER_SYNC_NOTIFIER_SERVER_NOTIFIER_THREAD_H_ |
OLD | NEW |