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