OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ | 5 #ifndef REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ |
6 #define REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ | 6 #define REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" |
13 #include "remoting/host/desktop_environment.h" | 14 #include "remoting/host/desktop_environment.h" |
14 #include "remoting/host/ui_strings.h" | 15 #include "remoting/host/ui_strings.h" |
15 | 16 |
16 namespace remoting { | 17 namespace remoting { |
17 | 18 |
18 class HostWindow; | |
19 class LocalInputMonitor; | |
20 | |
21 // Used to create audio/video capturers and event executor that work with | 19 // Used to create audio/video capturers and event executor that work with |
22 // the local console. | 20 // the local console. |
23 class BasicDesktopEnvironment : public DesktopEnvironment { | 21 class BasicDesktopEnvironment : public DesktopEnvironment { |
24 public: | 22 public: |
25 virtual ~BasicDesktopEnvironment(); | 23 virtual ~BasicDesktopEnvironment(); |
26 | 24 |
27 // DesktopEnvironment implementation. | 25 // DesktopEnvironment implementation. |
28 virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() OVERRIDE; | 26 virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() OVERRIDE; |
29 virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE; | 27 virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE; |
30 virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE; | 28 virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE; |
31 virtual scoped_ptr<media::ScreenCapturer> CreateVideoCapturer() OVERRIDE; | 29 virtual scoped_ptr<media::ScreenCapturer> CreateVideoCapturer() OVERRIDE; |
32 virtual std::string GetCapabilities() const OVERRIDE; | 30 virtual std::string GetCapabilities() const OVERRIDE; |
33 virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; | 31 virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; |
34 | 32 |
35 protected: | 33 protected: |
36 friend class BasicDesktopEnvironmentFactory; | 34 friend class BasicDesktopEnvironmentFactory; |
37 | 35 |
38 // |ui_strings| are hosted by the BasicDesktopEnvironmentFactory instance that | 36 // |ui_strings| are hosted by the BasicDesktopEnvironmentFactory instance that |
39 // created |this|. |ui_strings| must outlive this object. | 37 // created |this|. |ui_strings| must outlive this object. |
40 BasicDesktopEnvironment( | 38 BasicDesktopEnvironment( |
41 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 39 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
42 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 40 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
43 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 41 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
44 const UiStrings* ui_strings); | 42 base::WeakPtr<ClientSessionControl> client_session_control, |
45 | 43 const UiStrings& ui_strings); |
46 // Initializes UI elements required for non-curtained session: | |
47 // DisconnectWindow and LocalInputMonitor. Must be called by the factory when | |
48 // the session is not curtained (i.e. shared with a local user). | |
49 void InitNonCurtainedSessionUI( | |
50 base::WeakPtr<ClientSessionControl> client_session_control); | |
51 | 44 |
52 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const { | 45 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const { |
53 return caller_task_runner_; | 46 return caller_task_runner_; |
54 } | 47 } |
55 | 48 |
56 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const { | 49 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const { |
57 return input_task_runner_; | 50 return input_task_runner_; |
58 } | 51 } |
59 | 52 |
60 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const { | 53 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const { |
61 return ui_task_runner_; | 54 return ui_task_runner_; |
62 } | 55 } |
63 | 56 |
64 const UiStrings* ui_strings() const { return ui_strings_; } | |
65 | |
66 private: | 57 private: |
67 // Task runner on which methods of DesktopEnvironment interface should be | 58 // Task runner on which methods of DesktopEnvironment interface should be |
68 // called. | 59 // called. |
69 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; | 60 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; |
70 | 61 |
71 // Used to run input-related tasks. | 62 // Used to run input-related tasks. |
72 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; | 63 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; |
73 | 64 |
74 // Used to run UI code. | 65 // Used to run UI code. |
75 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 66 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
76 | 67 |
77 // Presents the disconnect window to the local user. | |
78 scoped_ptr<HostWindow> disconnect_window_; | |
79 | |
80 // Notifies the client session about the local mouse movements. | |
81 scoped_ptr<LocalInputMonitor> local_input_monitor_; | |
82 | |
83 // Points to the localized UI strings. | |
84 const UiStrings* ui_strings_; | |
85 | |
86 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironment); | 68 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironment); |
87 }; | 69 }; |
88 | 70 |
89 // Used to create |BasicDesktopEnvironment| instances. | 71 // Used to create |BasicDesktopEnvironment| instances. |
90 class BasicDesktopEnvironmentFactory : public DesktopEnvironmentFactory { | 72 class BasicDesktopEnvironmentFactory : public DesktopEnvironmentFactory { |
91 public: | 73 public: |
92 BasicDesktopEnvironmentFactory( | 74 BasicDesktopEnvironmentFactory( |
93 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 75 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
94 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 76 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
95 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 77 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 111 |
130 // Contains a copy of the localized UI strings. | 112 // Contains a copy of the localized UI strings. |
131 const UiStrings ui_strings_; | 113 const UiStrings ui_strings_; |
132 | 114 |
133 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironmentFactory); | 115 DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironmentFactory); |
134 }; | 116 }; |
135 | 117 |
136 } // namespace remoting | 118 } // namespace remoting |
137 | 119 |
138 #endif // REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ | 120 #endif // REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ |
OLD | NEW |