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

Unified Diff: remoting/protocol/jingle_messages.cc

Issue 2567953002: [Chromoting] Plugin message in JingleMessage (Closed)
Patch Set: 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
Index: remoting/protocol/jingle_messages.cc
diff --git a/remoting/protocol/jingle_messages.cc b/remoting/protocol/jingle_messages.cc
index 8c8c1640bfd0cf223720c7b8c84a6c8c4a81331b..85b13b4478d6ad47791cf75b648c39e7833fe41b 100644
--- a/remoting/protocol/jingle_messages.cc
+++ b/remoting/protocol/jingle_messages.cc
@@ -342,10 +342,23 @@ bool JingleMessage::ParseXml(const buzz::XmlElement* stanza,
return false;
}
+ const XmlElement* plugin_tag =
+ jingle_tag->FirstNamed(QName(kChromotingXmlNamespace, "plugin"));
+ if (plugin_tag) {
+ plugin_message.reset(new XmlElement(*plugin_tag));
+ } else {
+ plugin_message.reset(nullptr);
+ }
+
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 == plugin_tag) {
+ child = child->NextElement();
+ }
if (child) {
// session-info is allowed to be empty.
info.reset(new XmlElement(*child));
@@ -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 (plugin_message) {
+ jingle_tag->AddElement(new XmlElement(*plugin_message));
+ }
+
if (action == SESSION_INFO) {
if (info.get())
jingle_tag->AddElement(new XmlElement(*info.get()));

Powered by Google App Engine
This is Rietveld 408576698