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 #ifndef REMOTING_HOST_RESIZING_HOST_OBSERVER_H_ | 5 #ifndef REMOTING_HOST_RESIZING_HOST_OBSERVER_H_ |
6 #define REMOTING_HOST_RESIZING_HOST_OBSERVER_H_ | 6 #define REMOTING_HOST_RESIZING_HOST_OBSERVER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | |
12 #include "base/time.h" | |
13 #include "base/timer.h" | |
11 #include "remoting/host/screen_controls.h" | 14 #include "remoting/host/screen_controls.h" |
15 #include "remoting/host/screen_resolution.h" | |
12 #include "third_party/skia/include/core/SkSize.h" | 16 #include "third_party/skia/include/core/SkSize.h" |
13 | 17 |
14 namespace remoting { | 18 namespace remoting { |
15 | 19 |
16 class DesktopResizer; | 20 class DesktopResizer; |
17 class ScreenResolution; | |
18 | 21 |
19 // TODO(alexeypa): Rename this class to reflect that it is not | 22 // TODO(alexeypa): Rename this class to reflect that it is not |
20 // HostStatusObserver any more. | 23 // HostStatusObserver any more. |
21 | 24 |
22 // Uses the specified DesktopResizer to match host desktop size to the client | 25 // Uses the specified DesktopResizer to match host desktop size to the client |
23 // view size as closely as is possible. When the connection closes, restores | 26 // view size as closely as is possible. When the connection closes, restores |
24 // the original desktop size. | 27 // the original desktop size. |
25 class ResizingHostObserver : public ScreenControls { | 28 class ResizingHostObserver : public ScreenControls { |
26 public: | 29 public: |
27 explicit ResizingHostObserver(scoped_ptr<DesktopResizer> desktop_resizer); | 30 explicit ResizingHostObserver(scoped_ptr<DesktopResizer> desktop_resizer); |
28 virtual ~ResizingHostObserver(); | 31 virtual ~ResizingHostObserver(); |
29 | 32 |
30 // ScreenControls interface. | 33 // ScreenControls interface. |
31 virtual void SetScreenResolution(const ScreenResolution& resolution) OVERRIDE; | 34 virtual void SetScreenResolution(const ScreenResolution& resolution) OVERRIDE; |
32 | 35 |
33 private: | 36 private: |
37 void SetPendingScreenResolution(); | |
alexeypa (please no reviews)
2013/06/04 17:07:37
Remove this line.
Jamie
2013/06/04 21:18:03
Done.
| |
38 | |
34 scoped_ptr<DesktopResizer> desktop_resizer_; | 39 scoped_ptr<DesktopResizer> desktop_resizer_; |
35 SkISize original_size_; | 40 SkISize original_size_; |
36 | 41 |
42 // State to manage rate-limiting of desktop resizes. | |
43 base::Time previous_resize_time_; | |
44 base::OneShotTimer<ResizingHostObserver> deferred_resize_timer_; | |
alexeypa (please no reviews)
2013/06/04 17:07:37
nit: move |deferred_resize_timer_| in front of |pr
Jamie
2013/06/04 21:18:03
Done.
| |
45 | |
46 base::WeakPtrFactory<ResizingHostObserver> weak_factory_; | |
47 | |
37 DISALLOW_COPY_AND_ASSIGN(ResizingHostObserver); | 48 DISALLOW_COPY_AND_ASSIGN(ResizingHostObserver); |
38 }; | 49 }; |
39 | 50 |
40 } // namespace remoting | 51 } // namespace remoting |
41 | 52 |
42 #endif // REMOTING_HOST_RESIZING_HOST_OBSERVER_H_ | 53 #endif // REMOTING_HOST_RESIZING_HOST_OBSERVER_H_ |
OLD | NEW |