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"
8 #include "base/logging.h"
9 #include "base/single_thread_task_runner.h"
10 #include "remoting/host/audio_capturer.h"
11 #include "remoting/host/client_session_control.h"
12 #include "remoting/host/input_injector.h"
13 #include "remoting/host/screen_controls.h"
14 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h"
18 BasicDesktopEnvironment::~BasicDesktopEnvironment() {
19 DCHECK(caller_task_runner_
->BelongsToCurrentThread());
22 scoped_ptr
<AudioCapturer
> BasicDesktopEnvironment::CreateAudioCapturer() {
23 DCHECK(caller_task_runner_
->BelongsToCurrentThread());
25 return AudioCapturer::Create();
28 scoped_ptr
<InputInjector
> BasicDesktopEnvironment::CreateInputInjector() {
29 DCHECK(caller_task_runner_
->BelongsToCurrentThread());
31 return InputInjector::Create(input_task_runner(), ui_task_runner());
34 scoped_ptr
<ScreenControls
> BasicDesktopEnvironment::CreateScreenControls() {
35 DCHECK(caller_task_runner_
->BelongsToCurrentThread());
37 return scoped_ptr
<ScreenControls
>();
40 std::string
BasicDesktopEnvironment::GetCapabilities() const {
44 void BasicDesktopEnvironment::SetCapabilities(const std::string
& capabilities
) {
47 scoped_ptr
<webrtc::ScreenCapturer
>
48 BasicDesktopEnvironment::CreateVideoCapturer() {
49 DCHECK(caller_task_runner_
->BelongsToCurrentThread());
51 // The basic desktop environment does not use X DAMAGE, since it is
52 // broken on many systems - see http://crbug.com/73423.
53 return scoped_ptr
<webrtc::ScreenCapturer
>(webrtc::ScreenCapturer::Create());
56 BasicDesktopEnvironment::BasicDesktopEnvironment(
57 scoped_refptr
<base::SingleThreadTaskRunner
> caller_task_runner
,
58 scoped_refptr
<base::SingleThreadTaskRunner
> input_task_runner
,
59 scoped_refptr
<base::SingleThreadTaskRunner
> ui_task_runner
)
60 : caller_task_runner_(caller_task_runner
),
61 input_task_runner_(input_task_runner
),
62 ui_task_runner_(ui_task_runner
) {
63 DCHECK(caller_task_runner_
->BelongsToCurrentThread());
66 BasicDesktopEnvironmentFactory::BasicDesktopEnvironmentFactory(
67 scoped_refptr
<base::SingleThreadTaskRunner
> caller_task_runner
,
68 scoped_refptr
<base::SingleThreadTaskRunner
> input_task_runner
,
69 scoped_refptr
<base::SingleThreadTaskRunner
> ui_task_runner
)
70 : caller_task_runner_(caller_task_runner
),
71 input_task_runner_(input_task_runner
),
72 ui_task_runner_(ui_task_runner
) {
75 BasicDesktopEnvironmentFactory::~BasicDesktopEnvironmentFactory() {
78 bool BasicDesktopEnvironmentFactory::SupportsAudioCapture() const {
79 DCHECK(caller_task_runner_
->BelongsToCurrentThread());
81 return AudioCapturer::IsSupported();
84 } // namespace remoting