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