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

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

Issue 9452038: Implement timeouts for IQ requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix release build Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/jingle_messages.h ('k') | remoting/protocol/jingle_session.h » ('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/string_number_conversions.h" 8 #include "base/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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } // namespace 134 } // namespace
135 135
136 // static 136 // static
137 bool JingleMessage::IsJingleMessage(const buzz::XmlElement* stanza) { 137 bool JingleMessage::IsJingleMessage(const buzz::XmlElement* stanza) {
138 return 138 return
139 stanza->Name() == QName(kJabberNamespace, "iq") && 139 stanza->Name() == QName(kJabberNamespace, "iq") &&
140 stanza->Attr(QName("", "type")) == "set" && 140 stanza->Attr(QName("", "type")) == "set" &&
141 stanza->FirstNamed(QName(kJingleNamespace, "jingle")) != NULL; 141 stanza->FirstNamed(QName(kJingleNamespace, "jingle")) != NULL;
142 } 142 }
143 143
144 // static
145 std::string JingleMessage::GetActionName(ActionType action) {
146 return ValueToName(kActionTypes, arraysize(kActionTypes), action);
147 }
148
144 JingleMessage::JingleMessage() 149 JingleMessage::JingleMessage()
145 : action(UNKNOWN_ACTION), 150 : action(UNKNOWN_ACTION),
146 reason(UNKNOWN_REASON) { 151 reason(UNKNOWN_REASON) {
147 } 152 }
148 153
149 JingleMessage::JingleMessage( 154 JingleMessage::JingleMessage(
150 const std::string& to_value, 155 const std::string& to_value,
151 ActionType action_value, 156 ActionType action_value,
152 const std::string& sid_value) 157 const std::string& sid_value)
153 : to(to_value), 158 : to(to_value),
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 *error = "Failed to parse candidates"; 266 *error = "Failed to parse candidates";
262 return false; 267 return false;
263 } 268 }
264 candidates.push_back(candidate); 269 candidates.push_back(candidate);
265 } 270 }
266 } 271 }
267 272
268 return true; 273 return true;
269 } 274 }
270 275
271 scoped_ptr<buzz::XmlElement> JingleMessage::ToXml() { 276 scoped_ptr<buzz::XmlElement> JingleMessage::ToXml() const {
272 scoped_ptr<XmlElement> root( 277 scoped_ptr<XmlElement> root(
273 new XmlElement(QName("jabber:client", "iq"), true)); 278 new XmlElement(QName("jabber:client", "iq"), true));
274 279
275 DCHECK(!to.empty()); 280 DCHECK(!to.empty());
276 root->AddAttr(QName(kEmptyNamespace, "to"), to); 281 root->AddAttr(QName(kEmptyNamespace, "to"), to);
277 if (!from.empty()) 282 if (!from.empty())
278 root->AddAttr(QName(kEmptyNamespace, "from"), from); 283 root->AddAttr(QName(kEmptyNamespace, "from"), from);
279 root->SetAttr(QName(kEmptyNamespace, "type"), "set"); 284 root->SetAttr(QName(kEmptyNamespace, "type"), "set");
280 285
281 XmlElement* jingle_tag = 286 XmlElement* jingle_tag =
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 text_elem->SetAttr(QName(kXmlNamespace, "lang"), "en"); 434 text_elem->SetAttr(QName(kXmlNamespace, "lang"), "en");
430 text_elem->SetBodyText(error_text); 435 text_elem->SetBodyText(error_text);
431 error->AddElement(text_elem); 436 error->AddElement(text_elem);
432 } 437 }
433 438
434 return iq.Pass(); 439 return iq.Pass();
435 } 440 }
436 441
437 } // namespace protocol 442 } // namespace protocol
438 } // namespace remoting 443 } // namespace remoting
OLDNEW
« 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