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/protocol/jingle_messages.h" | 5 #include "remoting/protocol/jingle_messages.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "remoting/base/constants.h" | 9 #include "remoting/base/constants.h" |
10 #include "remoting/protocol/content_description.h" | 10 #include "remoting/protocol/content_description.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 const XmlElement* ice_transport_tag = content_tag->FirstNamed( | 278 const XmlElement* ice_transport_tag = content_tag->FirstNamed( |
279 QName(kIceTransportNamespace, "transport")); | 279 QName(kIceTransportNamespace, "transport")); |
280 if (ice_transport_tag) { | 280 if (ice_transport_tag) { |
281 transport_info.reset(new buzz::XmlElement(*ice_transport_tag)); | 281 transport_info.reset(new buzz::XmlElement(*ice_transport_tag)); |
282 } | 282 } |
283 } | 283 } |
284 | 284 |
285 return true; | 285 return true; |
286 } | 286 } |
287 | 287 |
288 scoped_ptr<buzz::XmlElement> JingleMessage::ToXml() const { | 288 std::unique_ptr<buzz::XmlElement> JingleMessage::ToXml() const { |
289 scoped_ptr<XmlElement> root( | 289 std::unique_ptr<XmlElement> root( |
290 new XmlElement(QName("jabber:client", "iq"), true)); | 290 new XmlElement(QName("jabber:client", "iq"), true)); |
291 | 291 |
292 DCHECK(!to.empty()); | 292 DCHECK(!to.empty()); |
293 root->AddAttr(QName(kEmptyNamespace, "to"), to); | 293 root->AddAttr(QName(kEmptyNamespace, "to"), to); |
294 if (!from.empty()) | 294 if (!from.empty()) |
295 root->AddAttr(QName(kEmptyNamespace, "from"), from); | 295 root->AddAttr(QName(kEmptyNamespace, "from"), from); |
296 root->SetAttr(QName(kEmptyNamespace, "type"), "set"); | 296 root->SetAttr(QName(kEmptyNamespace, "type"), "set"); |
297 | 297 |
298 XmlElement* jingle_tag = | 298 XmlElement* jingle_tag = |
299 new XmlElement(QName(kJingleNamespace, "jingle"), true); | 299 new XmlElement(QName(kJingleNamespace, "jingle"), true); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 | 360 |
361 JingleMessageReply::JingleMessageReply(ErrorType error, | 361 JingleMessageReply::JingleMessageReply(ErrorType error, |
362 const std::string& text_value) | 362 const std::string& text_value) |
363 : type(REPLY_ERROR), | 363 : type(REPLY_ERROR), |
364 error_type(error), | 364 error_type(error), |
365 text(text_value) { | 365 text(text_value) { |
366 } | 366 } |
367 | 367 |
368 JingleMessageReply::~JingleMessageReply() { } | 368 JingleMessageReply::~JingleMessageReply() { } |
369 | 369 |
370 scoped_ptr<buzz::XmlElement> JingleMessageReply::ToXml( | 370 std::unique_ptr<buzz::XmlElement> JingleMessageReply::ToXml( |
371 const buzz::XmlElement* request_stanza) const { | 371 const buzz::XmlElement* request_stanza) const { |
372 scoped_ptr<XmlElement> iq( | 372 std::unique_ptr<XmlElement> iq( |
373 new XmlElement(QName(kJabberNamespace, "iq"), true)); | 373 new XmlElement(QName(kJabberNamespace, "iq"), true)); |
374 iq->SetAttr(QName(kEmptyNamespace, "to"), | 374 iq->SetAttr(QName(kEmptyNamespace, "to"), |
375 request_stanza->Attr(QName(kEmptyNamespace, "from"))); | 375 request_stanza->Attr(QName(kEmptyNamespace, "from"))); |
376 iq->SetAttr(QName(kEmptyNamespace, "id"), | 376 iq->SetAttr(QName(kEmptyNamespace, "id"), |
377 request_stanza->Attr(QName(kEmptyNamespace, "id"))); | 377 request_stanza->Attr(QName(kEmptyNamespace, "id"))); |
378 | 378 |
379 if (type == REPLY_RESULT) { | 379 if (type == REPLY_RESULT) { |
380 iq->SetAttr(QName(kEmptyNamespace, "type"), "result"); | 380 iq->SetAttr(QName(kEmptyNamespace, "type"), "result"); |
381 return iq; | 381 return iq; |
382 } | 382 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 candidate_tag; candidate_tag = candidate_tag->NextNamed(qn_candidate)) { | 475 candidate_tag; candidate_tag = candidate_tag->NextNamed(qn_candidate)) { |
476 IceTransportInfo::NamedCandidate candidate; | 476 IceTransportInfo::NamedCandidate candidate; |
477 if (!ParseIceCandidate(candidate_tag, &candidate)) | 477 if (!ParseIceCandidate(candidate_tag, &candidate)) |
478 return false; | 478 return false; |
479 candidates.push_back(candidate); | 479 candidates.push_back(candidate); |
480 } | 480 } |
481 | 481 |
482 return true; | 482 return true; |
483 } | 483 } |
484 | 484 |
485 scoped_ptr<buzz::XmlElement> IceTransportInfo::ToXml() const { | 485 std::unique_ptr<buzz::XmlElement> IceTransportInfo::ToXml() const { |
486 scoped_ptr<buzz::XmlElement> result( | 486 std::unique_ptr<buzz::XmlElement> result( |
487 new XmlElement(QName(kIceTransportNamespace, "transport"), true)); | 487 new XmlElement(QName(kIceTransportNamespace, "transport"), true)); |
488 for (const IceCredentials& credentials : ice_credentials) { | 488 for (const IceCredentials& credentials : ice_credentials) { |
489 result->AddElement(FormatIceCredentials(credentials)); | 489 result->AddElement(FormatIceCredentials(credentials)); |
490 } | 490 } |
491 for (const NamedCandidate& candidate : candidates) { | 491 for (const NamedCandidate& candidate : candidates) { |
492 result->AddElement(FormatIceCandidate(candidate)); | 492 result->AddElement(FormatIceCandidate(candidate)); |
493 } | 493 } |
494 return result; | 494 return result; |
495 } | 495 } |
496 | 496 |
497 } // namespace protocol | 497 } // namespace protocol |
498 } // namespace remoting | 498 } // namespace remoting |
OLD | NEW |