Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(447)

Side by Side Diff: remoting/host/resizing_host_observer.h

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/host/remoting_me2me_host.cc ('k') | remoting/host/resizing_host_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory>
11
10 #include "base/callback.h" 12 #include "base/callback.h"
11 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
12 #include "base/macros.h" 14 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "base/time/time.h" 16 #include "base/time/time.h"
16 #include "base/timer/timer.h" 17 #include "base/timer/timer.h"
17 #include "remoting/host/screen_controls.h" 18 #include "remoting/host/screen_controls.h"
18 #include "remoting/host/screen_resolution.h" 19 #include "remoting/host/screen_resolution.h"
19 20
20 namespace remoting { 21 namespace remoting {
21 22
22 class DesktopResizer; 23 class DesktopResizer;
23 24
24 // TODO(alexeypa): Rename this class to reflect that it is not 25 // TODO(alexeypa): Rename this class to reflect that it is not
25 // HostStatusObserver any more. 26 // HostStatusObserver any more.
26 27
27 // Uses the specified DesktopResizer to match host desktop size to the client 28 // Uses the specified DesktopResizer to match host desktop size to the client
28 // view size as closely as is possible. When the connection closes, restores 29 // view size as closely as is possible. When the connection closes, restores
29 // the original desktop size. 30 // the original desktop size.
30 class ResizingHostObserver : public ScreenControls { 31 class ResizingHostObserver : public ScreenControls {
31 public: 32 public:
32 explicit ResizingHostObserver(scoped_ptr<DesktopResizer> desktop_resizer); 33 explicit ResizingHostObserver(
34 std::unique_ptr<DesktopResizer> desktop_resizer);
33 ~ResizingHostObserver() override; 35 ~ResizingHostObserver() override;
34 36
35 // ScreenControls interface. 37 // ScreenControls interface.
36 void SetScreenResolution(const ScreenResolution& resolution) override; 38 void SetScreenResolution(const ScreenResolution& resolution) override;
37 39
38 // Provide a replacement for base::Time::Now so that this class can be 40 // Provide a replacement for base::Time::Now so that this class can be
39 // unit-tested in a timely manner. This function will be called exactly 41 // unit-tested in a timely manner. This function will be called exactly
40 // once for each call to SetScreenResolution. 42 // once for each call to SetScreenResolution.
41 void SetNowFunctionForTesting( 43 void SetNowFunctionForTesting(
42 const base::Callback<base::Time(void)>& now_function); 44 const base::Callback<base::Time(void)>& now_function);
43 45
44 private: 46 private:
45 scoped_ptr<DesktopResizer> desktop_resizer_; 47 std::unique_ptr<DesktopResizer> desktop_resizer_;
46 ScreenResolution original_resolution_; 48 ScreenResolution original_resolution_;
47 49
48 // State to manage rate-limiting of desktop resizes. 50 // State to manage rate-limiting of desktop resizes.
49 base::OneShotTimer deferred_resize_timer_; 51 base::OneShotTimer deferred_resize_timer_;
50 base::Time previous_resize_time_; 52 base::Time previous_resize_time_;
51 base::Callback<base::Time(void)> now_function_; 53 base::Callback<base::Time(void)> now_function_;
52 54
53 base::WeakPtrFactory<ResizingHostObserver> weak_factory_; 55 base::WeakPtrFactory<ResizingHostObserver> weak_factory_;
54 56
55 DISALLOW_COPY_AND_ASSIGN(ResizingHostObserver); 57 DISALLOW_COPY_AND_ASSIGN(ResizingHostObserver);
56 }; 58 };
57 59
58 } // namespace remoting 60 } // namespace remoting
59 61
60 #endif // REMOTING_HOST_RESIZING_HOST_OBSERVER_H_ 62 #endif // REMOTING_HOST_RESIZING_HOST_OBSERVER_H_
OLDNEW
« no previous file with comments | « remoting/host/remoting_me2me_host.cc ('k') | remoting/host/resizing_host_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698