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/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "remoting/host/audio_capturer.h" | 10 #include "remoting/host/audio_capturer.h" |
11 #include "remoting/host/client_session_control.h" | 11 #include "remoting/host/client_session_control.h" |
12 #include "remoting/host/input_injector.h" | 12 #include "remoting/host/input_injector.h" |
13 #include "remoting/host/screen_controls.h" | 13 #include "remoting/host/screen_controls.h" |
| 14 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h" |
14 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" | 15 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" |
15 | 16 |
16 namespace remoting { | 17 namespace remoting { |
17 | 18 |
18 BasicDesktopEnvironment::~BasicDesktopEnvironment() { | 19 BasicDesktopEnvironment::~BasicDesktopEnvironment() { |
19 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 20 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
20 } | 21 } |
21 | 22 |
22 scoped_ptr<AudioCapturer> BasicDesktopEnvironment::CreateAudioCapturer() { | 23 scoped_ptr<AudioCapturer> BasicDesktopEnvironment::CreateAudioCapturer() { |
23 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 24 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
24 | 25 |
25 return AudioCapturer::Create(); | 26 return AudioCapturer::Create(); |
26 } | 27 } |
27 | 28 |
28 scoped_ptr<InputInjector> BasicDesktopEnvironment::CreateInputInjector() { | 29 scoped_ptr<InputInjector> BasicDesktopEnvironment::CreateInputInjector() { |
29 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 30 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
30 | 31 |
31 return InputInjector::Create(input_task_runner(), ui_task_runner()); | 32 return InputInjector::Create(input_task_runner(), ui_task_runner()); |
32 } | 33 } |
33 | 34 |
34 scoped_ptr<ScreenControls> BasicDesktopEnvironment::CreateScreenControls() { | 35 scoped_ptr<ScreenControls> BasicDesktopEnvironment::CreateScreenControls() { |
35 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 36 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
36 | 37 |
37 return scoped_ptr<ScreenControls>(); | 38 return scoped_ptr<ScreenControls>(); |
38 } | 39 } |
39 | 40 |
| 41 scoped_ptr<webrtc::MouseCursorMonitor> |
| 42 BasicDesktopEnvironment::CreateMouseCursorMonitor() { |
| 43 return scoped_ptr<webrtc::MouseCursorMonitor>( |
| 44 webrtc::MouseCursorMonitor::CreateForScreen( |
| 45 desktop_capture_options_, |
| 46 webrtc::kFullDesktopScreenId)); |
| 47 } |
| 48 |
40 std::string BasicDesktopEnvironment::GetCapabilities() const { | 49 std::string BasicDesktopEnvironment::GetCapabilities() const { |
41 return std::string(); | 50 return std::string(); |
42 } | 51 } |
43 | 52 |
44 void BasicDesktopEnvironment::SetCapabilities(const std::string& capabilities) { | 53 void BasicDesktopEnvironment::SetCapabilities(const std::string& capabilities) { |
45 } | 54 } |
46 | 55 |
47 scoped_ptr<webrtc::ScreenCapturer> | 56 scoped_ptr<webrtc::ScreenCapturer> |
48 BasicDesktopEnvironment::CreateVideoCapturer() { | 57 BasicDesktopEnvironment::CreateVideoCapturer() { |
49 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 58 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
50 | 59 |
51 // The basic desktop environment does not use X DAMAGE, since it is | 60 // The basic desktop environment does not use X DAMAGE, since it is |
52 // broken on many systems - see http://crbug.com/73423. | 61 // broken on many systems - see http://crbug.com/73423. |
53 return scoped_ptr<webrtc::ScreenCapturer>(webrtc::ScreenCapturer::Create()); | 62 return scoped_ptr<webrtc::ScreenCapturer>( |
| 63 webrtc::ScreenCapturer::Create(desktop_capture_options_)); |
54 } | 64 } |
55 | 65 |
56 BasicDesktopEnvironment::BasicDesktopEnvironment( | 66 BasicDesktopEnvironment::BasicDesktopEnvironment( |
57 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 67 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
58 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 68 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
59 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) | 69 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) |
60 : caller_task_runner_(caller_task_runner), | 70 : caller_task_runner_(caller_task_runner), |
61 input_task_runner_(input_task_runner), | 71 input_task_runner_(input_task_runner), |
62 ui_task_runner_(ui_task_runner) { | 72 ui_task_runner_(ui_task_runner), |
| 73 desktop_capture_options_(webrtc::DesktopCaptureOptions::CreateDefault()) { |
63 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 74 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
64 } | 75 } |
65 | 76 |
66 BasicDesktopEnvironmentFactory::BasicDesktopEnvironmentFactory( | 77 BasicDesktopEnvironmentFactory::BasicDesktopEnvironmentFactory( |
67 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 78 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
68 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 79 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
69 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) | 80 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) |
70 : caller_task_runner_(caller_task_runner), | 81 : caller_task_runner_(caller_task_runner), |
71 input_task_runner_(input_task_runner), | 82 input_task_runner_(input_task_runner), |
72 ui_task_runner_(ui_task_runner) { | 83 ui_task_runner_(ui_task_runner) { |
73 } | 84 } |
74 | 85 |
75 BasicDesktopEnvironmentFactory::~BasicDesktopEnvironmentFactory() { | 86 BasicDesktopEnvironmentFactory::~BasicDesktopEnvironmentFactory() { |
76 } | 87 } |
77 | 88 |
78 bool BasicDesktopEnvironmentFactory::SupportsAudioCapture() const { | 89 bool BasicDesktopEnvironmentFactory::SupportsAudioCapture() const { |
79 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 90 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
80 | 91 |
81 return AudioCapturer::IsSupported(); | 92 return AudioCapturer::IsSupported(); |
82 } | 93 } |
83 | 94 |
84 } // namespace remoting | 95 } // namespace remoting |
OLD | NEW |