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

Side by Side Diff: remoting/protocol/jingle_messages.cc

Issue 1999443004: Clear the channel and endpoint_id in SetAddress for the XMPP channel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's feedback Created 4 years, 7 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 : "|endpoint_id| should be empty for XMPP channel"); 194 : "|endpoint_id| should be empty for XMPP channel");
195 return empty_instance; 195 return empty_instance;
196 } 196 }
197 197
198 return SignalingAddress(jid, endpoint_id, channel); 198 return SignalingAddress(jid, endpoint_id, channel);
199 } 199 }
200 200
201 void SetAddress(buzz::XmlElement* iqElement, 201 void SetAddress(buzz::XmlElement* iqElement,
202 const SignalingAddress& address, 202 const SignalingAddress& address,
203 bool from) { 203 bool from) {
204 // Start from a fresh slate regardless of the previous address format.
205 iqElement->ClearAttr(GetQNameByField(Field::JID, from));
206 iqElement->ClearAttr(GetQNameByField(Field::CHANNEL, from));
207 iqElement->ClearAttr(GetQNameByField(Field::ENDPOINT_ID, from));
208
204 if (address.empty()) { 209 if (address.empty()) {
205 return; 210 return;
206 } 211 }
207 212
213 // Always set the JID.
208 iqElement->AddAttr(GetQNameByField(Field::JID, from), address.jid); 214 iqElement->AddAttr(GetQNameByField(Field::JID, from), address.jid);
209 215
216 // Only set the channel and endpoint_id in the LCS channel.
210 if (address.channel == SignalingAddress::Channel::LCS) { 217 if (address.channel == SignalingAddress::Channel::LCS) {
211 iqElement->AddAttr(GetQNameByField(Field::ENDPOINT_ID, from), 218 iqElement->AddAttr(GetQNameByField(Field::ENDPOINT_ID, from),
212 address.endpoint_id); 219 address.endpoint_id);
213 const char* channel_str = ValueToName(kChannelTypes, address.channel); 220 const char* channel_str = ValueToName(kChannelTypes, address.channel);
214 iqElement->AddAttr(GetQNameByField(Field::CHANNEL, from), channel_str); 221 iqElement->AddAttr(GetQNameByField(Field::CHANNEL, from), channel_str);
215 } 222 }
216 } 223 }
217 224
218 } // namespace 225 } // namespace
219 226
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 result->AddElement(FormatIceCredentials(credentials)); 600 result->AddElement(FormatIceCredentials(credentials));
594 } 601 }
595 for (const NamedCandidate& candidate : candidates) { 602 for (const NamedCandidate& candidate : candidates) {
596 result->AddElement(FormatIceCandidate(candidate)); 603 result->AddElement(FormatIceCandidate(candidate));
597 } 604 }
598 return result; 605 return result;
599 } 606 }
600 607
601 } // namespace protocol 608 } // namespace protocol
602 } // namespace remoting 609 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698