OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CLOUD_PRINT_GCP20_PROTOTYPE_CLOUD_PRINT_XMPP_LISTENER_H_ | 5 #ifndef CLOUD_PRINT_GCP20_PROTOTYPE_CLOUD_PRINT_XMPP_LISTENER_H_ |
6 #define CLOUD_PRINT_GCP20_PROTOTYPE_CLOUD_PRINT_XMPP_LISTENER_H_ | 6 #define CLOUD_PRINT_GCP20_PROTOTYPE_CLOUD_PRINT_XMPP_LISTENER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // Invoked when printer was deleted from the server. | 58 // Invoked when printer was deleted from the server. |
59 virtual void OnXmppDeleteNotification(const std::string& device_id) = 0; | 59 virtual void OnXmppDeleteNotification(const std::string& device_id) = 0; |
60 }; | 60 }; |
61 | 61 |
62 CloudPrintXmppListener( | 62 CloudPrintXmppListener( |
63 const std::string& robot_email, | 63 const std::string& robot_email, |
64 int standard_ping_interval, | 64 int standard_ping_interval, |
65 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 65 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
66 Delegate* delegate); | 66 Delegate* delegate); |
67 | 67 |
68 virtual ~CloudPrintXmppListener(); | 68 ~CloudPrintXmppListener() override; |
69 | 69 |
70 // Connects to the server. | 70 // Connects to the server. |
71 void Connect(const std::string& access_token); | 71 void Connect(const std::string& access_token); |
72 | 72 |
73 // Update ping interval when new local_settings was received. | 73 // Update ping interval when new local_settings was received. |
74 void set_ping_interval(int interval); | 74 void set_ping_interval(int interval); |
75 | 75 |
76 private: | 76 private: |
77 // notifier::PushClientObserver methods: | 77 // notifier::PushClientObserver methods: |
78 virtual void OnNotificationsEnabled() override; | 78 void OnNotificationsEnabled() override; |
79 virtual void OnNotificationsDisabled( | 79 void OnNotificationsDisabled( |
80 notifier::NotificationsDisabledReason reason) override; | 80 notifier::NotificationsDisabledReason reason) override; |
81 virtual void OnIncomingNotification( | 81 void OnIncomingNotification( |
82 const notifier::Notification& notification) override; | 82 const notifier::Notification& notification) override; |
83 virtual void OnPingResponse() override; | 83 void OnPingResponse() override; |
84 | 84 |
85 // Stops listening and sending pings. | 85 // Stops listening and sending pings. |
86 void Disconnect(); | 86 void Disconnect(); |
87 | 87 |
88 // Schedules ping (unless it was already scheduled). | 88 // Schedules ping (unless it was already scheduled). |
89 void SchedulePing(); | 89 void SchedulePing(); |
90 | 90 |
91 // Sends ping. | 91 // Sends ping. |
92 void SendPing(); | 92 void SendPing(); |
93 | 93 |
(...skipping 23 matching lines...) Expand all Loading... |
117 | 117 |
118 scoped_refptr<net::URLRequestContextGetter> context_getter_; | 118 scoped_refptr<net::URLRequestContextGetter> context_getter_; |
119 | 119 |
120 Delegate* delegate_; | 120 Delegate* delegate_; |
121 | 121 |
122 DISALLOW_COPY_AND_ASSIGN(CloudPrintXmppListener); | 122 DISALLOW_COPY_AND_ASSIGN(CloudPrintXmppListener); |
123 }; | 123 }; |
124 | 124 |
125 #endif // CLOUD_PRINT_GCP20_PROTOTYPE_CLOUD_PRINT_XMPP_LISTENER_H_ | 125 #endif // CLOUD_PRINT_GCP20_PROTOTYPE_CLOUD_PRINT_XMPP_LISTENER_H_ |
126 | 126 |
OLD | NEW |