[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 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. |
| 4 | |
| 5 | #ifndef REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ |
| 6 | #define REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ |
| 7 | |
| 8 | #include "base/basictypes.h" |
| 9 | #include "base/compiler_specific.h" |
| 10 | #include "base/memory/ref_counted.h" |
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 11 | #include "remoting/host/desktop_environment.h" |
| 12 | |
| 13 | namespace remoting { |
| 14 | |
| 15 | // Used to create audio/video capturers and event executor that work with |
| 16 | // the local console. |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame^] | 17 | class BasicDesktopEnvironment : public DesktopEnvironment { |
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 18 | public: |
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 19 | virtual ~BasicDesktopEnvironment(); |
| 20 | |
| 21 | // DesktopEnvironment implementation. |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame^] | 22 | virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() OVERRIDE; |
| 23 | virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE; |
| 24 | virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE; |
| 25 | virtual scoped_ptr<media::ScreenCapturer> CreateVideoCapturer() OVERRIDE; |
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 26 | |
[email protected] | da457fc | 2013-03-14 16:32:12 | [diff] [blame] | 27 | protected: |
| 28 | friend class BasicDesktopEnvironmentFactory; |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame^] | 29 | BasicDesktopEnvironment( |
| 30 | scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 31 | scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 32 | scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 33 | base::WeakPtr<ClientSessionControl> client_session_control); |
| 34 | |
| 35 | scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const { |
| 36 | return caller_task_runner_; |
| 37 | } |
| 38 | |
| 39 | scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const { |
| 40 | return input_task_runner_; |
| 41 | } |
| 42 | |
| 43 | scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const { |
| 44 | return ui_task_runner_; |
| 45 | } |
[email protected] | 74b08f8c | 2013-01-30 09:48:59 | [diff] [blame] | 46 | |
[email protected] | da457fc | 2013-03-14 16:32:12 | [diff] [blame] | 47 | private: |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame^] | 48 | // Task runner on which methods of DesktopEnvironment interface should be |
| 49 | // called. |
| 50 | scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; |
| 51 | |
| 52 | // Used to run input-related tasks. |
| 53 | scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; |
| 54 | |
| 55 | // Used to run UI code. |
| 56 | scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| 57 | |
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 58 | DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironment); |
| 59 | }; |
| 60 | |
| 61 | // Used to create |BasicDesktopEnvironment| instances. |
| 62 | class BasicDesktopEnvironmentFactory : public DesktopEnvironmentFactory { |
| 63 | public: |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame^] | 64 | BasicDesktopEnvironmentFactory( |
| 65 | scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 66 | scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 67 | scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); |
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 68 | virtual ~BasicDesktopEnvironmentFactory(); |
| 69 | |
| 70 | // DesktopEnvironmentFactory implementation. |
| 71 | virtual scoped_ptr<DesktopEnvironment> Create( |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame^] | 72 | base::WeakPtr<ClientSessionControl> client_session_control) OVERRIDE; |
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 73 | virtual bool SupportsAudioCapture() const OVERRIDE; |
| 74 | |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame^] | 75 | protected: |
| 76 | scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const { |
| 77 | return caller_task_runner_; |
| 78 | } |
| 79 | |
| 80 | scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const { |
| 81 | return input_task_runner_; |
| 82 | } |
| 83 | |
| 84 | scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const { |
| 85 | return ui_task_runner_; |
| 86 | } |
| 87 | |
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 88 | private: |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame^] | 89 | // Task runner on which methods of DesktopEnvironmentFactory interface should |
| 90 | // be called. |
| 91 | scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; |
| 92 | |
| 93 | // Used to run input-related tasks. |
| 94 | scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; |
| 95 | |
| 96 | // Used to run UI code. |
| 97 | scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| 98 | |
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 99 | DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironmentFactory); |
| 100 | }; |
| 101 | |
| 102 | } // namespace remoting |
| 103 | |
| 104 | #endif // REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ |