OLD | NEW |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 template <typename T> | 48 template <typename T> |
49 T NameToValue(const NameMapElement<T> map[], size_t map_size, | 49 T NameToValue(const NameMapElement<T> map[], size_t map_size, |
50 const std::string& name, T default_value) { | 50 const std::string& name, T default_value) { |
51 for (size_t i = 0; i < map_size; ++i) { | 51 for (size_t i = 0; i < map_size; ++i) { |
52 if (map[i].name == name) | 52 if (map[i].name == name) |
53 return map[i].value; | 53 return map[i].value; |
54 } | 54 } |
55 return default_value; | 55 return default_value; |
56 } | 56 } |
57 | 57 |
58 static const NameMapElement<JingleMessage::ActionType> kActionTypes[] = { | 58 const NameMapElement<JingleMessage::ActionType> kActionTypes[] = { |
59 { JingleMessage::SESSION_INITIATE, "session-initiate" }, | 59 { JingleMessage::SESSION_INITIATE, "session-initiate" }, |
60 { JingleMessage::SESSION_ACCEPT, "session-accept" }, | 60 { JingleMessage::SESSION_ACCEPT, "session-accept" }, |
61 { JingleMessage::SESSION_TERMINATE, "session-terminate" }, | 61 { JingleMessage::SESSION_TERMINATE, "session-terminate" }, |
62 { JingleMessage::SESSION_INFO, "session-info" }, | 62 { JingleMessage::SESSION_INFO, "session-info" }, |
63 { JingleMessage::TRANSPORT_INFO, "transport-info" }, | 63 { JingleMessage::TRANSPORT_INFO, "transport-info" }, |
64 }; | 64 }; |
65 | 65 |
66 static const NameMapElement<JingleMessage::Reason> kReasons[] = { | 66 const NameMapElement<JingleMessage::Reason> kReasons[] = { |
67 { JingleMessage::SUCCESS, "success" }, | 67 { JingleMessage::SUCCESS, "success" }, |
68 { JingleMessage::DECLINE, "decline" }, | 68 { JingleMessage::DECLINE, "decline" }, |
69 { JingleMessage::GENERAL_ERROR, "general-error" }, | 69 { JingleMessage::GENERAL_ERROR, "general-error" }, |
70 { JingleMessage::INCOMPATIBLE_PARAMETERS, "incompatible-parameters" }, | 70 { JingleMessage::INCOMPATIBLE_PARAMETERS, "incompatible-parameters" }, |
71 }; | 71 }; |
72 | 72 |
73 bool ParseCandidate(const buzz::XmlElement* element, | 73 bool ParseCandidate(const buzz::XmlElement* element, |
74 cricket::Candidate* candidate) { | 74 cricket::Candidate* candidate) { |
75 DCHECK(element->Name() == QName(kP2PTransportNamespace, "candidate")); | 75 DCHECK(element->Name() == QName(kP2PTransportNamespace, "candidate")); |
76 | 76 |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 text_elem->SetAttr(QName(kXmlNamespace, "lang"), "en"); | 428 text_elem->SetAttr(QName(kXmlNamespace, "lang"), "en"); |
429 text_elem->SetBodyText(error_text); | 429 text_elem->SetBodyText(error_text); |
430 error->AddElement(text_elem); | 430 error->AddElement(text_elem); |
431 } | 431 } |
432 | 432 |
433 return iq; | 433 return iq; |
434 } | 434 } |
435 | 435 |
436 } // namespace protocol | 436 } // namespace protocol |
437 } // namespace remoting | 437 } // namespace remoting |
OLD | NEW |