[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" |
[email protected] | c308f512 | 2013-04-05 03:32:06 | [diff] [blame^] | 12 | #include "remoting/host/ui_strings.h" |
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 13 | |
14 | namespace remoting { | ||||
15 | |||||
[email protected] | c308f512 | 2013-04-05 03:32:06 | [diff] [blame^] | 16 | class HostWindow; |
[email protected] | b167a7b | 2013-03-25 18:34:40 | [diff] [blame] | 17 | class LocalInputMonitor; |
18 | |||||
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 19 | // Used to create audio/video capturers and event executor that work with |
20 | // the local console. | ||||
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 21 | class BasicDesktopEnvironment : public DesktopEnvironment { |
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 22 | public: |
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 23 | virtual ~BasicDesktopEnvironment(); |
24 | |||||
25 | // DesktopEnvironment implementation. | ||||
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 26 | virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() OVERRIDE; |
27 | virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE; | ||||
28 | virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE; | ||||
29 | virtual scoped_ptr<media::ScreenCapturer> CreateVideoCapturer() OVERRIDE; | ||||
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 30 | |
[email protected] | da457fc | 2013-03-14 16:32:12 | [diff] [blame] | 31 | protected: |
32 | friend class BasicDesktopEnvironmentFactory; | ||||
[email protected] | c308f512 | 2013-04-05 03:32:06 | [diff] [blame^] | 33 | |
34 | // |ui_strings| are hosted by the BasicDesktopEnvironmentFactory instance that | ||||
35 | // created |this|. |ui_strings| must outlive this object. | ||||
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 36 | BasicDesktopEnvironment( |
37 | scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | ||||
38 | scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | ||||
39 | scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | ||||
[email protected] | c308f512 | 2013-04-05 03:32:06 | [diff] [blame^] | 40 | base::WeakPtr<ClientSessionControl> client_session_control, |
41 | const UiStrings* ui_strings); | ||||
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 42 | |
43 | scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const { | ||||
44 | return caller_task_runner_; | ||||
45 | } | ||||
46 | |||||
47 | scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const { | ||||
48 | return input_task_runner_; | ||||
49 | } | ||||
50 | |||||
51 | scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const { | ||||
52 | return ui_task_runner_; | ||||
53 | } | ||||
[email protected] | 74b08f8c | 2013-01-30 09:48:59 | [diff] [blame] | 54 | |
[email protected] | c308f512 | 2013-04-05 03:32:06 | [diff] [blame^] | 55 | const UiStrings* ui_strings() const { return ui_strings_; } |
56 | |||||
[email protected] | da457fc | 2013-03-14 16:32:12 | [diff] [blame] | 57 | private: |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 58 | // Task runner on which methods of DesktopEnvironment interface should be |
59 | // called. | ||||
60 | scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; | ||||
61 | |||||
62 | // Used to run input-related tasks. | ||||
63 | scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; | ||||
64 | |||||
65 | // Used to run UI code. | ||||
66 | scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | ||||
67 | |||||
[email protected] | c308f512 | 2013-04-05 03:32:06 | [diff] [blame^] | 68 | // Presents the disconnect window to the local user. |
69 | scoped_ptr<HostWindow> disconnect_window_; | ||||
70 | |||||
[email protected] | b167a7b | 2013-03-25 18:34:40 | [diff] [blame] | 71 | // Notifies the client session about the local mouse movements. |
72 | scoped_ptr<LocalInputMonitor> local_input_monitor_; | ||||
73 | |||||
[email protected] | c308f512 | 2013-04-05 03:32:06 | [diff] [blame^] | 74 | // Points to the localized UI strings. |
75 | const UiStrings* ui_strings_; | ||||
76 | |||||
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 77 | DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironment); |
78 | }; | ||||
79 | |||||
80 | // Used to create |BasicDesktopEnvironment| instances. | ||||
81 | class BasicDesktopEnvironmentFactory : public DesktopEnvironmentFactory { | ||||
82 | public: | ||||
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 83 | BasicDesktopEnvironmentFactory( |
84 | scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | ||||
85 | scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | ||||
[email protected] | c308f512 | 2013-04-05 03:32:06 | [diff] [blame^] | 86 | scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
87 | const UiStrings& ui_strings); | ||||
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 88 | virtual ~BasicDesktopEnvironmentFactory(); |
89 | |||||
90 | // DesktopEnvironmentFactory implementation. | ||||
91 | virtual scoped_ptr<DesktopEnvironment> Create( | ||||
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 92 | base::WeakPtr<ClientSessionControl> client_session_control) OVERRIDE; |
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 93 | virtual bool SupportsAudioCapture() const OVERRIDE; |
94 | |||||
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 95 | protected: |
96 | scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const { | ||||
97 | return caller_task_runner_; | ||||
98 | } | ||||
99 | |||||
100 | scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const { | ||||
101 | return input_task_runner_; | ||||
102 | } | ||||
103 | |||||
104 | scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const { | ||||
105 | return ui_task_runner_; | ||||
106 | } | ||||
107 | |||||
[email protected] | c308f512 | 2013-04-05 03:32:06 | [diff] [blame^] | 108 | const UiStrings& ui_strings() const { return ui_strings_; } |
109 | |||||
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 110 | private: |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 111 | // Task runner on which methods of DesktopEnvironmentFactory interface should |
112 | // be called. | ||||
113 | scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; | ||||
114 | |||||
115 | // Used to run input-related tasks. | ||||
116 | scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; | ||||
117 | |||||
118 | // Used to run UI code. | ||||
119 | scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | ||||
120 | |||||
[email protected] | c308f512 | 2013-04-05 03:32:06 | [diff] [blame^] | 121 | // Contains a copy of the localized UI strings. |
122 | const UiStrings ui_strings_; | ||||
123 | |||||
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 124 | DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironmentFactory); |
125 | }; | ||||
126 | |||||
127 | } // namespace remoting | ||||
128 | |||||
129 | #endif // REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ |