OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "remoting/host/desktop_resizer.h" |
| 6 |
| 7 namespace remoting { |
| 8 |
| 9 DesktopResizer::~DesktopResizer() { |
| 10 } |
| 11 |
| 12 DesktopResizer::HostStatusObserver::HostStatusObserver( |
| 13 DesktopResizer* desktop_resizer) |
| 14 : desktop_resizer_(desktop_resizer), |
| 15 original_size_(SkISize::Make(0, 0)) { |
| 16 } |
| 17 |
| 18 void DesktopResizer::HostStatusObserver::OnClientAuthenticated( |
| 19 const std::string& jid) { |
| 20 original_size_ = desktop_resizer_->GetSize(); |
| 21 } |
| 22 |
| 23 void DesktopResizer::HostStatusObserver::OnClientDisconnected( |
| 24 const std::string& jid) { |
| 25 if (!original_size_.isZero()) { |
| 26 desktop_resizer_->SetSize(original_size_); |
| 27 original_size_.set(0, 0); |
| 28 } |
| 29 } |
| 30 |
| 31 void DesktopResizer::HostStatusObserver::OnClientDimensionsChanged( |
| 32 const SkISize& size) { |
| 33 // Set a sensible minimum size for the host desktop. Note that the |
| 34 // implementation is free to impose a stricter minimum size and/or |
| 35 // a maximum size in addition to this. |
| 36 const int kMinWidth = 640; |
| 37 const int kMinHeight = 480; |
| 38 SkISize new_size(SkISize::Make(std::max(kMinWidth, size.width()), |
| 39 std::max(kMinHeight, size.height()))); |
| 40 desktop_resizer_->SetSize(new_size); |
| 41 } |
| 42 |
| 43 } // namespace remoting |
OLD | NEW |