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_DESKTOP_SESSION_AGENT_H_ | 5 #ifndef REMOTING_HOST_DESKTOP_SESSION_AGENT_H_ |
6 #define REMOTING_HOST_DESKTOP_SESSION_AGENT_H_ | 6 #define REMOTING_HOST_DESKTOP_SESSION_AGENT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
| 12 #include <memory> |
12 | 13 |
13 #include "base/callback.h" | 14 #include "base/callback.h" |
14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
17 #include "base/memory/scoped_ptr.h" | |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "ipc/ipc_listener.h" | 19 #include "ipc/ipc_listener.h" |
20 #include "ipc/ipc_platform_file.h" | 20 #include "ipc/ipc_platform_file.h" |
21 #include "remoting/host/client_session_control.h" | 21 #include "remoting/host/client_session_control.h" |
22 #include "remoting/protocol/clipboard_stub.h" | 22 #include "remoting/protocol/clipboard_stub.h" |
23 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" | 23 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" |
24 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 24 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
25 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h" | 25 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h" |
26 | 26 |
27 namespace IPC { | 27 namespace IPC { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // webrtc::MouseCursorMonitor::Callback implementation. | 83 // webrtc::MouseCursorMonitor::Callback implementation. |
84 void OnMouseCursor(webrtc::MouseCursor* cursor) override; | 84 void OnMouseCursor(webrtc::MouseCursor* cursor) override; |
85 void OnMouseCursorPosition(webrtc::MouseCursorMonitor::CursorState state, | 85 void OnMouseCursorPosition(webrtc::MouseCursorMonitor::CursorState state, |
86 const webrtc::DesktopVector& position) override; | 86 const webrtc::DesktopVector& position) override; |
87 | 87 |
88 // Forwards a local clipboard event though the IPC channel to the network | 88 // Forwards a local clipboard event though the IPC channel to the network |
89 // process. | 89 // process. |
90 void InjectClipboardEvent(const protocol::ClipboardEvent& event); | 90 void InjectClipboardEvent(const protocol::ClipboardEvent& event); |
91 | 91 |
92 // Forwards an audio packet though the IPC channel to the network process. | 92 // Forwards an audio packet though the IPC channel to the network process. |
93 void ProcessAudioPacket(scoped_ptr<AudioPacket> packet); | 93 void ProcessAudioPacket(std::unique_ptr<AudioPacket> packet); |
94 | 94 |
95 // Creates desktop integration components and a connected IPC channel to be | 95 // Creates desktop integration components and a connected IPC channel to be |
96 // used to access them. The client end of the channel is returned in | 96 // used to access them. The client end of the channel is returned in |
97 // the variable pointed by |desktop_pipe_out|. | 97 // the variable pointed by |desktop_pipe_out|. |
98 bool Start(const base::WeakPtr<Delegate>& delegate, | 98 bool Start(const base::WeakPtr<Delegate>& delegate, |
99 IPC::PlatformFileForTransit* desktop_pipe_out); | 99 IPC::PlatformFileForTransit* desktop_pipe_out); |
100 | 100 |
101 // Stops the agent asynchronously. | 101 // Stops the agent asynchronously. |
102 void Stop(); | 102 void Stop(); |
103 | 103 |
(...skipping 21 matching lines...) Expand all Loading... |
125 void OnInjectKeyEvent(const std::string& serialized_event); | 125 void OnInjectKeyEvent(const std::string& serialized_event); |
126 void OnInjectTextEvent(const std::string& serialized_event); | 126 void OnInjectTextEvent(const std::string& serialized_event); |
127 void OnInjectMouseEvent(const std::string& serialized_event); | 127 void OnInjectMouseEvent(const std::string& serialized_event); |
128 void OnInjectTouchEvent(const std::string& serialized_event); | 128 void OnInjectTouchEvent(const std::string& serialized_event); |
129 | 129 |
130 // Handles ChromotingNetworkDesktopMsg_SetScreenResolution request from | 130 // Handles ChromotingNetworkDesktopMsg_SetScreenResolution request from |
131 // the client. | 131 // the client. |
132 void SetScreenResolution(const ScreenResolution& resolution); | 132 void SetScreenResolution(const ScreenResolution& resolution); |
133 | 133 |
134 // Sends a message to the network process. | 134 // Sends a message to the network process. |
135 void SendToNetwork(scoped_ptr<IPC::Message> message); | 135 void SendToNetwork(std::unique_ptr<IPC::Message> message); |
136 | 136 |
137 // Posted to |audio_capture_task_runner_| to start the audio capturer. | 137 // Posted to |audio_capture_task_runner_| to start the audio capturer. |
138 void StartAudioCapturer(); | 138 void StartAudioCapturer(); |
139 | 139 |
140 // Posted to |audio_capture_task_runner_| to stop the audio capturer. | 140 // Posted to |audio_capture_task_runner_| to stop the audio capturer. |
141 void StopAudioCapturer(); | 141 void StopAudioCapturer(); |
142 | 142 |
143 private: | 143 private: |
144 // Task runner dedicated to running methods of |audio_capturer_|. | 144 // Task runner dedicated to running methods of |audio_capturer_|. |
145 scoped_refptr<AutoThreadTaskRunner> audio_capture_task_runner_; | 145 scoped_refptr<AutoThreadTaskRunner> audio_capture_task_runner_; |
146 | 146 |
147 // Task runner on which public methods of this class should be called. | 147 // Task runner on which public methods of this class should be called. |
148 scoped_refptr<AutoThreadTaskRunner> caller_task_runner_; | 148 scoped_refptr<AutoThreadTaskRunner> caller_task_runner_; |
149 | 149 |
150 // Task runner on which keyboard/mouse input is injected. | 150 // Task runner on which keyboard/mouse input is injected. |
151 scoped_refptr<AutoThreadTaskRunner> input_task_runner_; | 151 scoped_refptr<AutoThreadTaskRunner> input_task_runner_; |
152 | 152 |
153 // Task runner used by the IPC channel. | 153 // Task runner used by the IPC channel. |
154 scoped_refptr<AutoThreadTaskRunner> io_task_runner_; | 154 scoped_refptr<AutoThreadTaskRunner> io_task_runner_; |
155 | 155 |
156 // Captures audio output. | 156 // Captures audio output. |
157 scoped_ptr<AudioCapturer> audio_capturer_; | 157 std::unique_ptr<AudioCapturer> audio_capturer_; |
158 | 158 |
159 std::string client_jid_; | 159 std::string client_jid_; |
160 | 160 |
161 base::WeakPtr<Delegate> delegate_; | 161 base::WeakPtr<Delegate> delegate_; |
162 | 162 |
163 // The DesktopEnvironment instance used by this agent. | 163 // The DesktopEnvironment instance used by this agent. |
164 scoped_ptr<DesktopEnvironment> desktop_environment_; | 164 std::unique_ptr<DesktopEnvironment> desktop_environment_; |
165 | 165 |
166 // Executes keyboard, mouse and clipboard events. | 166 // Executes keyboard, mouse and clipboard events. |
167 scoped_ptr<InputInjector> input_injector_; | 167 std::unique_ptr<InputInjector> input_injector_; |
168 | 168 |
169 // Tracker used to release pressed keys and buttons when disconnecting. | 169 // Tracker used to release pressed keys and buttons when disconnecting. |
170 scoped_ptr<protocol::InputEventTracker> input_tracker_; | 170 std::unique_ptr<protocol::InputEventTracker> input_tracker_; |
171 | 171 |
172 // Filter used to disable remote inputs during local input activity. | 172 // Filter used to disable remote inputs during local input activity. |
173 scoped_ptr<RemoteInputFilter> remote_input_filter_; | 173 std::unique_ptr<RemoteInputFilter> remote_input_filter_; |
174 | 174 |
175 // Used to apply client-requested changes in screen resolution. | 175 // Used to apply client-requested changes in screen resolution. |
176 scoped_ptr<ScreenControls> screen_controls_; | 176 std::unique_ptr<ScreenControls> screen_controls_; |
177 | 177 |
178 // IPC channel connecting the desktop process with the network process. | 178 // IPC channel connecting the desktop process with the network process. |
179 scoped_ptr<IPC::ChannelProxy> network_channel_; | 179 std::unique_ptr<IPC::ChannelProxy> network_channel_; |
180 | 180 |
181 // The client end of the network-to-desktop pipe. It is kept alive until | 181 // The client end of the network-to-desktop pipe. It is kept alive until |
182 // the network process connects to the pipe. | 182 // the network process connects to the pipe. |
183 base::File desktop_pipe_; | 183 base::File desktop_pipe_; |
184 | 184 |
185 // Size of the most recent captured video frame. | 185 // Size of the most recent captured video frame. |
186 webrtc::DesktopSize current_size_; | 186 webrtc::DesktopSize current_size_; |
187 | 187 |
188 // True if the desktop session agent has been started. | 188 // True if the desktop session agent has been started. |
189 bool started_ = false; | 189 bool started_ = false; |
190 | 190 |
191 // Captures the screen. | 191 // Captures the screen. |
192 scoped_ptr<webrtc::DesktopCapturer> video_capturer_; | 192 std::unique_ptr<webrtc::DesktopCapturer> video_capturer_; |
193 | 193 |
194 // Captures mouse shapes. | 194 // Captures mouse shapes. |
195 scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor_; | 195 std::unique_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor_; |
196 | 196 |
197 // Keep reference to the last frame sent to make sure shared buffer is alive | 197 // Keep reference to the last frame sent to make sure shared buffer is alive |
198 // before it's received. | 198 // before it's received. |
199 scoped_ptr<webrtc::DesktopFrame> last_frame_; | 199 std::unique_ptr<webrtc::DesktopFrame> last_frame_; |
200 | 200 |
201 // Used to disable callbacks to |this|. | 201 // Used to disable callbacks to |this|. |
202 base::WeakPtrFactory<DesktopSessionAgent> weak_factory_; | 202 base::WeakPtrFactory<DesktopSessionAgent> weak_factory_; |
203 | 203 |
204 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgent); | 204 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgent); |
205 }; | 205 }; |
206 | 206 |
207 } // namespace remoting | 207 } // namespace remoting |
208 | 208 |
209 #endif // REMOTING_HOST_DESKTOP_SESSION_AGENT_H_ | 209 #endif // REMOTING_HOST_DESKTOP_SESSION_AGENT_H_ |
OLD | NEW |