OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/register_support_host_request.h" | 5 #include "remoting/host/register_support_host_request.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 if (!lifetime_element) { | 160 if (!lifetime_element) { |
161 error << "<" << kSupportIdLifetimeTag | 161 error << "<" << kSupportIdLifetimeTag |
162 << "> is missing in the host registration response: " | 162 << "> is missing in the host registration response: " |
163 << response->Str(); | 163 << response->Str(); |
164 *error_message = error.str(); | 164 *error_message = error.str(); |
165 LOG(ERROR) << *error_message; | 165 LOG(ERROR) << *error_message; |
166 return; | 166 return; |
167 } | 167 } |
168 | 168 |
169 int lifetime_int; | 169 int lifetime_int; |
170 if (!base::StringToInt(lifetime_element->BodyText().c_str(), &lifetime_int) || | 170 if (!base::StringToInt(lifetime_element->BodyText(), &lifetime_int) || |
171 lifetime_int <= 0) { | 171 lifetime_int <= 0) { |
172 error << "<" << kSupportIdLifetimeTag | 172 error << "<" << kSupportIdLifetimeTag |
173 << "> is malformed in the host registration response: " | 173 << "> is malformed in the host registration response: " |
174 << response->Str(); | 174 << response->Str(); |
175 *error_message = error.str(); | 175 *error_message = error.str(); |
176 LOG(ERROR) << *error_message; | 176 LOG(ERROR) << *error_message; |
177 return; | 177 return; |
178 } | 178 } |
179 | 179 |
180 *support_id = support_id_element->BodyText(); | 180 *support_id = support_id_element->BodyText(); |
(...skipping 17 matching lines...) Expand all Loading... |
198 // Cleanup state before calling the callback. | 198 // Cleanup state before calling the callback. |
199 request_.reset(); | 199 request_.reset(); |
200 iq_sender_.reset(); | 200 iq_sender_.reset(); |
201 signal_strategy_->RemoveListener(this); | 201 signal_strategy_->RemoveListener(this); |
202 signal_strategy_ = nullptr; | 202 signal_strategy_ = nullptr; |
203 | 203 |
204 base::ResetAndReturn(&callback_).Run(support_id, lifetime, error_message); | 204 base::ResetAndReturn(&callback_).Run(support_id, lifetime, error_message); |
205 } | 205 } |
206 | 206 |
207 } // namespace remoting | 207 } // namespace remoting |
OLD | NEW |