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 REMOTING_HOST_STATUS_SENDER_H_ | 5 #ifndef REMOTING_HOST_STATUS_SENDER_H_ |
6 #define REMOTING_HOST_STATUS_SENDER_H_ | 6 #define REMOTING_HOST_STATUS_SENDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 enum HostStatus { | 53 enum HostStatus { |
54 OFFLINE = 0, | 54 OFFLINE = 0, |
55 ONLINE = 1 | 55 ONLINE = 1 |
56 }; | 56 }; |
57 | 57 |
58 HostStatusSender(const std::string& host_id, | 58 HostStatusSender(const std::string& host_id, |
59 SignalStrategy* signal_strategy, | 59 SignalStrategy* signal_strategy, |
60 scoped_refptr<RsaKeyPair> key_pair, | 60 scoped_refptr<RsaKeyPair> key_pair, |
61 const std::string& directory_bot_jid); | 61 const std::string& directory_bot_jid); |
62 virtual ~HostStatusSender(); | 62 ~HostStatusSender() override; |
63 | 63 |
64 // SignalStrategy::Listener interface. | 64 // SignalStrategy::Listener interface. |
65 virtual void OnSignalStrategyStateChange( | 65 void OnSignalStrategyStateChange(SignalStrategy::State state) override; |
66 SignalStrategy::State state) override; | 66 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override; |
67 virtual bool OnSignalStrategyIncomingStanza( | |
68 const buzz::XmlElement* stanza) override; | |
69 | 67 |
70 // APIs for sending host status XMPP messages to the chromoting bot. | 68 // APIs for sending host status XMPP messages to the chromoting bot. |
71 // status: the reason (exit code) why the host is offline. | 69 // status: the reason (exit code) why the host is offline. |
72 void SendOnlineStatus(); | 70 void SendOnlineStatus(); |
73 void SendOfflineStatus(HostExitCodes exit_code); | 71 void SendOfflineStatus(HostExitCodes exit_code); |
74 | 72 |
75 inline static const char* HostStatusToString(HostStatus host_status) { | 73 inline static const char* HostStatusToString(HostStatus host_status) { |
76 return host_status_strings_[host_status]; | 74 return host_status_strings_[host_status]; |
77 } | 75 } |
78 | 76 |
(...skipping 17 matching lines...) Expand all Loading... |
96 | 94 |
97 // The string representation of the HostStatus values. | 95 // The string representation of the HostStatus values. |
98 static const char* const host_status_strings_[2]; | 96 static const char* const host_status_strings_[2]; |
99 | 97 |
100 DISALLOW_COPY_AND_ASSIGN(HostStatusSender); | 98 DISALLOW_COPY_AND_ASSIGN(HostStatusSender); |
101 }; | 99 }; |
102 | 100 |
103 } // namespace remoting | 101 } // namespace remoting |
104 | 102 |
105 #endif // REMOTING_HOST_STATUS_SENDER_H_ | 103 #endif // REMOTING_HOST_STATUS_SENDER_H_ |
OLD | NEW |