| 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/resizing_host_observer.h" | 5 #include "remoting/host/resizing_host_observer.h" |
| 6 #include "remoting/host/desktop_resizer.h" | 6 #include "remoting/host/desktop_resizer.h" |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // are typically designed for landscape aspect ratios. | 119 // are typically designed for landscape aspect ratios. |
| 120 return size().width() > other.size().width(); | 120 return size().width() > other.size().width(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 private: | 123 private: |
| 124 float client_scale_factor_; | 124 float client_scale_factor_; |
| 125 float aspect_ratio_goodness_; | 125 float aspect_ratio_goodness_; |
| 126 SkISize size_; | 126 SkISize size_; |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 void ResizingHostObserver::OnClientDimensionsChanged( | 129 void ResizingHostObserver::OnClientResolutionChanged( |
| 130 const std::string& jid, const SkISize& preferred_size) { | 130 const std::string& jid, |
| 131 const SkISize& preferred_size, |
| 132 const SkIPoint& dpi) { |
| 131 if (previous_size_.isZero() || preferred_size.isEmpty()) { | 133 if (previous_size_.isZero() || preferred_size.isEmpty()) { |
| 132 return; | 134 return; |
| 133 } | 135 } |
| 134 | 136 |
| 135 // If the host desktop size changes other than via the resize-to-client | 137 // If the host desktop size changes other than via the resize-to-client |
| 136 // mechanism, then set |previous_size_| to zero and give up. This is an | 138 // mechanism, then set |previous_size_| to zero and give up. This is an |
| 137 // indication that the user doesn't want resize-to-client. | 139 // indication that the user doesn't want resize-to-client. |
| 138 SkISize current_size = desktop_resizer_->GetCurrentSize(); | 140 SkISize current_size = desktop_resizer_->GetCurrentSize(); |
| 139 if (current_size != previous_size_) { | 141 if (current_size != previous_size_) { |
| 140 previous_size_ = SkISize::Make(0, 0); | 142 previous_size_ = SkISize::Make(0, 0); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 155 if (candidate_size.IsBetterThan(best_size)) { | 157 if (candidate_size.IsBetterThan(best_size)) { |
| 156 best_size = candidate_size; | 158 best_size = candidate_size; |
| 157 } | 159 } |
| 158 } | 160 } |
| 159 previous_size_ = best_size.size(); | 161 previous_size_ = best_size.size(); |
| 160 if (previous_size_ != current_size) | 162 if (previous_size_ != current_size) |
| 161 desktop_resizer_->SetSize(previous_size_); | 163 desktop_resizer_->SetSize(previous_size_); |
| 162 } | 164 } |
| 163 | 165 |
| 164 } // namespace remoting | 166 } // namespace remoting |
| OLD | NEW |