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. |
11 | 11 |
12 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_SERVER_NOTIFIER_THREAD_H_ | 12 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_SERVER_NOTIFIER_THREAD_H_ |
13 #define CHROME_BROWSER_SYNC_NOTIFIER_SERVER_NOTIFIER_THREAD_H_ | 13 #define CHROME_BROWSER_SYNC_NOTIFIER_SERVER_NOTIFIER_THREAD_H_ |
14 | 14 |
15 #include <string> | 15 #include <string> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "base/scoped_ptr.h" | 18 #include "base/scoped_ptr.h" |
19 #include "base/task.h" | 19 #include "base/task.h" |
20 #include "chrome/common/net/notifier/listener/mediator_thread_impl.h" | 20 #include "chrome/common/net/notifier/listener/mediator_thread_impl.h" |
21 #include "google/cacheinvalidation/invalidation-client.h" | 21 #include "google/cacheinvalidation/invalidation-client.h" |
22 | 22 |
23 namespace chrome_common_net { | |
24 class NetworkChangeNotifierThread; | |
25 } // namespace chrome_common_net | |
26 | |
27 namespace sync_notifier { | 23 namespace sync_notifier { |
28 | 24 |
29 class ChromeInvalidationClient; | 25 class ChromeInvalidationClient; |
30 | 26 |
31 class ServerNotifierThread | 27 class ServerNotifierThread |
32 : public notifier::MediatorThreadImpl, | 28 : public notifier::MediatorThreadImpl, |
33 public invalidation::InvalidationListener { | 29 public invalidation::InvalidationListener { |
34 public: | 30 public: |
35 explicit ServerNotifierThread( | 31 ServerNotifierThread(); |
36 chrome_common_net::NetworkChangeNotifierThread* | |
37 network_change_notifier_thread); | |
38 | 32 |
39 virtual ~ServerNotifierThread(); | 33 virtual ~ServerNotifierThread(); |
40 | 34 |
41 // Overridden to start listening to server notifications. | 35 // Overridden to start listening to server notifications. |
42 virtual void ListenForUpdates(); | 36 virtual void ListenForUpdates(); |
43 | 37 |
44 // Overridden to immediately notify the delegate that subscriptions | 38 // Overridden to immediately notify the delegate that subscriptions |
45 // (i.e., notifications) are on. Must be called only after a call | 39 // (i.e., notifications) are on. Must be called only after a call |
46 // to ListenForUpdates(). | 40 // to ListenForUpdates(). |
47 virtual void SubscribeForUpdates( | 41 virtual void SubscribeForUpdates( |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 void StopInvalidationListener(); | 85 void StopInvalidationListener(); |
92 | 86 |
93 scoped_ptr<ChromeInvalidationClient> chrome_invalidation_client_; | 87 scoped_ptr<ChromeInvalidationClient> chrome_invalidation_client_; |
94 }; | 88 }; |
95 | 89 |
96 } // namespace sync_notifier | 90 } // namespace sync_notifier |
97 | 91 |
98 DISABLE_RUNNABLE_METHOD_REFCOUNT(sync_notifier::ServerNotifierThread); | 92 DISABLE_RUNNABLE_METHOD_REFCOUNT(sync_notifier::ServerNotifierThread); |
99 | 93 |
100 #endif // CHROME_BROWSER_SYNC_NOTIFIER_SERVER_NOTIFIER_THREAD_H_ | 94 #endif // CHROME_BROWSER_SYNC_NOTIFIER_SERVER_NOTIFIER_THREAD_H_ |
OLD | NEW |