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

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: 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (address.empty()) { 204 if (address.empty()) {
205 iqElement->ClearAttr(GetQNameByField(Field::JID, from));
206 iqElement->ClearAttr(GetQNameByField(Field::CHANNEL, from));
207 iqElement->ClearAttr(GetQNameByField(Field::ENDPOINT_ID, from));
Jamie 2016/05/20 00:48:35 I think it might be clearer to clear everything up
205 return; 208 return;
206 } 209 }
207 210
208 iqElement->AddAttr(GetQNameByField(Field::JID, from), address.jid); 211 iqElement->AddAttr(GetQNameByField(Field::JID, from), address.jid);
209 212
210 if (address.channel == SignalingAddress::Channel::LCS) { 213 if (address.channel == SignalingAddress::Channel::LCS) {
211 iqElement->AddAttr(GetQNameByField(Field::ENDPOINT_ID, from), 214 iqElement->AddAttr(GetQNameByField(Field::ENDPOINT_ID, from),
212 address.endpoint_id); 215 address.endpoint_id);
213 const char* channel_str = ValueToName(kChannelTypes, address.channel); 216 const char* channel_str = ValueToName(kChannelTypes, address.channel);
214 iqElement->AddAttr(GetQNameByField(Field::CHANNEL, from), channel_str); 217 iqElement->AddAttr(GetQNameByField(Field::CHANNEL, from), channel_str);
218 } else {
219 iqElement->ClearAttr(GetQNameByField(Field::CHANNEL, from));
220 iqElement->ClearAttr(GetQNameByField(Field::ENDPOINT_ID, from));
215 } 221 }
216 } 222 }
217 223
218 } // namespace 224 } // namespace
219 225
220 IceTransportInfo::NamedCandidate::NamedCandidate( 226 IceTransportInfo::NamedCandidate::NamedCandidate(
221 const std::string& name, 227 const std::string& name,
222 const cricket::Candidate& candidate) 228 const cricket::Candidate& candidate)
223 : name(name), 229 : name(name),
224 candidate(candidate) { 230 candidate(candidate) {
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 result->AddElement(FormatIceCredentials(credentials)); 599 result->AddElement(FormatIceCredentials(credentials));
594 } 600 }
595 for (const NamedCandidate& candidate : candidates) { 601 for (const NamedCandidate& candidate : candidates) {
596 result->AddElement(FormatIceCandidate(candidate)); 602 result->AddElement(FormatIceCandidate(candidate));
597 } 603 }
598 return result; 604 return result;
599 } 605 }
600 606
601 } // namespace protocol 607 } // namespace protocol
602 } // namespace remoting 608 } // 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