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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 private: | 109 private: |
110 float client_scale_factor_; | 110 float client_scale_factor_; |
111 float aspect_ratio_goodness_; | 111 float aspect_ratio_goodness_; |
112 ScreenResolution resolution_; | 112 ScreenResolution resolution_; |
113 }; | 113 }; |
114 | 114 |
115 } // namespace | 115 } // namespace |
116 | 116 |
117 ResizingHostObserver::ResizingHostObserver( | 117 ResizingHostObserver::ResizingHostObserver( |
118 scoped_ptr<DesktopResizer> desktop_resizer) | 118 scoped_ptr<DesktopResizer> desktop_resizer) |
119 : desktop_resizer_(desktop_resizer.Pass()), | 119 : desktop_resizer_(std::move(desktop_resizer)), |
120 now_function_(base::Bind(base::Time::Now)), | 120 now_function_(base::Bind(base::Time::Now)), |
121 weak_factory_(this) { | 121 weak_factory_(this) {} |
122 } | |
123 | 122 |
124 ResizingHostObserver::~ResizingHostObserver() { | 123 ResizingHostObserver::~ResizingHostObserver() { |
125 if (!original_resolution_.IsEmpty()) | 124 if (!original_resolution_.IsEmpty()) |
126 desktop_resizer_->RestoreResolution(original_resolution_); | 125 desktop_resizer_->RestoreResolution(original_resolution_); |
127 } | 126 } |
128 | 127 |
129 void ResizingHostObserver::SetScreenResolution( | 128 void ResizingHostObserver::SetScreenResolution( |
130 const ScreenResolution& resolution) { | 129 const ScreenResolution& resolution) { |
131 // Get the current time. This function is called exactly once for each call | 130 // Get the current time. This function is called exactly once for each call |
132 // to SetScreenResolution to simplify the implementation of unit-tests. | 131 // to SetScreenResolution to simplify the implementation of unit-tests. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // Update the time of last resize to allow it to be rate-limited. | 176 // Update the time of last resize to allow it to be rate-limited. |
178 previous_resize_time_ = now; | 177 previous_resize_time_ = now; |
179 } | 178 } |
180 | 179 |
181 void ResizingHostObserver::SetNowFunctionForTesting( | 180 void ResizingHostObserver::SetNowFunctionForTesting( |
182 const base::Callback<base::Time(void)>& now_function) { | 181 const base::Callback<base::Time(void)>& now_function) { |
183 now_function_ = now_function; | 182 now_function_ = now_function; |
184 } | 183 } |
185 | 184 |
186 } // namespace remoting | 185 } // namespace remoting |
OLD | NEW |