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

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

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 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 | « remoting/protocol/jingle_messages.h ('k') | remoting/protocol/jingle_messages_unittest.cc » ('j') | 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 const XmlElement* ice_transport_tag = content_tag->FirstNamed( 278 const XmlElement* ice_transport_tag = content_tag->FirstNamed(
279 QName(kIceTransportNamespace, "transport")); 279 QName(kIceTransportNamespace, "transport"));
280 if (ice_transport_tag) { 280 if (ice_transport_tag) {
281 transport_info.reset(new buzz::XmlElement(*ice_transport_tag)); 281 transport_info.reset(new buzz::XmlElement(*ice_transport_tag));
282 } 282 }
283 } 283 }
284 284
285 return true; 285 return true;
286 } 286 }
287 287
288 scoped_ptr<buzz::XmlElement> JingleMessage::ToXml() const { 288 std::unique_ptr<buzz::XmlElement> JingleMessage::ToXml() const {
289 scoped_ptr<XmlElement> root( 289 std::unique_ptr<XmlElement> root(
290 new XmlElement(QName("jabber:client", "iq"), true)); 290 new XmlElement(QName("jabber:client", "iq"), true));
291 291
292 DCHECK(!to.empty()); 292 DCHECK(!to.empty());
293 root->AddAttr(QName(kEmptyNamespace, "to"), to); 293 root->AddAttr(QName(kEmptyNamespace, "to"), to);
294 if (!from.empty()) 294 if (!from.empty())
295 root->AddAttr(QName(kEmptyNamespace, "from"), from); 295 root->AddAttr(QName(kEmptyNamespace, "from"), from);
296 root->SetAttr(QName(kEmptyNamespace, "type"), "set"); 296 root->SetAttr(QName(kEmptyNamespace, "type"), "set");
297 297
298 XmlElement* jingle_tag = 298 XmlElement* jingle_tag =
299 new XmlElement(QName(kJingleNamespace, "jingle"), true); 299 new XmlElement(QName(kJingleNamespace, "jingle"), true);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 360
361 JingleMessageReply::JingleMessageReply(ErrorType error, 361 JingleMessageReply::JingleMessageReply(ErrorType error,
362 const std::string& text_value) 362 const std::string& text_value)
363 : type(REPLY_ERROR), 363 : type(REPLY_ERROR),
364 error_type(error), 364 error_type(error),
365 text(text_value) { 365 text(text_value) {
366 } 366 }
367 367
368 JingleMessageReply::~JingleMessageReply() { } 368 JingleMessageReply::~JingleMessageReply() { }
369 369
370 scoped_ptr<buzz::XmlElement> JingleMessageReply::ToXml( 370 std::unique_ptr<buzz::XmlElement> JingleMessageReply::ToXml(
371 const buzz::XmlElement* request_stanza) const { 371 const buzz::XmlElement* request_stanza) const {
372 scoped_ptr<XmlElement> iq( 372 std::unique_ptr<XmlElement> iq(
373 new XmlElement(QName(kJabberNamespace, "iq"), true)); 373 new XmlElement(QName(kJabberNamespace, "iq"), true));
374 iq->SetAttr(QName(kEmptyNamespace, "to"), 374 iq->SetAttr(QName(kEmptyNamespace, "to"),
375 request_stanza->Attr(QName(kEmptyNamespace, "from"))); 375 request_stanza->Attr(QName(kEmptyNamespace, "from")));
376 iq->SetAttr(QName(kEmptyNamespace, "id"), 376 iq->SetAttr(QName(kEmptyNamespace, "id"),
377 request_stanza->Attr(QName(kEmptyNamespace, "id"))); 377 request_stanza->Attr(QName(kEmptyNamespace, "id")));
378 378
379 if (type == REPLY_RESULT) { 379 if (type == REPLY_RESULT) {
380 iq->SetAttr(QName(kEmptyNamespace, "type"), "result"); 380 iq->SetAttr(QName(kEmptyNamespace, "type"), "result");
381 return iq; 381 return iq;
382 } 382 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 candidate_tag; candidate_tag = candidate_tag->NextNamed(qn_candidate)) { 475 candidate_tag; candidate_tag = candidate_tag->NextNamed(qn_candidate)) {
476 IceTransportInfo::NamedCandidate candidate; 476 IceTransportInfo::NamedCandidate candidate;
477 if (!ParseIceCandidate(candidate_tag, &candidate)) 477 if (!ParseIceCandidate(candidate_tag, &candidate))
478 return false; 478 return false;
479 candidates.push_back(candidate); 479 candidates.push_back(candidate);
480 } 480 }
481 481
482 return true; 482 return true;
483 } 483 }
484 484
485 scoped_ptr<buzz::XmlElement> IceTransportInfo::ToXml() const { 485 std::unique_ptr<buzz::XmlElement> IceTransportInfo::ToXml() const {
486 scoped_ptr<buzz::XmlElement> result( 486 std::unique_ptr<buzz::XmlElement> result(
487 new XmlElement(QName(kIceTransportNamespace, "transport"), true)); 487 new XmlElement(QName(kIceTransportNamespace, "transport"), true));
488 for (const IceCredentials& credentials : ice_credentials) { 488 for (const IceCredentials& credentials : ice_credentials) {
489 result->AddElement(FormatIceCredentials(credentials)); 489 result->AddElement(FormatIceCredentials(credentials));
490 } 490 }
491 for (const NamedCandidate& candidate : candidates) { 491 for (const NamedCandidate& candidate : candidates) {
492 result->AddElement(FormatIceCandidate(candidate)); 492 result->AddElement(FormatIceCandidate(candidate));
493 } 493 }
494 return result; 494 return result;
495 } 495 }
496 496
497 } // namespace protocol 497 } // namespace protocol
498 } // namespace remoting 498 } // namespace remoting
OLDNEW
« 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