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

Side by Side Diff: remoting/host/single_window_desktop_environment.cc

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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/single_window_desktop_environment.h" 5 #include "remoting/host/single_window_desktop_environment.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ptr_util.h"
11 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
12 #include "remoting/host/single_window_input_injector.h" 13 #include "remoting/host/single_window_input_injector.h"
13 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" 14 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h"
14 #include "third_party/webrtc/modules/desktop_capture/window_capturer.h" 15 #include "third_party/webrtc/modules/desktop_capture/window_capturer.h"
15 16
16 namespace remoting { 17 namespace remoting {
17 18
18 // Enables capturing and streaming of windows. 19 // Enables capturing and streaming of windows.
19 class SingleWindowDesktopEnvironment : public BasicDesktopEnvironment { 20 class SingleWindowDesktopEnvironment : public BasicDesktopEnvironment {
20 21
21 public: 22 public:
22 ~SingleWindowDesktopEnvironment() override; 23 ~SingleWindowDesktopEnvironment() override;
23 24
24 // DesktopEnvironment interface. 25 // DesktopEnvironment interface.
25 scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override; 26 std::unique_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override;
26 scoped_ptr<InputInjector> CreateInputInjector() override; 27 std::unique_ptr<InputInjector> CreateInputInjector() override;
27 28
28 protected: 29 protected:
29 friend class SingleWindowDesktopEnvironmentFactory; 30 friend class SingleWindowDesktopEnvironmentFactory;
30 SingleWindowDesktopEnvironment( 31 SingleWindowDesktopEnvironment(
31 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 32 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
32 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, 33 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner,
33 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, 34 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
34 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 35 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
35 webrtc::WindowId window_id, 36 webrtc::WindowId window_id,
36 bool supports_touch_events); 37 bool supports_touch_events);
37 38
38 private: 39 private:
39 webrtc::WindowId window_id_; 40 webrtc::WindowId window_id_;
40 41
41 DISALLOW_COPY_AND_ASSIGN(SingleWindowDesktopEnvironment); 42 DISALLOW_COPY_AND_ASSIGN(SingleWindowDesktopEnvironment);
42 }; 43 };
43 44
44 SingleWindowDesktopEnvironment::~SingleWindowDesktopEnvironment() {} 45 SingleWindowDesktopEnvironment::~SingleWindowDesktopEnvironment() {}
45 46
46 scoped_ptr<webrtc::DesktopCapturer> 47 std::unique_ptr<webrtc::DesktopCapturer>
47 SingleWindowDesktopEnvironment::CreateVideoCapturer() { 48 SingleWindowDesktopEnvironment::CreateVideoCapturer() {
48 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 49 DCHECK(caller_task_runner()->BelongsToCurrentThread());
49 50
50 webrtc::DesktopCaptureOptions options = 51 webrtc::DesktopCaptureOptions options =
51 webrtc::DesktopCaptureOptions::CreateDefault(); 52 webrtc::DesktopCaptureOptions::CreateDefault();
52 options.set_use_update_notifications(true); 53 options.set_use_update_notifications(true);
53 54
54 scoped_ptr<webrtc::WindowCapturer> window_capturer( 55 std::unique_ptr<webrtc::WindowCapturer> window_capturer(
55 webrtc::WindowCapturer::Create(options)); 56 webrtc::WindowCapturer::Create(options));
56 window_capturer->SelectWindow(window_id_); 57 window_capturer->SelectWindow(window_id_);
57 58
58 return std::move(window_capturer); 59 return std::move(window_capturer);
59 } 60 }
60 61
61 scoped_ptr<InputInjector> 62 std::unique_ptr<InputInjector>
62 SingleWindowDesktopEnvironment::CreateInputInjector() { 63 SingleWindowDesktopEnvironment::CreateInputInjector() {
63 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 64 DCHECK(caller_task_runner()->BelongsToCurrentThread());
64 65
65 scoped_ptr<InputInjector> input_injector( 66 std::unique_ptr<InputInjector> input_injector(
66 InputInjector::Create(input_task_runner(), 67 InputInjector::Create(input_task_runner(), ui_task_runner()));
67 ui_task_runner()));
68 return SingleWindowInputInjector::CreateForWindow( 68 return SingleWindowInputInjector::CreateForWindow(
69 window_id_, std::move(input_injector)); 69 window_id_, std::move(input_injector));
70 } 70 }
71 71
72 SingleWindowDesktopEnvironment::SingleWindowDesktopEnvironment( 72 SingleWindowDesktopEnvironment::SingleWindowDesktopEnvironment(
73 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 73 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
74 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, 74 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner,
75 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, 75 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
76 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 76 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
77 webrtc::WindowId window_id, 77 webrtc::WindowId window_id,
(...skipping 14 matching lines...) Expand all
92 : BasicDesktopEnvironmentFactory(caller_task_runner, 92 : BasicDesktopEnvironmentFactory(caller_task_runner,
93 video_capture_task_runner, 93 video_capture_task_runner,
94 input_task_runner, 94 input_task_runner,
95 ui_task_runner), 95 ui_task_runner),
96 window_id_(window_id) {} 96 window_id_(window_id) {}
97 97
98 SingleWindowDesktopEnvironmentFactory:: 98 SingleWindowDesktopEnvironmentFactory::
99 ~SingleWindowDesktopEnvironmentFactory() { 99 ~SingleWindowDesktopEnvironmentFactory() {
100 } 100 }
101 101
102 scoped_ptr<DesktopEnvironment> SingleWindowDesktopEnvironmentFactory::Create( 102 std::unique_ptr<DesktopEnvironment>
103 SingleWindowDesktopEnvironmentFactory::Create(
103 base::WeakPtr<ClientSessionControl> client_session_control) { 104 base::WeakPtr<ClientSessionControl> client_session_control) {
104 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 105 DCHECK(caller_task_runner()->BelongsToCurrentThread());
105 106
106 return make_scoped_ptr(new SingleWindowDesktopEnvironment( 107 return base::WrapUnique(new SingleWindowDesktopEnvironment(
107 caller_task_runner(), video_capture_task_runner(), input_task_runner(), 108 caller_task_runner(), video_capture_task_runner(), input_task_runner(),
108 ui_task_runner(), window_id_, supports_touch_events())); 109 ui_task_runner(), window_id_, supports_touch_events()));
109 } 110 }
110 111
111 } // namespace remoting 112 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/single_window_desktop_environment.h ('k') | remoting/host/single_window_input_injector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698