BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / remoting / host / basic_desktop_environment.cc
blob6d9cc3cb4e8ce4b150b447de74c2398c1dc0a020
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 "remoting/protocol/capability_names.h"
20 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h"
21 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
22 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h"
24 namespace remoting {
26 BasicDesktopEnvironment::~BasicDesktopEnvironment() {
27 DCHECK(caller_task_runner_->BelongsToCurrentThread());
30 scoped_ptr<AudioCapturer> BasicDesktopEnvironment::CreateAudioCapturer() {
31 DCHECK(caller_task_runner_->BelongsToCurrentThread());
33 return AudioCapturer::Create();
36 scoped_ptr<InputInjector> BasicDesktopEnvironment::CreateInputInjector() {
37 DCHECK(caller_task_runner_->BelongsToCurrentThread());
39 return InputInjector::Create(input_task_runner(), ui_task_runner());
42 scoped_ptr<ScreenControls> BasicDesktopEnvironment::CreateScreenControls() {
43 DCHECK(caller_task_runner_->BelongsToCurrentThread());
45 return nullptr;
48 scoped_ptr<webrtc::MouseCursorMonitor>
49 BasicDesktopEnvironment::CreateMouseCursorMonitor() {
50 #if defined(OS_CHROMEOS)
51 return make_scoped_ptr(new MouseCursorMonitorAura());
52 #else
53 return make_scoped_ptr(webrtc::MouseCursorMonitor::CreateForScreen(
54 *desktop_capture_options_, webrtc::kFullDesktopScreenId));
55 #endif
58 std::string BasicDesktopEnvironment::GetCapabilities() const {
59 if (supports_touch_events_)
60 return protocol::kTouchEventsCapability;
62 return std::string();
65 void BasicDesktopEnvironment::SetCapabilities(const std::string& capabilities) {
68 scoped_ptr<GnubbyAuthHandler> BasicDesktopEnvironment::CreateGnubbyAuthHandler(
69 protocol::ClientStub* client_stub) {
70 return nullptr;
73 scoped_ptr<webrtc::DesktopCapturer>
74 BasicDesktopEnvironment::CreateVideoCapturer() {
75 DCHECK(caller_task_runner_->BelongsToCurrentThread());
77 #if defined(OS_CHROMEOS)
78 return scoped_ptr<webrtc::DesktopCapturer>(new AuraDesktopCapturer());
79 #else // !defined(OS_CHROMEOS)
80 // The basic desktop environment does not use X DAMAGE, since it is
81 // broken on many systems - see http://crbug.com/73423.
82 return make_scoped_ptr(
83 webrtc::ScreenCapturer::Create(*desktop_capture_options_));
84 #endif // !defined(OS_CHROMEOS)
87 BasicDesktopEnvironment::BasicDesktopEnvironment(
88 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
89 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
90 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
91 bool supports_touch_events)
92 : caller_task_runner_(caller_task_runner),
93 input_task_runner_(input_task_runner),
94 ui_task_runner_(ui_task_runner),
95 desktop_capture_options_(
96 new webrtc::DesktopCaptureOptions(
97 webrtc::DesktopCaptureOptions::CreateDefault())),
98 supports_touch_events_(supports_touch_events) {
99 DCHECK(caller_task_runner_->BelongsToCurrentThread());
102 BasicDesktopEnvironmentFactory::BasicDesktopEnvironmentFactory(
103 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
104 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
105 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner)
106 : caller_task_runner_(caller_task_runner),
107 input_task_runner_(input_task_runner),
108 ui_task_runner_(ui_task_runner),
109 supports_touch_events_(false) {
112 BasicDesktopEnvironmentFactory::~BasicDesktopEnvironmentFactory() {
115 bool BasicDesktopEnvironmentFactory::SupportsAudioCapture() const {
116 DCHECK(caller_task_runner_->BelongsToCurrentThread());
118 return AudioCapturer::IsSupported();
121 } // namespace remoting