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 #ifndef REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_
6 #define REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "remoting/host/desktop_environment.h"
18 class GnubbyAuthHandler
;
20 // Used to create audio/video capturers and event executor that work with
22 class BasicDesktopEnvironment
: public DesktopEnvironment
{
24 virtual ~BasicDesktopEnvironment();
26 // DesktopEnvironment implementation.
27 virtual scoped_ptr
<AudioCapturer
> CreateAudioCapturer() OVERRIDE
;
28 virtual scoped_ptr
<InputInjector
> CreateInputInjector() OVERRIDE
;
29 virtual scoped_ptr
<ScreenControls
> CreateScreenControls() OVERRIDE
;
30 virtual scoped_ptr
<webrtc::ScreenCapturer
> CreateVideoCapturer() OVERRIDE
;
31 virtual std::string
GetCapabilities() const OVERRIDE
;
32 virtual void SetCapabilities(const std::string
& capabilities
) OVERRIDE
;
33 virtual scoped_ptr
<GnubbyAuthHandler
> CreateGnubbyAuthHandler(
34 protocol::ClientStub
* client_stub
) OVERRIDE
;
37 friend class BasicDesktopEnvironmentFactory
;
39 BasicDesktopEnvironment(
40 scoped_refptr
<base::SingleThreadTaskRunner
> caller_task_runner
,
41 scoped_refptr
<base::SingleThreadTaskRunner
> input_task_runner
,
42 scoped_refptr
<base::SingleThreadTaskRunner
> ui_task_runner
);
44 scoped_refptr
<base::SingleThreadTaskRunner
> caller_task_runner() const {
45 return caller_task_runner_
;
48 scoped_refptr
<base::SingleThreadTaskRunner
> input_task_runner() const {
49 return input_task_runner_
;
52 scoped_refptr
<base::SingleThreadTaskRunner
> ui_task_runner() const {
53 return ui_task_runner_
;
57 // Task runner on which methods of DesktopEnvironment interface should be
59 scoped_refptr
<base::SingleThreadTaskRunner
> caller_task_runner_
;
61 // Used to run input-related tasks.
62 scoped_refptr
<base::SingleThreadTaskRunner
> input_task_runner_
;
64 // Used to run UI code.
65 scoped_refptr
<base::SingleThreadTaskRunner
> ui_task_runner_
;
67 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironment
);
70 // Used to create |BasicDesktopEnvironment| instances.
71 class BasicDesktopEnvironmentFactory
: public DesktopEnvironmentFactory
{
73 BasicDesktopEnvironmentFactory(
74 scoped_refptr
<base::SingleThreadTaskRunner
> caller_task_runner
,
75 scoped_refptr
<base::SingleThreadTaskRunner
> input_task_runner
,
76 scoped_refptr
<base::SingleThreadTaskRunner
> ui_task_runner
);
77 virtual ~BasicDesktopEnvironmentFactory();
79 // DesktopEnvironmentFactory implementation.
80 virtual bool SupportsAudioCapture() const OVERRIDE
;
83 scoped_refptr
<base::SingleThreadTaskRunner
> caller_task_runner() const {
84 return caller_task_runner_
;
87 scoped_refptr
<base::SingleThreadTaskRunner
> input_task_runner() const {
88 return input_task_runner_
;
91 scoped_refptr
<base::SingleThreadTaskRunner
> ui_task_runner() const {
92 return ui_task_runner_
;
96 // Task runner on which methods of DesktopEnvironmentFactory interface should
98 scoped_refptr
<base::SingleThreadTaskRunner
> caller_task_runner_
;
100 // Used to run input-related tasks.
101 scoped_refptr
<base::SingleThreadTaskRunner
> input_task_runner_
;
103 // Used to run UI code.
104 scoped_refptr
<base::SingleThreadTaskRunner
> ui_task_runner_
;
106 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironmentFactory
);
109 } // namespace remoting
111 #endif // REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_