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

Side by Side Diff: jingle/notifier/listener/xmpp_push_client.h

Issue 10545170: [Sync] Propagate XMPP auth errors to SyncNotifierObservers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix deps, win compile error Created 8 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef JINGLE_NOTIFIER_LISTENER_XMPP_PUSH_CLIENT_H_ 5 #ifndef JINGLE_NOTIFIER_LISTENER_XMPP_PUSH_CLIENT_H_
6 #define JINGLE_NOTIFIER_LISTENER_XMPP_PUSH_CLIENT_H_ 6 #define JINGLE_NOTIFIER_LISTENER_XMPP_PUSH_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "base/threading/non_thread_safe.h" 17 #include "base/threading/non_thread_safe.h"
18 #include "jingle/notifier/base/notifier_options.h" 18 #include "jingle/notifier/base/notifier_options.h"
19 #include "jingle/notifier/communicator/login.h" 19 #include "jingle/notifier/communicator/login.h"
20 #include "jingle/notifier/listener/notification_defines.h" 20 #include "jingle/notifier/listener/notification_defines.h"
21 #include "jingle/notifier/listener/push_client.h" 21 #include "jingle/notifier/listener/push_client.h"
22 #include "jingle/notifier/listener/push_notifications_listen_task.h" 22 #include "jingle/notifier/listener/push_notifications_listen_task.h"
23 #include "jingle/notifier/listener/push_notifications_subscribe_task.h" 23 #include "jingle/notifier/listener/push_notifications_subscribe_task.h"
24 #include "talk/xmpp/xmppclientsettings.h" 24 #include "talk/xmpp/xmppclientsettings.h"
25 25
26 namespace buzz { 26 namespace buzz {
27 class XmppTaskParentInterface; 27 class XmppTaskParentInterface;
28 } // namespace buzz 28 } // namespace buzz
29 29
30 namespace notifier { 30 namespace notifier {
31 31
32 // This class implements a client for the XMPP google:push protocol. 32 // This class implements a client for the XMPP google:push protocol.
33 // 33 //
34 // This class must be used on a single thread. 34 // This class must be used on a single thread.
35 class XmppPushClient : 35 class XmppPushClient :
36 public PushClient, 36 public PushClient,
37 public LoginDelegate, 37 public Login::Delegate,
38 public PushNotificationsListenTaskDelegate, 38 public PushNotificationsListenTaskDelegate,
39 public PushNotificationsSubscribeTaskDelegate { 39 public PushNotificationsSubscribeTaskDelegate {
40 public: 40 public:
41 explicit XmppPushClient(const NotifierOptions& notifier_options); 41 explicit XmppPushClient(const NotifierOptions& notifier_options);
42 virtual ~XmppPushClient(); 42 virtual ~XmppPushClient();
43 43
44 // PushClient implementation. 44 // PushClient implementation.
45 virtual void AddObserver(PushClientObserver* observer) OVERRIDE; 45 virtual void AddObserver(PushClientObserver* observer) OVERRIDE;
46 virtual void RemoveObserver(PushClientObserver* observer) OVERRIDE; 46 virtual void RemoveObserver(PushClientObserver* observer) OVERRIDE;
47 virtual void UpdateSubscriptions( 47 virtual void UpdateSubscriptions(
48 const SubscriptionList& subscriptions) OVERRIDE; 48 const SubscriptionList& subscriptions) OVERRIDE;
49 virtual void UpdateCredentials( 49 virtual void UpdateCredentials(
50 const std::string& email, const std::string& token) OVERRIDE; 50 const std::string& email, const std::string& token) OVERRIDE;
51 virtual void SendNotification(const Notification& notification) OVERRIDE; 51 virtual void SendNotification(const Notification& notification) OVERRIDE;
52 52
53 // Login::Delegate implementation. 53 // Login::Delegate implementation.
54 virtual void OnConnect( 54 virtual void OnConnect(
55 base::WeakPtr<buzz::XmppTaskParentInterface> base_task) OVERRIDE; 55 base::WeakPtr<buzz::XmppTaskParentInterface> base_task) OVERRIDE;
56 virtual void OnDisconnect() OVERRIDE; 56 virtual void OnTransientDisconnection() OVERRIDE;
57 virtual void OnCredentialsRejected() OVERRIDE;
57 58
58 // PushNotificationsListenTaskDelegate implementation. 59 // PushNotificationsListenTaskDelegate implementation.
59 virtual void OnNotificationReceived( 60 virtual void OnNotificationReceived(
60 const Notification& notification) OVERRIDE; 61 const Notification& notification) OVERRIDE;
61 62
62 // PushNotificationsSubscribeTaskDelegate implementation. 63 // PushNotificationsSubscribeTaskDelegate implementation.
63 virtual void OnSubscribed() OVERRIDE; 64 virtual void OnSubscribed() OVERRIDE;
64 virtual void OnSubscriptionError() OVERRIDE; 65 virtual void OnSubscriptionError() OVERRIDE;
65 66
66 private: 67 private:
(...skipping 11 matching lines...) Expand all
78 base::WeakPtr<buzz::XmppTaskParentInterface> base_task_; 79 base::WeakPtr<buzz::XmppTaskParentInterface> base_task_;
79 80
80 std::vector<Notification> pending_notifications_to_send_; 81 std::vector<Notification> pending_notifications_to_send_;
81 82
82 DISALLOW_COPY_AND_ASSIGN(XmppPushClient); 83 DISALLOW_COPY_AND_ASSIGN(XmppPushClient);
83 }; 84 };
84 85
85 } // namespace notifier 86 } // namespace notifier
86 87
87 #endif // JINGLE_NOTIFIER_LISTENER_XMPP_PUSH_CLIENT_H_ 88 #endif // JINGLE_NOTIFIER_LISTENER_XMPP_PUSH_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698