| 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/host/client_session.h" | 5 #include "remoting/host/client_session.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 DCHECK(!input_injector_); | 104 DCHECK(!input_injector_); |
| 105 DCHECK(!screen_controls_); | 105 DCHECK(!screen_controls_); |
| 106 DCHECK(!video_stream_); | 106 DCHECK(!video_stream_); |
| 107 | 107 |
| 108 connection_.reset(); | 108 connection_.reset(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void ClientSession::NotifyClientResolution( | 111 void ClientSession::NotifyClientResolution( |
| 112 const protocol::ClientResolution& resolution) { | 112 const protocol::ClientResolution& resolution) { |
| 113 DCHECK(CalledOnValidThread()); | 113 DCHECK(CalledOnValidThread()); |
| 114 | 114 DCHECK(resolution.dips_width() > 0 && resolution.dips_height() > 0); |
| 115 // TODO(sergeyu): Move these checks to protocol layer. | |
| 116 if (!resolution.has_dips_width() || !resolution.has_dips_height() || | |
| 117 resolution.dips_width() < 0 || resolution.dips_height() < 0 || | |
| 118 resolution.width() <= 0 || resolution.height() <= 0) { | |
| 119 LOG(ERROR) << "Received invalid ClientResolution message."; | |
| 120 return; | |
| 121 } | |
| 122 | 115 |
| 123 VLOG(1) << "Received ClientResolution (dips_width=" | 116 VLOG(1) << "Received ClientResolution (dips_width=" |
| 124 << resolution.dips_width() << ", dips_height=" | 117 << resolution.dips_width() << ", dips_height=" |
| 125 << resolution.dips_height() << ")"; | 118 << resolution.dips_height() << ")"; |
| 126 | 119 |
| 127 if (!screen_controls_) | 120 if (!screen_controls_) |
| 128 return; | 121 return; |
| 129 | 122 |
| 130 ScreenResolution client_resolution( | 123 ScreenResolution client_resolution( |
| 131 webrtc::DesktopSize(resolution.dips_width(), resolution.dips_height()), | 124 webrtc::DesktopSize(resolution.dips_width(), resolution.dips_height()), |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 connection_->client_stub()->SetVideoLayout(layout); | 470 connection_->client_stub()->SetVideoLayout(layout); |
| 478 } else { | 471 } else { |
| 479 pending_video_layout_message_.reset(new protocol::VideoLayout(layout)); | 472 pending_video_layout_message_.reset(new protocol::VideoLayout(layout)); |
| 480 } | 473 } |
| 481 break; | 474 break; |
| 482 } | 475 } |
| 483 } | 476 } |
| 484 } | 477 } |
| 485 | 478 |
| 486 } // namespace remoting | 479 } // namespace remoting |
| OLD | NEW |