| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
| 12 #include "remoting/jingle_glue/iq_request.h" | 12 #include "remoting/jingle_glue/iq_request.h" |
| 13 | 13 |
| 14 namespace remoting { | 14 namespace remoting { |
| 15 | 15 |
| 16 class IqRequest; | 16 class IqRequest; |
| 17 class JingleClient; | 17 class JingleClient; |
| 18 class HostConfig; |
| 18 | 19 |
| 19 // HeartbeatSender periodically sends hertbeats to the chromoting bot. | 20 // HeartbeatSender periodically sends hertbeats to the chromoting bot. |
| 20 // TODO(sergeyu): Write unittest for this class. | 21 // TODO(sergeyu): Write unittest for this class. |
| 21 class HeartbeatSender : public base::RefCountedThreadSafe<HeartbeatSender> { | 22 class HeartbeatSender : public base::RefCountedThreadSafe<HeartbeatSender> { |
| 22 public: | 23 public: |
| 23 HeartbeatSender(); | 24 HeartbeatSender(); |
| 24 | 25 |
| 25 // Starts heart-beating for |jingle_client|. | 26 // Starts heart-beating for |jingle_client|. |
| 26 void Start(JingleClient* jingle_client, const std::string& host_id); | 27 void Start(HostConfig* config, JingleClient* jingle_client); |
| 27 | 28 |
| 28 private: | 29 private: |
| 29 void DoStart(); | 30 void DoStart(); |
| 30 void DoSendStanza(); | 31 void DoSendStanza(); |
| 31 | 32 |
| 32 void ProcessResponse(const buzz::XmlElement* response); | 33 void ProcessResponse(const buzz::XmlElement* response); |
| 33 | 34 |
| 34 bool started_; | 35 bool started_; |
| 36 scoped_refptr<HostConfig> config_; |
| 35 JingleClient* jingle_client_; | 37 JingleClient* jingle_client_; |
| 36 std::string host_id_; | |
| 37 scoped_ptr<IqRequest> request_; | 38 scoped_ptr<IqRequest> request_; |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 } // namespace remoting | 41 } // namespace remoting |
| 41 | 42 |
| 42 #endif // REMOTING_HOST_HEARTBEAT_SENDER_H_ | 43 #endif // REMOTING_HOST_HEARTBEAT_SENDER_H_ |
| OLD | NEW |