Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Unified Diff: remoting/protocol/jingle_messages.cc

Issue 2567953002: [Chromoting] Plugin message in JingleMessage (Closed)
Patch Set: Resolve review comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/jingle_messages.h ('k') | remoting/protocol/jingle_messages_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/jingle_messages.cc
diff --git a/remoting/protocol/jingle_messages.cc b/remoting/protocol/jingle_messages.cc
index 8c8c1640bfd0cf223720c7b8c84a6c8c4a81331b..86435e4f10543dba2b795eca0c6e01408b3bb143 100644
--- a/remoting/protocol/jingle_messages.cc
+++ b/remoting/protocol/jingle_messages.cc
@@ -342,15 +342,28 @@ bool JingleMessage::ParseXml(const buzz::XmlElement* stanza,
return false;
}
+ const XmlElement* attachments_tag =
+ jingle_tag->FirstNamed(QName(kChromotingXmlNamespace, "attachments"));
+ if (attachments_tag) {
+ attachments.reset(new XmlElement(*attachments_tag));
+ } else {
+ attachments.reset();
+ }
+
if (action == SESSION_INFO) {
// session-info messages may contain arbitrary information not
// defined by the Jingle protocol. We don't need to parse it.
const XmlElement* child = jingle_tag->FirstElement();
+ // Plugin messages are action independent, which should not be considered as
+ // session-info.
+ if (child == attachments_tag) {
Sergey Ulanov 2016/12/15 19:18:25 nit: remove {} for consistency with other single-l
Hzj_jie 2016/12/15 22:41:19 Though in coding style, ignoring {} is allowed for
+ child = child->NextElement();
+ }
if (child) {
// session-info is allowed to be empty.
info.reset(new XmlElement(*child));
} else {
- info.reset(nullptr);
+ info.reset();
}
return true;
}
@@ -396,7 +409,7 @@ bool JingleMessage::ParseXml(const buzz::XmlElement* stanza,
transport_info.reset(new buzz::XmlElement(*webrtc_transport_tag));
}
- description.reset(nullptr);
+ description.reset();
if (action == SESSION_INITIATE || action == SESSION_ACCEPT) {
const XmlElement* description_tag = content_tag->FirstNamed(
QName(kChromotingXmlNamespace, "description"));
@@ -443,6 +456,10 @@ std::unique_ptr<buzz::XmlElement> JingleMessage::ToXml() const {
LOG(FATAL) << "Invalid action value " << action;
jingle_tag->AddAttr(QName(kEmptyNamespace, "action"), action_attr);
+ if (attachments) {
Sergey Ulanov 2016/12/15 19:18:25 nit: remove {} for consistency with other single-l
Hzj_jie 2016/12/15 22:41:19 Ditto.
+ jingle_tag->AddElement(new XmlElement(*attachments));
+ }
+
if (action == SESSION_INFO) {
if (info.get())
jingle_tag->AddElement(new XmlElement(*info.get()));
« no previous file with comments | « remoting/protocol/jingle_messages.h ('k') | remoting/protocol/jingle_messages_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698