OLD | NEW |
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_NON_BLOCKING_PUSH_CLIENT_H_ | 5 #ifndef JINGLE_NOTIFIER_LISTENER_NON_BLOCKING_PUSH_CLIENT_H_ |
6 #define JINGLE_NOTIFIER_LISTENER_NON_BLOCKING_PUSH_CLIENT_H_ | 6 #define JINGLE_NOTIFIER_LISTENER_NON_BLOCKING_PUSH_CLIENT_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 // Runs the given callback on the given task runner, and delegates | 36 // Runs the given callback on the given task runner, and delegates |
37 // to that PushClient. | 37 // to that PushClient. |
38 explicit NonBlockingPushClient( | 38 explicit NonBlockingPushClient( |
39 const scoped_refptr<base::SingleThreadTaskRunner>& delegate_task_runner, | 39 const scoped_refptr<base::SingleThreadTaskRunner>& delegate_task_runner, |
40 const CreateBlockingPushClientCallback& | 40 const CreateBlockingPushClientCallback& |
41 create_blocking_push_client_callback); | 41 create_blocking_push_client_callback); |
42 virtual ~NonBlockingPushClient(); | 42 virtual ~NonBlockingPushClient(); |
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 virtual void SendPing() OVERRIDE; | 52 virtual void SendPing() override; |
53 | 53 |
54 private: | 54 private: |
55 class Core; | 55 class Core; |
56 | 56 |
57 void OnNotificationsEnabled(); | 57 void OnNotificationsEnabled(); |
58 void OnNotificationsDisabled(NotificationsDisabledReason reason); | 58 void OnNotificationsDisabled(NotificationsDisabledReason reason); |
59 void OnIncomingNotification(const Notification& notification); | 59 void OnIncomingNotification(const Notification& notification); |
60 void OnPingResponse(); | 60 void OnPingResponse(); |
61 | 61 |
62 base::ThreadChecker thread_checker_; | 62 base::ThreadChecker thread_checker_; |
63 const scoped_refptr<base::SingleThreadTaskRunner> delegate_task_runner_; | 63 const scoped_refptr<base::SingleThreadTaskRunner> delegate_task_runner_; |
64 scoped_refptr<Core> core_; | 64 scoped_refptr<Core> core_; |
65 | 65 |
66 ObserverList<PushClientObserver> observers_; | 66 ObserverList<PushClientObserver> observers_; |
67 | 67 |
68 base::WeakPtrFactory<NonBlockingPushClient> weak_ptr_factory_; | 68 base::WeakPtrFactory<NonBlockingPushClient> weak_ptr_factory_; |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(NonBlockingPushClient); | 70 DISALLOW_COPY_AND_ASSIGN(NonBlockingPushClient); |
71 }; | 71 }; |
72 | 72 |
73 } // namespace notifier | 73 } // namespace notifier |
74 | 74 |
75 #endif // JINGLE_NOTIFIER_LISTENER_NON_BLOCKING_PUSH_CLIENT_H_ | 75 #endif // JINGLE_NOTIFIER_LISTENER_NON_BLOCKING_PUSH_CLIENT_H_ |
OLD | NEW |