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

Unified Diff: remoting/protocol/jingle_messages.cc

Issue 10209008: Roll libjingle 132:133 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/jingle_messages.h ('k') | remoting/protocol/jingle_session.h » ('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 aea59a8280c8578f64551a145460ff9d15a43e28..104d7f3f8d563050715ffd4975b77457643d9fee 100644
--- a/remoting/protocol/jingle_messages.cc
+++ b/remoting/protocol/jingle_messages.cc
@@ -8,7 +8,6 @@
#include "base/string_number_conversions.h"
#include "remoting/base/constants.h"
#include "remoting/protocol/content_description.h"
-#include "third_party/libjingle/source/talk/p2p/base/candidate.h"
#include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
using buzz::QName;
@@ -72,7 +71,7 @@ const NameMapElement<JingleMessage::Reason> kReasons[] = {
};
bool ParseCandidate(const buzz::XmlElement* element,
- cricket::Candidate* candidate) {
+ JingleMessage::NamedCandidate* candidate) {
DCHECK(element->Name() == QName(kP2PTransportNamespace, "candidate"));
const std::string& name = element->Attr(QName(kEmptyNamespace, "name"));
@@ -101,39 +100,53 @@ bool ParseCandidate(const buzz::XmlElement* element,
return false;
}
- candidate->set_name(name);
- candidate->set_address(talk_base::SocketAddress(address, port));
- candidate->set_type(type);
- candidate->set_protocol(protocol);
- candidate->set_username(username);
- candidate->set_password(password);
- candidate->set_preference(static_cast<float>(preference));
- candidate->set_generation(generation);
+ candidate->name = name;
+
+ candidate->candidate.set_address(talk_base::SocketAddress(address, port));
+ candidate->candidate.set_type(type);
+ candidate->candidate.set_protocol(protocol);
+ candidate->candidate.set_username(username);
+ candidate->candidate.set_password(password);
+ candidate->candidate.set_preference(static_cast<float>(preference));
+ candidate->candidate.set_generation(generation);
return true;
}
-XmlElement* FormatCandidate(const cricket::Candidate& candidate) {
+XmlElement* FormatCandidate(const JingleMessage::NamedCandidate& candidate) {
XmlElement* result =
new XmlElement(QName(kP2PTransportNamespace, "candidate"));
- result->SetAttr(QName(kEmptyNamespace, "name"), candidate.name());
+ result->SetAttr(QName(kEmptyNamespace, "name"), candidate.name);
result->SetAttr(QName(kEmptyNamespace, "address"),
- candidate.address().IPAsString());
+ candidate.candidate.address().IPAsString());
result->SetAttr(QName(kEmptyNamespace, "port"),
- base::IntToString(candidate.address().port()));
- result->SetAttr(QName(kEmptyNamespace, "type"), candidate.type());
- result->SetAttr(QName(kEmptyNamespace, "protocol"), candidate.protocol());
- result->SetAttr(QName(kEmptyNamespace, "username"), candidate.username());
- result->SetAttr(QName(kEmptyNamespace, "password"), candidate.password());
+ base::IntToString(candidate.candidate.address().port()));
+ result->SetAttr(QName(kEmptyNamespace, "type"), candidate.candidate.type());
+ result->SetAttr(QName(kEmptyNamespace, "protocol"),
+ candidate.candidate.protocol());
+ result->SetAttr(QName(kEmptyNamespace, "username"),
+ candidate.candidate.username());
+ result->SetAttr(QName(kEmptyNamespace, "password"),
+ candidate.candidate.password());
result->SetAttr(QName(kEmptyNamespace, "preference"),
- base::DoubleToString(candidate.preference()));
+ base::DoubleToString(candidate.candidate.preference()));
result->SetAttr(QName(kEmptyNamespace, "generation"),
- base::IntToString(candidate.generation()));
+ base::IntToString(candidate.candidate.generation()));
return result;
}
} // namespace
+JingleMessage::NamedCandidate::NamedCandidate() {
+}
+
+JingleMessage::NamedCandidate::NamedCandidate(
+ const std::string& name,
+ const cricket::Candidate& candidate)
+ : name(name),
+ candidate(candidate) {
+}
+
// static
bool JingleMessage::IsJingleMessage(const buzz::XmlElement* stanza) {
return
@@ -262,7 +275,7 @@ bool JingleMessage::ParseXml(const buzz::XmlElement* stanza,
transport_tag->FirstNamed(qn_candidate);
candidate_tag != NULL;
candidate_tag = candidate_tag->NextNamed(qn_candidate)) {
- cricket::Candidate candidate;
+ NamedCandidate candidate;
if (!ParseCandidate(candidate_tag, &candidate)) {
*error = "Failed to parse candidates";
return false;
@@ -330,7 +343,7 @@ scoped_ptr<buzz::XmlElement> JingleMessage::ToXml() const {
XmlElement* transport_tag =
new XmlElement(QName(kP2PTransportNamespace, "transport"), true);
content_tag->AddElement(transport_tag);
- for (std::list<cricket::Candidate>::const_iterator it = candidates.begin();
+ for (std::list<NamedCandidate>::const_iterator it = candidates.begin();
it != candidates.end(); ++it) {
transport_tag->AddElement(FormatCandidate(*it));
}
« no previous file with comments | « remoting/protocol/jingle_messages.h ('k') | remoting/protocol/jingle_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698