Revert of Remove OneClickSigninHelper since it is no longer used. (patchset #5 id...
[chromium-blink-merge.git] / remoting / host / basic_desktop_environment.cc
blobe7132f655782431684c9dd69086d5ef2ccd6a42a
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 #include "remoting/host/chromeos/mouse_cursor_monitor_aura.h"
14 #endif
15 #include "remoting/host/client_session_control.h"
16 #include "remoting/host/gnubby_auth_handler.h"
17 #include "remoting/host/input_injector.h"
18 #include "remoting/host/screen_controls.h"
19 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h"
20 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
21 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h"
23 namespace remoting {
25 BasicDesktopEnvironment::~BasicDesktopEnvironment() {
26 DCHECK(caller_task_runner_->BelongsToCurrentThread());
29 scoped_ptr<AudioCapturer> BasicDesktopEnvironment::CreateAudioCapturer() {
30 DCHECK(caller_task_runner_->BelongsToCurrentThread());
32 return AudioCapturer::Create();
35 scoped_ptr<InputInjector> BasicDesktopEnvironment::CreateInputInjector() {
36 DCHECK(caller_task_runner_->BelongsToCurrentThread());
38 return InputInjector::Create(input_task_runner(), ui_task_runner());
41 scoped_ptr<ScreenControls> BasicDesktopEnvironment::CreateScreenControls() {
42 DCHECK(caller_task_runner_->BelongsToCurrentThread());
44 return nullptr;
47 scoped_ptr<webrtc::MouseCursorMonitor>
48 BasicDesktopEnvironment::CreateMouseCursorMonitor() {
49 #if defined(OS_CHROMEOS)
50 return make_scoped_ptr(new MouseCursorMonitorAura());
51 #else
52 return make_scoped_ptr(webrtc::MouseCursorMonitor::CreateForScreen(
53 *desktop_capture_options_, webrtc::kFullDesktopScreenId));
54 #endif
57 std::string BasicDesktopEnvironment::GetCapabilities() const {
58 return std::string();
61 void BasicDesktopEnvironment::SetCapabilities(const std::string& capabilities) {
64 scoped_ptr<GnubbyAuthHandler> BasicDesktopEnvironment::CreateGnubbyAuthHandler(
65 protocol::ClientStub* client_stub) {
66 return nullptr;
69 scoped_ptr<webrtc::DesktopCapturer>
70 BasicDesktopEnvironment::CreateVideoCapturer() {
71 DCHECK(caller_task_runner_->BelongsToCurrentThread());
73 #if defined(OS_CHROMEOS)
74 return scoped_ptr<webrtc::DesktopCapturer>(new AuraDesktopCapturer());
75 #else // !defined(OS_CHROMEOS)
76 // The basic desktop environment does not use X DAMAGE, since it is
77 // broken on many systems - see http://crbug.com/73423.
78 return make_scoped_ptr(
79 webrtc::ScreenCapturer::Create(*desktop_capture_options_));
80 #endif // !defined(OS_CHROMEOS)
83 BasicDesktopEnvironment::BasicDesktopEnvironment(
84 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
85 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
86 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner)
87 : caller_task_runner_(caller_task_runner),
88 input_task_runner_(input_task_runner),
89 ui_task_runner_(ui_task_runner),
90 desktop_capture_options_(
91 new webrtc::DesktopCaptureOptions(
92 webrtc::DesktopCaptureOptions::CreateDefault())) {
93 DCHECK(caller_task_runner_->BelongsToCurrentThread());
96 BasicDesktopEnvironmentFactory::BasicDesktopEnvironmentFactory(
97 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
98 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
99 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner)
100 : caller_task_runner_(caller_task_runner),
101 input_task_runner_(input_task_runner),
102 ui_task_runner_(ui_task_runner) {
105 BasicDesktopEnvironmentFactory::~BasicDesktopEnvironmentFactory() {
108 bool BasicDesktopEnvironmentFactory::SupportsAudioCapture() const {
109 DCHECK(caller_task_runner_->BelongsToCurrentThread());
111 return AudioCapturer::IsSupported();
114 } // namespace remoting