OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_HEARTBEAT_SENDER_H_ | 5 #ifndef REMOTING_HOST_HEARTBEAT_SENDER_H_ |
6 #define REMOTING_HOST_HEARTBEAT_SENDER_H_ | 6 #define REMOTING_HOST_HEARTBEAT_SENDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/timer.h" | 13 #include "base/timer.h" |
14 #include "remoting/host/host_key_pair.h" | 14 #include "remoting/host/host_key_pair.h" |
15 #include "remoting/host/host_status_observer.h" | 15 #include "remoting/host/host_status_observer.h" |
16 #include "remoting/jingle_glue/iq_request.h" | 16 #include "base/gtest_prod_util.h" |
17 #include "testing/gtest/include/gtest/gtest_prod.h" | |
18 | 17 |
19 namespace base { | 18 namespace base { |
20 class MessageLoopProxy; | 19 class MessageLoopProxy; |
21 } // namespace base | 20 } // namespace base |
22 | 21 |
| 22 namespace buzz { |
| 23 class XmlElement; |
| 24 } // namespace buzz |
| 25 |
23 namespace remoting { | 26 namespace remoting { |
24 | 27 |
| 28 class HostKeyPair; |
25 class IqRequest; | 29 class IqRequest; |
26 class HostKeyPair; | 30 class IqSender; |
27 class MutableHostConfig; | 31 class MutableHostConfig; |
28 | 32 |
29 // HeartbeatSender periodically sends heartbeat stanzas to the Chromoting Bot. | 33 // HeartbeatSender periodically sends heartbeat stanzas to the Chromoting Bot. |
30 // Each heartbeat stanza looks as follows: | 34 // Each heartbeat stanza looks as follows: |
31 // | 35 // |
32 // <iq type="set" to="remoting@bot.talk.google.com" | 36 // <iq type="set" to="remoting@bot.talk.google.com" |
33 // from="user@gmail.com/chromoting123123" id="5" xmlns="jabber:client"> | 37 // from="user@gmail.com/chromoting123123" id="5" xmlns="jabber:client"> |
34 // <rem:heartbeat rem:hostid="a1ddb11e-8aef-11df-bccf-18a905b9cb5a" | 38 // <rem:heartbeat rem:hostid="a1ddb11e-8aef-11df-bccf-18a905b9cb5a" |
35 // xmlns:rem="google:remoting"> | 39 // xmlns:rem="google:remoting"> |
36 // <rem:signature rem:time="1279061748">.signature.</rem:signature> | 40 // <rem:signature rem:time="1279061748">.signature.</rem:signature> |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // Caller owns the result. | 103 // Caller owns the result. |
100 buzz::XmlElement* CreateHeartbeatMessage(); | 104 buzz::XmlElement* CreateHeartbeatMessage(); |
101 buzz::XmlElement* CreateSignature(); | 105 buzz::XmlElement* CreateSignature(); |
102 | 106 |
103 State state_; | 107 State state_; |
104 scoped_refptr<base::MessageLoopProxy> message_loop_; | 108 scoped_refptr<base::MessageLoopProxy> message_loop_; |
105 scoped_refptr<MutableHostConfig> config_; | 109 scoped_refptr<MutableHostConfig> config_; |
106 std::string host_id_; | 110 std::string host_id_; |
107 HostKeyPair key_pair_; | 111 HostKeyPair key_pair_; |
108 std::string full_jid_; | 112 std::string full_jid_; |
| 113 scoped_ptr<IqSender> iq_sender_; |
109 scoped_ptr<IqRequest> request_; | 114 scoped_ptr<IqRequest> request_; |
110 int interval_ms_; | 115 int interval_ms_; |
111 base::RepeatingTimer<HeartbeatSender> timer_; | 116 base::RepeatingTimer<HeartbeatSender> timer_; |
112 | 117 |
113 DISALLOW_COPY_AND_ASSIGN(HeartbeatSender); | 118 DISALLOW_COPY_AND_ASSIGN(HeartbeatSender); |
114 }; | 119 }; |
115 | 120 |
116 } // namespace remoting | 121 } // namespace remoting |
117 | 122 |
118 #endif // REMOTING_HOST_HEARTBEAT_SENDER_H_ | 123 #endif // REMOTING_HOST_HEARTBEAT_SENDER_H_ |
OLD | NEW |