Chromium Code Reviews| 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" |
| 11 #include "remoting/protocol/name_value_map.h" | 11 #include "remoting/protocol/name_value_map.h" |
| 12 #include "remoting/protocol/session_plugin.h" | |
| 12 #include "remoting/signaling/jid_util.h" | 13 #include "remoting/signaling/jid_util.h" |
| 13 #include "remoting/signaling/remoting_bot.h" | 14 #include "remoting/signaling/remoting_bot.h" |
| 14 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" | 15 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" |
| 15 | 16 |
| 16 using buzz::QName; | 17 using buzz::QName; |
| 17 using buzz::XmlElement; | 18 using buzz::XmlElement; |
| 18 | 19 |
| 19 namespace remoting { | 20 namespace remoting { |
| 20 namespace protocol { | 21 namespace protocol { |
| 21 | 22 |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 504 content_tag->AddElement(new XmlElement(*transport_info)); | 505 content_tag->AddElement(new XmlElement(*transport_info)); |
| 505 } else if (description && description->config()->webrtc_supported()) { | 506 } else if (description && description->config()->webrtc_supported()) { |
| 506 content_tag->AddElement( | 507 content_tag->AddElement( |
| 507 new XmlElement(QName(kWebrtcTransportNamespace, "transport"))); | 508 new XmlElement(QName(kWebrtcTransportNamespace, "transport"))); |
| 508 } | 509 } |
| 509 } | 510 } |
| 510 | 511 |
| 511 return root; | 512 return root; |
| 512 } | 513 } |
| 513 | 514 |
| 515 void JingleMessage::AttachAttachment(std::unique_ptr<XmlElement> attachment) { | |
| 516 if (!attachment) { | |
|
Sergey Ulanov
2016/12/21 01:38:34
I don't think we want to allow attachment to be nu
Hzj_jie
2016/12/22 00:27:10
Done.
The null check needs to be placed either he
| |
| 517 return; | |
| 518 } | |
| 519 if (!attachments) { | |
| 520 attachments.reset(new XmlElement( | |
| 521 QName(kChromotingXmlNamespace, "attachments"))); | |
| 522 } | |
| 523 attachments->AddElement(attachment.release()); | |
| 524 } | |
| 525 | |
| 514 JingleMessageReply::JingleMessageReply() | 526 JingleMessageReply::JingleMessageReply() |
| 515 : type(REPLY_RESULT), | 527 : type(REPLY_RESULT), |
| 516 error_type(NONE) { | 528 error_type(NONE) { |
| 517 } | 529 } |
| 518 | 530 |
| 519 JingleMessageReply::JingleMessageReply(ErrorType error) | 531 JingleMessageReply::JingleMessageReply(ErrorType error) |
| 520 : type(error != NONE ? REPLY_ERROR : REPLY_RESULT), | 532 : type(error != NONE ? REPLY_ERROR : REPLY_RESULT), |
| 521 error_type(error) { | 533 error_type(error) { |
| 522 } | 534 } |
| 523 | 535 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 675 result->AddElement(FormatIceCredentials(credentials)); | 687 result->AddElement(FormatIceCredentials(credentials)); |
| 676 } | 688 } |
| 677 for (const NamedCandidate& candidate : candidates) { | 689 for (const NamedCandidate& candidate : candidates) { |
| 678 result->AddElement(FormatIceCandidate(candidate)); | 690 result->AddElement(FormatIceCandidate(candidate)); |
| 679 } | 691 } |
| 680 return result; | 692 return result; |
| 681 } | 693 } |
| 682 | 694 |
| 683 } // namespace protocol | 695 } // namespace protocol |
| 684 } // namespace remoting | 696 } // namespace remoting |
| OLD | NEW |