Explicitly add python-numpy dependency to install-build-deps.
[chromium-blink-merge.git] / remoting / host / basic_desktop_environment.cc
blob174248a2900ffcac7c1a4e57cf7fa88772b06a19
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
3 // found in the LICENSE file.
5 #include "remoting/host/basic_desktop_environment.h"
7 #include "base/bind.h"
8 #include "base/logging.h"
9 #include "base/single_thread_task_runner.h"
10 #include "remoting/host/audio_capturer.h"
11 #if defined(OS_CHROMEOS)
12 #include "remoting/host/chromeos/aura_desktop_capturer.h"
13 #endif
14 #if defined(OS_CHROMEOS) && defined(USE_OZONE)
15 #include "remoting/host/chromeos/mouse_cursor_monitor_aura.h"
16 #endif
17 #include "remoting/host/client_session_control.h"
18 #include "remoting/host/gnubby_auth_handler.h"
19 #include "remoting/host/input_injector.h"
20 #include "remoting/host/screen_controls.h"
21 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h"
22 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
23 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h"
25 namespace remoting {
27 BasicDesktopEnvironment::~BasicDesktopEnvironment() {
28 DCHECK(caller_task_runner_->BelongsToCurrentThread());
31 scoped_ptr<AudioCapturer> BasicDesktopEnvironment::CreateAudioCapturer() {
32 DCHECK(caller_task_runner_->BelongsToCurrentThread());
34 return AudioCapturer::Create();
37 scoped_ptr<InputInjector> BasicDesktopEnvironment::CreateInputInjector() {
38 DCHECK(caller_task_runner_->BelongsToCurrentThread());
40 return InputInjector::Create(input_task_runner(), ui_task_runner());
43 scoped_ptr<ScreenControls> BasicDesktopEnvironment::CreateScreenControls() {
44 DCHECK(caller_task_runner_->BelongsToCurrentThread());
46 return nullptr;
49 scoped_ptr<webrtc::MouseCursorMonitor>
50 BasicDesktopEnvironment::CreateMouseCursorMonitor() {
51 #if defined(OS_CHROMEOS) && defined(USE_OZONE)
52 return make_scoped_ptr(
53 new MouseCursorMonitorAura(*desktop_capture_options_));
54 #else
55 return make_scoped_ptr(webrtc::MouseCursorMonitor::CreateForScreen(
56 *desktop_capture_options_, webrtc::kFullDesktopScreenId));
57 #endif
60 std::string BasicDesktopEnvironment::GetCapabilities() const {
61 return std::string();
64 void BasicDesktopEnvironment::SetCapabilities(const std::string& capabilities) {
67 scoped_ptr<GnubbyAuthHandler> BasicDesktopEnvironment::CreateGnubbyAuthHandler(
68 protocol::ClientStub* client_stub) {
69 return nullptr;
72 scoped_ptr<webrtc::DesktopCapturer>
73 BasicDesktopEnvironment::CreateVideoCapturer() {
74 DCHECK(caller_task_runner_->BelongsToCurrentThread());
76 #if defined(OS_CHROMEOS)
77 return scoped_ptr<webrtc::DesktopCapturer>(new AuraDesktopCapturer());
78 #else // !defined(OS_CHROMEOS)
79 // The basic desktop environment does not use X DAMAGE, since it is
80 // broken on many systems - see http://crbug.com/73423.
81 return make_scoped_ptr(
82 webrtc::ScreenCapturer::Create(*desktop_capture_options_));
83 #endif // !defined(OS_CHROMEOS)
86 BasicDesktopEnvironment::BasicDesktopEnvironment(
87 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
88 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
89 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner)
90 : caller_task_runner_(caller_task_runner),
91 input_task_runner_(input_task_runner),
92 ui_task_runner_(ui_task_runner),
93 desktop_capture_options_(
94 new webrtc::DesktopCaptureOptions(
95 webrtc::DesktopCaptureOptions::CreateDefault())) {
96 DCHECK(caller_task_runner_->BelongsToCurrentThread());
99 BasicDesktopEnvironmentFactory::BasicDesktopEnvironmentFactory(
100 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
101 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
102 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner)
103 : caller_task_runner_(caller_task_runner),
104 input_task_runner_(input_task_runner),
105 ui_task_runner_(ui_task_runner) {
108 BasicDesktopEnvironmentFactory::~BasicDesktopEnvironmentFactory() {
111 bool BasicDesktopEnvironmentFactory::SupportsAudioCapture() const {
112 DCHECK(caller_task_runner_->BelongsToCurrentThread());
114 return AudioCapturer::IsSupported();
117 } // namespace remoting