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/gnubby_auth_handler.h"
13 #include "remoting/host/input_injector.h"
14 #include "remoting/host/screen_controls.h"
15 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h"
19 BasicDesktopEnvironment::~BasicDesktopEnvironment() {
20 DCHECK(caller_task_runner_
->BelongsToCurrentThread());
23 scoped_ptr
<AudioCapturer
> BasicDesktopEnvironment::CreateAudioCapturer() {
24 DCHECK(caller_task_runner_
->BelongsToCurrentThread());
26 return AudioCapturer::Create();
29 scoped_ptr
<InputInjector
> BasicDesktopEnvironment::CreateInputInjector() {
30 DCHECK(caller_task_runner_
->BelongsToCurrentThread());
32 return InputInjector::Create(input_task_runner(), ui_task_runner());
35 scoped_ptr
<ScreenControls
> BasicDesktopEnvironment::CreateScreenControls() {
36 DCHECK(caller_task_runner_
->BelongsToCurrentThread());
38 return scoped_ptr
<ScreenControls
>();
41 std::string
BasicDesktopEnvironment::GetCapabilities() const {
45 void BasicDesktopEnvironment::SetCapabilities(const std::string
& capabilities
) {
48 scoped_ptr
<GnubbyAuthHandler
> BasicDesktopEnvironment::CreateGnubbyAuthHandler(
49 protocol::ClientStub
* client_stub
) {
50 return scoped_ptr
<GnubbyAuthHandler
>();
53 scoped_ptr
<webrtc::ScreenCapturer
>
54 BasicDesktopEnvironment::CreateVideoCapturer() {
55 DCHECK(caller_task_runner_
->BelongsToCurrentThread());
57 // The basic desktop environment does not use X DAMAGE, since it is
58 // broken on many systems - see http://crbug.com/73423.
59 return scoped_ptr
<webrtc::ScreenCapturer
>(webrtc::ScreenCapturer::Create());
62 BasicDesktopEnvironment::BasicDesktopEnvironment(
63 scoped_refptr
<base::SingleThreadTaskRunner
> caller_task_runner
,
64 scoped_refptr
<base::SingleThreadTaskRunner
> input_task_runner
,
65 scoped_refptr
<base::SingleThreadTaskRunner
> ui_task_runner
)
66 : caller_task_runner_(caller_task_runner
),
67 input_task_runner_(input_task_runner
),
68 ui_task_runner_(ui_task_runner
) {
69 DCHECK(caller_task_runner_
->BelongsToCurrentThread());
72 BasicDesktopEnvironmentFactory::BasicDesktopEnvironmentFactory(
73 scoped_refptr
<base::SingleThreadTaskRunner
> caller_task_runner
,
74 scoped_refptr
<base::SingleThreadTaskRunner
> input_task_runner
,
75 scoped_refptr
<base::SingleThreadTaskRunner
> ui_task_runner
)
76 : caller_task_runner_(caller_task_runner
),
77 input_task_runner_(input_task_runner
),
78 ui_task_runner_(ui_task_runner
) {
81 BasicDesktopEnvironmentFactory::~BasicDesktopEnvironmentFactory() {
84 bool BasicDesktopEnvironmentFactory::SupportsAudioCapture() const {
85 DCHECK(caller_task_runner_
->BelongsToCurrentThread());
87 return AudioCapturer::IsSupported();
90 } // namespace remoting