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/content_description.h" | 5 #include "remoting/protocol/content_description.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/authenticator.h" | 10 #include "remoting/protocol/authenticator.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // <audio transport="stream" codec="opus" version="1" /> | 138 // <audio transport="stream" codec="opus" version="1" /> |
139 // <authentication> | 139 // <authentication> |
140 // Message created by Authenticator implementation. | 140 // Message created by Authenticator implementation. |
141 // </authentication> | 141 // </authentication> |
142 // </description> | 142 // </description> |
143 // | 143 // |
144 XmlElement* ContentDescription::ToXml() const { | 144 XmlElement* ContentDescription::ToXml() const { |
145 XmlElement* root = new XmlElement( | 145 XmlElement* root = new XmlElement( |
146 QName(kChromotingXmlNamespace, kDescriptionTag), true); | 146 QName(kChromotingXmlNamespace, kDescriptionTag), true); |
147 | 147 |
148 std::vector<ChannelConfig>::const_iterator it; | 148 std::list<ChannelConfig>::const_iterator it; |
149 | 149 |
150 for (it = config()->control_configs().begin(); | 150 for (it = config()->control_configs().begin(); |
151 it != config()->control_configs().end(); ++it) { | 151 it != config()->control_configs().end(); ++it) { |
152 root->AddElement(FormatChannelConfig(*it, kControlTag)); | 152 root->AddElement(FormatChannelConfig(*it, kControlTag)); |
153 } | 153 } |
154 | 154 |
155 for (it = config()->event_configs().begin(); | 155 for (it = config()->event_configs().begin(); |
156 it != config()->event_configs().end(); ++it) { | 156 it != config()->event_configs().end(); ++it) { |
157 root->AddElement(FormatChannelConfig(*it, kEventTag)); | 157 root->AddElement(FormatChannelConfig(*it, kEventTag)); |
158 } | 158 } |
(...skipping 25 matching lines...) Expand all Loading... |
184 } | 184 } |
185 | 185 |
186 // static | 186 // static |
187 // Adds the channel configs corresponding to |tag_name|, | 187 // Adds the channel configs corresponding to |tag_name|, |
188 // found in |element|, to |configs|. | 188 // found in |element|, to |configs|. |
189 bool ContentDescription::ParseChannelConfigs( | 189 bool ContentDescription::ParseChannelConfigs( |
190 const XmlElement* const element, | 190 const XmlElement* const element, |
191 const char tag_name[], | 191 const char tag_name[], |
192 bool codec_required, | 192 bool codec_required, |
193 bool optional, | 193 bool optional, |
194 std::vector<ChannelConfig>* const configs) { | 194 std::list<ChannelConfig>* const configs) { |
195 | 195 |
196 QName tag(kChromotingXmlNamespace, tag_name); | 196 QName tag(kChromotingXmlNamespace, tag_name); |
197 const XmlElement* child = element->FirstNamed(tag); | 197 const XmlElement* child = element->FirstNamed(tag); |
198 while (child) { | 198 while (child) { |
199 ChannelConfig channel_config; | 199 ChannelConfig channel_config; |
200 if (ParseChannelConfig(child, codec_required, &channel_config)) { | 200 if (ParseChannelConfig(child, codec_required, &channel_config)) { |
201 configs->push_back(channel_config); | 201 configs->push_back(channel_config); |
202 } | 202 } |
203 child = child->NextNamed(tag); | 203 child = child->NextNamed(tag); |
204 } | 204 } |
(...skipping 28 matching lines...) Expand all Loading... |
233 const XmlElement* child = Authenticator::FindAuthenticatorMessage(element); | 233 const XmlElement* child = Authenticator::FindAuthenticatorMessage(element); |
234 if (child) | 234 if (child) |
235 authenticator_message.reset(new XmlElement(*child)); | 235 authenticator_message.reset(new XmlElement(*child)); |
236 | 236 |
237 return scoped_ptr<ContentDescription>( | 237 return scoped_ptr<ContentDescription>( |
238 new ContentDescription(config.Pass(), authenticator_message.Pass())); | 238 new ContentDescription(config.Pass(), authenticator_message.Pass())); |
239 } | 239 } |
240 | 240 |
241 } // namespace protocol | 241 } // namespace protocol |
242 } // namespace remoting | 242 } // namespace remoting |
OLD | NEW |