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/basic_desktop_environment.h" | 5 #include "remoting/host/basic_desktop_environment.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/ptr_util.h" |
9 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
11 #include "remoting/host/audio_capturer.h" | 12 #include "remoting/host/audio_capturer.h" |
12 #include "remoting/host/client_session_control.h" | 13 #include "remoting/host/client_session_control.h" |
13 #include "remoting/host/desktop_capturer_proxy.h" | 14 #include "remoting/host/desktop_capturer_proxy.h" |
14 #include "remoting/host/input_injector.h" | 15 #include "remoting/host/input_injector.h" |
15 #include "remoting/host/mouse_cursor_monitor_proxy.h" | 16 #include "remoting/host/mouse_cursor_monitor_proxy.h" |
16 #include "remoting/host/screen_controls.h" | 17 #include "remoting/host/screen_controls.h" |
17 #include "remoting/protocol/capability_names.h" | 18 #include "remoting/protocol/capability_names.h" |
18 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" | 19 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" |
19 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h" | 20 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h" |
20 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" | 21 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" |
21 | 22 |
22 #if defined(OS_CHROMEOS) | 23 #if defined(OS_CHROMEOS) |
23 #include "remoting/host/chromeos/aura_desktop_capturer.h" | 24 #include "remoting/host/chromeos/aura_desktop_capturer.h" |
24 #include "remoting/host/chromeos/mouse_cursor_monitor_aura.h" | 25 #include "remoting/host/chromeos/mouse_cursor_monitor_aura.h" |
25 #endif | 26 #endif |
26 #if defined(USE_X11) | 27 #if defined(USE_X11) |
27 #include "remoting/host/linux/x11_util.h" | 28 #include "remoting/host/linux/x11_util.h" |
28 #endif | 29 #endif |
29 | 30 |
30 namespace remoting { | 31 namespace remoting { |
31 | 32 |
32 BasicDesktopEnvironment::~BasicDesktopEnvironment() { | 33 BasicDesktopEnvironment::~BasicDesktopEnvironment() { |
33 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 34 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
34 } | 35 } |
35 | 36 |
36 scoped_ptr<AudioCapturer> BasicDesktopEnvironment::CreateAudioCapturer() { | 37 std::unique_ptr<AudioCapturer> BasicDesktopEnvironment::CreateAudioCapturer() { |
37 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 38 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
38 | 39 |
39 return AudioCapturer::Create(); | 40 return AudioCapturer::Create(); |
40 } | 41 } |
41 | 42 |
42 scoped_ptr<InputInjector> BasicDesktopEnvironment::CreateInputInjector() { | 43 std::unique_ptr<InputInjector> BasicDesktopEnvironment::CreateInputInjector() { |
43 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 44 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
44 | 45 |
45 return InputInjector::Create(input_task_runner(), ui_task_runner()); | 46 return InputInjector::Create(input_task_runner(), ui_task_runner()); |
46 } | 47 } |
47 | 48 |
48 scoped_ptr<ScreenControls> BasicDesktopEnvironment::CreateScreenControls() { | 49 std::unique_ptr<ScreenControls> |
| 50 BasicDesktopEnvironment::CreateScreenControls() { |
49 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 51 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
50 | 52 |
51 return nullptr; | 53 return nullptr; |
52 } | 54 } |
53 | 55 |
54 scoped_ptr<webrtc::MouseCursorMonitor> | 56 std::unique_ptr<webrtc::MouseCursorMonitor> |
55 BasicDesktopEnvironment::CreateMouseCursorMonitor() { | 57 BasicDesktopEnvironment::CreateMouseCursorMonitor() { |
56 scoped_ptr<webrtc::MouseCursorMonitor> cursor_monitor; | 58 std::unique_ptr<webrtc::MouseCursorMonitor> cursor_monitor; |
57 | 59 |
58 #if defined(OS_CHROMEOS) | 60 #if defined(OS_CHROMEOS) |
59 cursor_monitor.reset(new MouseCursorMonitorAura()); | 61 cursor_monitor.reset(new MouseCursorMonitorAura()); |
60 #else | 62 #else |
61 cursor_monitor.reset(webrtc::MouseCursorMonitor::CreateForScreen( | 63 cursor_monitor.reset(webrtc::MouseCursorMonitor::CreateForScreen( |
62 *desktop_capture_options_, webrtc::kFullDesktopScreenId)); | 64 *desktop_capture_options_, webrtc::kFullDesktopScreenId)); |
63 #endif | 65 #endif |
64 return make_scoped_ptr(new MouseCursorMonitorProxy( | 66 return base::WrapUnique(new MouseCursorMonitorProxy( |
65 video_capture_task_runner_, std::move(cursor_monitor))); | 67 video_capture_task_runner_, std::move(cursor_monitor))); |
66 } | 68 } |
67 | 69 |
68 std::string BasicDesktopEnvironment::GetCapabilities() const { | 70 std::string BasicDesktopEnvironment::GetCapabilities() const { |
69 if (supports_touch_events_) | 71 if (supports_touch_events_) |
70 return protocol::kTouchEventsCapability; | 72 return protocol::kTouchEventsCapability; |
71 | 73 |
72 return std::string(); | 74 return std::string(); |
73 } | 75 } |
74 | 76 |
75 void BasicDesktopEnvironment::SetCapabilities(const std::string& capabilities) { | 77 void BasicDesktopEnvironment::SetCapabilities(const std::string& capabilities) { |
76 } | 78 } |
77 | 79 |
78 scoped_ptr<webrtc::DesktopCapturer> | 80 std::unique_ptr<webrtc::DesktopCapturer> |
79 BasicDesktopEnvironment::CreateVideoCapturer() { | 81 BasicDesktopEnvironment::CreateVideoCapturer() { |
80 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 82 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
81 | 83 |
82 scoped_ptr<webrtc::DesktopCapturer> capturer; | 84 std::unique_ptr<webrtc::DesktopCapturer> capturer; |
83 | 85 |
84 #if defined(OS_CHROMEOS) | 86 #if defined(OS_CHROMEOS) |
85 capturer.reset(new AuraDesktopCapturer()); | 87 capturer.reset(new AuraDesktopCapturer()); |
86 #else // !defined(OS_CHROMEOS) | 88 #else // !defined(OS_CHROMEOS) |
87 capturer.reset(webrtc::ScreenCapturer::Create(*desktop_capture_options_)); | 89 capturer.reset(webrtc::ScreenCapturer::Create(*desktop_capture_options_)); |
88 #endif // !defined(OS_CHROMEOS) | 90 #endif // !defined(OS_CHROMEOS) |
89 | 91 |
90 return make_scoped_ptr(new DesktopCapturerProxy(video_capture_task_runner_, | 92 return base::WrapUnique(new DesktopCapturerProxy(video_capture_task_runner_, |
91 std::move(capturer))); | 93 std::move(capturer))); |
92 } | 94 } |
93 | 95 |
94 BasicDesktopEnvironment::BasicDesktopEnvironment( | 96 BasicDesktopEnvironment::BasicDesktopEnvironment( |
95 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 97 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
96 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, | 98 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, |
97 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 99 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
98 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 100 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
99 bool supports_touch_events) | 101 bool supports_touch_events) |
100 : caller_task_runner_(caller_task_runner), | 102 : caller_task_runner_(caller_task_runner), |
101 video_capture_task_runner_(video_capture_task_runner), | 103 video_capture_task_runner_(video_capture_task_runner), |
(...skipping 21 matching lines...) Expand all Loading... |
123 | 125 |
124 BasicDesktopEnvironmentFactory::~BasicDesktopEnvironmentFactory() {} | 126 BasicDesktopEnvironmentFactory::~BasicDesktopEnvironmentFactory() {} |
125 | 127 |
126 bool BasicDesktopEnvironmentFactory::SupportsAudioCapture() const { | 128 bool BasicDesktopEnvironmentFactory::SupportsAudioCapture() const { |
127 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 129 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
128 | 130 |
129 return AudioCapturer::IsSupported(); | 131 return AudioCapturer::IsSupported(); |
130 } | 132 } |
131 | 133 |
132 } // namespace remoting | 134 } // namespace remoting |
OLD | NEW |