Chromium Code Reviews| 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/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/authenticator.h" | 10 #include "remoting/protocol/authenticator.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 const XmlElement* const element, | 228 const XmlElement* const element, |
| 229 const char tag_name[], | 229 const char tag_name[], |
| 230 bool codec_required, | 230 bool codec_required, |
| 231 bool optional, | 231 bool optional, |
| 232 std::vector<ChannelConfig>* const configs) { | 232 std::vector<ChannelConfig>* const configs) { |
| 233 | 233 |
| 234 QName tag(kChromotingXmlNamespace, tag_name); | 234 QName tag(kChromotingXmlNamespace, tag_name); |
| 235 const XmlElement* child = element->FirstNamed(tag); | 235 const XmlElement* child = element->FirstNamed(tag); |
| 236 while (child) { | 236 while (child) { |
| 237 ChannelConfig channel_config; | 237 ChannelConfig channel_config; |
| 238 if (!ParseChannelConfig(child, codec_required, &channel_config)) | 238 if (ParseChannelConfig(child, codec_required, &channel_config)) { |
| 239 return false; | 239 configs->push_back(channel_config); |
| 240 configs->push_back(channel_config); | 240 child = child->NextNamed(tag); |
|
simonmorris
2012/07/26 16:11:06
The loop will go infinite if ParseChannelConfig ev
Sergey Ulanov
2012/07/26 22:54:45
Fixed.
| |
| 241 child = child->NextNamed(tag); | 241 } |
| 242 } | 242 } |
| 243 if (optional && configs->empty()) { | 243 if (optional && configs->empty()) { |
| 244 // If there's no mention of the tag, implicitly assume | 244 // If there's no mention of the tag, implicitly assume |
| 245 // TRANSPORT_NONE for the channel. | 245 // TRANSPORT_NONE for the channel. |
| 246 configs->push_back(ChannelConfig(ChannelConfig::TRANSPORT_NONE, | 246 configs->push_back(ChannelConfig(ChannelConfig::TRANSPORT_NONE, |
| 247 kDefaultStreamVersion, | 247 kDefaultStreamVersion, |
| 248 ChannelConfig::CODEC_VERBATIM)); | 248 ChannelConfig::CODEC_VERBATIM)); |
| 249 } | 249 } |
| 250 return true; | 250 return true; |
| 251 } | 251 } |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 281 authenticator_message.reset(new XmlElement(*child)); | 281 authenticator_message.reset(new XmlElement(*child)); |
| 282 | 282 |
| 283 return new ContentDescription(config.Pass(), authenticator_message.Pass()); | 283 return new ContentDescription(config.Pass(), authenticator_message.Pass()); |
| 284 } | 284 } |
| 285 LOG(ERROR) << "Invalid description: " << element->Str(); | 285 LOG(ERROR) << "Invalid description: " << element->Str(); |
| 286 return NULL; | 286 return NULL; |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace protocol | 289 } // namespace protocol |
| 290 } // namespace remoting | 290 } // namespace remoting |
| OLD | NEW |