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 #include "remoting/host/heartbeat_sender.h" | 5 #include "remoting/host/heartbeat_sender.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 DCHECK(message_loop_->BelongsToCurrentThread()); | 107 DCHECK(message_loop_->BelongsToCurrentThread()); |
108 | 108 |
109 std::string type = response->Attr(buzz::QN_TYPE); | 109 std::string type = response->Attr(buzz::QN_TYPE); |
110 if (type == buzz::STR_ERROR) { | 110 if (type == buzz::STR_ERROR) { |
111 LOG(ERROR) << "Received error in response to heartbeat: " | 111 LOG(ERROR) << "Received error in response to heartbeat: " |
112 << response->Str(); | 112 << response->Str(); |
113 return; | 113 return; |
114 } | 114 } |
115 | 115 |
116 // This method must only be called for error or result stanzas. | 116 // This method must only be called for error or result stanzas. |
117 DCHECK_EQ(buzz::STR_RESULT, type); | 117 DCHECK_EQ(std::string(buzz::STR_RESULT), type); |
118 | 118 |
119 const XmlElement* result_element = | 119 const XmlElement* result_element = |
120 response->FirstNamed(QName(kChromotingXmlNamespace, kHeartbeatResultTag)); | 120 response->FirstNamed(QName(kChromotingXmlNamespace, kHeartbeatResultTag)); |
121 if (result_element) { | 121 if (result_element) { |
122 const XmlElement* set_interval_element = | 122 const XmlElement* set_interval_element = |
123 result_element->FirstNamed(QName(kChromotingXmlNamespace, | 123 result_element->FirstNamed(QName(kChromotingXmlNamespace, |
124 kSetIntervalTag)); | 124 kSetIntervalTag)); |
125 if (set_interval_element) { | 125 if (set_interval_element) { |
126 const std::string& interval_str = set_interval_element->BodyText(); | 126 const std::string& interval_str = set_interval_element->BodyText(); |
127 int interval; | 127 int interval; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 QName(kChromotingXmlNamespace, kSignatureTimeAttr), time_str); | 166 QName(kChromotingXmlNamespace, kSignatureTimeAttr), time_str); |
167 | 167 |
168 std::string message = full_jid_ + ' ' + time_str; | 168 std::string message = full_jid_ + ' ' + time_str; |
169 std::string signature(key_pair_.GetSignature(message)); | 169 std::string signature(key_pair_.GetSignature(message)); |
170 signature_tag->AddText(signature); | 170 signature_tag->AddText(signature); |
171 | 171 |
172 return signature_tag; | 172 return signature_tag; |
173 } | 173 } |
174 | 174 |
175 } // namespace remoting | 175 } // namespace remoting |
OLD | NEW |