OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_session_manager.h" | 5 #include "remoting/protocol/jingle_session_manager.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.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/jingle_glue/jingle_thread.h" | 10 #include "remoting/jingle_glue/jingle_thread.h" |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 CandidateSessionConfig::CreateEmpty()); | 352 CandidateSessionConfig::CreateEmpty()); |
353 const XmlElement* child = NULL; | 353 const XmlElement* child = NULL; |
354 | 354 |
355 // <control> tags. | 355 // <control> tags. |
356 QName control_tag(kChromotingXmlNamespace, kControlTag); | 356 QName control_tag(kChromotingXmlNamespace, kControlTag); |
357 child = element->FirstNamed(control_tag); | 357 child = element->FirstNamed(control_tag); |
358 while (child) { | 358 while (child) { |
359 ChannelConfig channel_config; | 359 ChannelConfig channel_config; |
360 if (!ParseChannelConfig(child, false, &channel_config)) | 360 if (!ParseChannelConfig(child, false, &channel_config)) |
361 return false; | 361 return false; |
362 config->AddControlConfig(channel_config); | 362 config->mutable_control_configs()->push_back(channel_config); |
363 child = element->NextNamed(control_tag); | 363 child = element->NextNamed(control_tag); |
364 } | 364 } |
365 | 365 |
366 // <event> tags. | 366 // <event> tags. |
367 QName event_tag(kChromotingXmlNamespace, kEventTag); | 367 QName event_tag(kChromotingXmlNamespace, kEventTag); |
368 child = element->FirstNamed(event_tag); | 368 child = element->FirstNamed(event_tag); |
369 while (child) { | 369 while (child) { |
370 ChannelConfig channel_config; | 370 ChannelConfig channel_config; |
371 if (!ParseChannelConfig(child, false, &channel_config)) | 371 if (!ParseChannelConfig(child, false, &channel_config)) |
372 return false; | 372 return false; |
373 config->AddEventConfig(channel_config); | 373 config->mutable_event_configs()->push_back(channel_config); |
374 child = element->NextNamed(event_tag); | 374 child = element->NextNamed(event_tag); |
375 } | 375 } |
376 | 376 |
377 // <video> tags. | 377 // <video> tags. |
378 QName video_tag(kChromotingXmlNamespace, kVideoTag); | 378 QName video_tag(kChromotingXmlNamespace, kVideoTag); |
379 child = element->FirstNamed(video_tag); | 379 child = element->FirstNamed(video_tag); |
380 while (child) { | 380 while (child) { |
381 ChannelConfig channel_config; | 381 ChannelConfig channel_config; |
382 if (!ParseChannelConfig(child, true, &channel_config)) | 382 if (!ParseChannelConfig(child, true, &channel_config)) |
383 return false; | 383 return false; |
384 config->AddVideoConfig(channel_config); | 384 config->mutable_video_configs()->push_back(channel_config); |
385 child = element->NextNamed(video_tag); | 385 child = element->NextNamed(video_tag); |
386 } | 386 } |
387 | 387 |
388 // <initial-resolution> tag. | 388 // <initial-resolution> tag. |
389 child = element->FirstNamed(QName(kChromotingXmlNamespace, kResolutionTag)); | 389 child = element->FirstNamed(QName(kChromotingXmlNamespace, kResolutionTag)); |
390 if (!child) | 390 if (!child) |
391 return false; // Resolution must always be specified. | 391 return false; // Resolution must always be specified. |
392 int width; | 392 int width; |
393 int height; | 393 int height; |
394 if (!base::StringToInt(child->Attr(QName(kDefaultNs, kWidthAttr)), | 394 if (!base::StringToInt(child->Attr(QName(kDefaultNs, kWidthAttr)), |
395 &width) || | 395 &width) || |
396 !base::StringToInt(child->Attr(QName(kDefaultNs, kHeightAttr)), | 396 !base::StringToInt(child->Attr(QName(kDefaultNs, kHeightAttr)), |
397 &height)) { | 397 &height)) { |
398 return false; | 398 return false; |
399 } | 399 } |
400 ScreenResolution resolution(width, height); | 400 ScreenResolution resolution(width, height); |
401 if (!resolution.IsValid()) { | 401 if (!resolution.IsValid()) { |
402 return false; | 402 return false; |
403 } | 403 } |
404 | 404 |
405 config->SetInitialResolution(resolution); | 405 *config->mutable_initial_resolution() = resolution; |
406 | 406 |
407 *content = new ContentDescription(config.release()); | 407 *content = new ContentDescription(config.release()); |
408 return true; | 408 return true; |
409 } | 409 } |
410 LOG(ERROR) << "Invalid description: " << element->Str(); | 410 LOG(ERROR) << "Invalid description: " << element->Str(); |
411 return false; | 411 return false; |
412 } | 412 } |
413 | 413 |
414 // WriteContent creates content description for chromoting session. The | 414 // WriteContent creates content description for chromoting session. The |
415 // description looks as follows: | 415 // description looks as follows: |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 const CandidateSessionConfig* config) { | 467 const CandidateSessionConfig* config) { |
468 SessionDescription* desc = new SessionDescription(); | 468 SessionDescription* desc = new SessionDescription(); |
469 desc->AddContent(JingleSession::kChromotingContentName, | 469 desc->AddContent(JingleSession::kChromotingContentName, |
470 kChromotingXmlNamespace, | 470 kChromotingXmlNamespace, |
471 new ContentDescription(config)); | 471 new ContentDescription(config)); |
472 return desc; | 472 return desc; |
473 } | 473 } |
474 | 474 |
475 } // namespace protocol | 475 } // namespace protocol |
476 } // namespace remoting | 476 } // namespace remoting |
OLD | NEW |