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 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "remoting/host/desktop_resizer.h" | 10 #include "remoting/host/desktop_resizer.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 desktop_resizer_->RestoreSize(original_size_); | 109 desktop_resizer_->RestoreSize(original_size_); |
110 } | 110 } |
111 | 111 |
112 void ResizingHostObserver::SetScreenResolution( | 112 void ResizingHostObserver::SetScreenResolution( |
113 const ScreenResolution& resolution) { | 113 const ScreenResolution& resolution) { |
114 if (resolution.IsEmpty()) | 114 if (resolution.IsEmpty()) |
115 return; | 115 return; |
116 | 116 |
117 // If the implementation returns any sizes, pick the best one according to | 117 // If the implementation returns any sizes, pick the best one according to |
118 // the algorithm described in CandidateSize::IsBetterThen. | 118 // the algorithm described in CandidateSize::IsBetterThen. |
119 std::list<SkISize> sizes = | 119 SkISize dimentions = SkISize::Make( |
120 desktop_resizer_->GetSupportedSizes(resolution.dimensions_); | 120 resolution.dimensions().width(), resolution.dimensions().height()); |
121 if (sizes.empty()) { | 121 std::list<SkISize> sizes = desktop_resizer_->GetSupportedSizes(dimentions); |
| 122 if (sizes.empty()) |
122 return; | 123 return; |
123 } | 124 CandidateSize best_size(sizes.front(), dimentions); |
124 CandidateSize best_size(sizes.front(), resolution.dimensions_); | |
125 for (std::list<SkISize>::const_iterator i = ++sizes.begin(); | 125 for (std::list<SkISize>::const_iterator i = ++sizes.begin(); |
126 i != sizes.end(); ++i) { | 126 i != sizes.end(); ++i) { |
127 CandidateSize candidate_size(*i, resolution.dimensions_); | 127 CandidateSize candidate_size(*i, dimentions); |
128 if (candidate_size.IsBetterThan(best_size)) { | 128 if (candidate_size.IsBetterThan(best_size)) { |
129 best_size = candidate_size; | 129 best_size = candidate_size; |
130 } | 130 } |
131 } | 131 } |
132 SkISize current_size = desktop_resizer_->GetCurrentSize(); | 132 SkISize current_size = desktop_resizer_->GetCurrentSize(); |
133 if (best_size.size() != current_size) | 133 if (best_size.size() != current_size) |
134 desktop_resizer_->SetSize(best_size.size()); | 134 desktop_resizer_->SetSize(best_size.size()); |
135 } | 135 } |
136 | 136 |
137 } // namespace remoting | 137 } // namespace remoting |
OLD | NEW |