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 <list> | 8 #include <list> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "ipc/ipc_listener.h" | 16 #include "ipc/ipc_listener.h" |
17 #include "ipc/ipc_platform_file.h" | 17 #include "ipc/ipc_platform_file.h" |
18 #include "remoting/capturer/shared_buffer.h" | 18 #include "media/video/capture/screen/screen_capturer.h" |
19 #include "remoting/capturer/shared_buffer_factory.h" | 19 #include "media/video/capture/screen/shared_buffer.h" |
20 #include "remoting/capturer/video_frame_capturer.h" | 20 #include "media/video/capture/screen/shared_buffer_factory.h" |
21 #include "remoting/host/mouse_move_observer.h" | 21 #include "remoting/host/mouse_move_observer.h" |
22 #include "remoting/host/ui_strings.h" | 22 #include "remoting/host/ui_strings.h" |
23 #include "remoting/protocol/clipboard_stub.h" | 23 #include "remoting/protocol/clipboard_stub.h" |
24 #include "third_party/skia/include/core/SkRect.h" | 24 #include "third_party/skia/include/core/SkRect.h" |
25 #include "third_party/skia/include/core/SkSize.h" | 25 #include "third_party/skia/include/core/SkSize.h" |
26 | 26 |
27 namespace IPC { | 27 namespace IPC { |
28 class ChannelProxy; | 28 class ChannelProxy; |
29 class Message; | 29 class Message; |
30 } // namespace IPC | 30 } // namespace IPC |
(...skipping 11 matching lines...) Expand all Loading... |
42 namespace protocol { | 42 namespace protocol { |
43 class InputEventTracker; | 43 class InputEventTracker; |
44 } // namespace protocol | 44 } // namespace protocol |
45 | 45 |
46 // Provides screen/audio capturing and input injection services for | 46 // Provides screen/audio capturing and input injection services for |
47 // the network process. | 47 // the network process. |
48 class DesktopSessionAgent | 48 class DesktopSessionAgent |
49 : public base::RefCountedThreadSafe<DesktopSessionAgent>, | 49 : public base::RefCountedThreadSafe<DesktopSessionAgent>, |
50 public IPC::Listener, | 50 public IPC::Listener, |
51 public MouseMoveObserver, | 51 public MouseMoveObserver, |
52 public SharedBufferFactory, | 52 public media::SharedBufferFactory, |
53 public VideoFrameCapturer::Delegate { | 53 public media::ScreenCapturer::Delegate { |
54 public: | 54 public: |
55 class Delegate { | 55 class Delegate { |
56 public: | 56 public: |
57 virtual ~Delegate(); | 57 virtual ~Delegate(); |
58 | 58 |
59 // Notifies the delegate that the network-to-desktop channel has been | 59 // Notifies the delegate that the network-to-desktop channel has been |
60 // disconnected. | 60 // disconnected. |
61 virtual void OnNetworkProcessDisconnected() = 0; | 61 virtual void OnNetworkProcessDisconnected() = 0; |
62 | 62 |
63 // Request the delegate to inject Secure Attention Sequence. | 63 // Request the delegate to inject Secure Attention Sequence. |
64 virtual void InjectSas() = 0; | 64 virtual void InjectSas() = 0; |
65 }; | 65 }; |
66 | 66 |
67 static scoped_refptr<DesktopSessionAgent> Create( | 67 static scoped_refptr<DesktopSessionAgent> Create( |
68 scoped_refptr<AutoThreadTaskRunner> audio_capture_task_runner, | 68 scoped_refptr<AutoThreadTaskRunner> audio_capture_task_runner, |
69 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 69 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
70 scoped_refptr<AutoThreadTaskRunner> input_task_runner, | 70 scoped_refptr<AutoThreadTaskRunner> input_task_runner, |
71 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 71 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
72 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner); | 72 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner); |
73 | 73 |
74 // IPC::Listener implementation. | 74 // IPC::Listener implementation. |
75 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 75 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
76 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 76 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
77 virtual void OnChannelError() OVERRIDE; | 77 virtual void OnChannelError() OVERRIDE; |
78 | 78 |
79 // MouseMoveObserver implementation. | 79 // MouseMoveObserver implementation. |
80 virtual void OnLocalMouseMoved(const SkIPoint& new_pos) OVERRIDE; | 80 virtual void OnLocalMouseMoved(const SkIPoint& new_pos) OVERRIDE; |
81 | 81 |
82 // SharedBufferFactory implementation. | 82 // SharedBufferFactory implementation. |
83 virtual scoped_refptr<SharedBuffer> CreateSharedBuffer(uint32 size) OVERRIDE; | 83 virtual scoped_refptr<media::SharedBuffer> CreateSharedBuffer( |
84 virtual void ReleaseSharedBuffer(scoped_refptr<SharedBuffer> buffer) OVERRIDE; | 84 uint32 size) OVERRIDE; |
| 85 virtual void ReleaseSharedBuffer( |
| 86 scoped_refptr<media::SharedBuffer> buffer) OVERRIDE; |
85 | 87 |
86 // VideoFrameCapturer::Delegate implementation. | 88 // media::ScreenCapturer::Delegate implementation. |
87 virtual void OnCaptureCompleted( | 89 virtual void OnCaptureCompleted( |
88 scoped_refptr<CaptureData> capture_data) OVERRIDE; | 90 scoped_refptr<media::ScreenCaptureData> capture_data) OVERRIDE; |
89 virtual void OnCursorShapeChanged( | 91 virtual void OnCursorShapeChanged( |
90 scoped_ptr<MouseCursorShape> cursor_shape) OVERRIDE; | 92 scoped_ptr<media::MouseCursorShape> cursor_shape) OVERRIDE; |
91 | 93 |
92 // Forwards a local clipboard event though the IPC channel to the network | 94 // Forwards a local clipboard event though the IPC channel to the network |
93 // process. | 95 // process. |
94 void InjectClipboardEvent(const protocol::ClipboardEvent& event); | 96 void InjectClipboardEvent(const protocol::ClipboardEvent& event); |
95 | 97 |
96 // Forwards an audio packet though the IPC channel to the network process. | 98 // Forwards an audio packet though the IPC channel to the network process. |
97 void ProcessAudioPacket(scoped_ptr<AudioPacket> packet); | 99 void ProcessAudioPacket(scoped_ptr<AudioPacket> packet); |
98 | 100 |
99 // Creates desktop integration components and a connected IPC channel to be | 101 // Creates desktop integration components and a connected IPC channel to be |
100 // used to access them. The client end of the channel is returned in | 102 // used to access them. The client end of the channel is returned in |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // IPC channel connecting the desktop process with the network process. | 228 // IPC channel connecting the desktop process with the network process. |
227 scoped_ptr<IPC::ChannelProxy> network_channel_; | 229 scoped_ptr<IPC::ChannelProxy> network_channel_; |
228 | 230 |
229 // Size of the most recent captured video frame. | 231 // Size of the most recent captured video frame. |
230 SkISize current_size_; | 232 SkISize current_size_; |
231 | 233 |
232 // Next shared buffer ID to be used. | 234 // Next shared buffer ID to be used. |
233 int next_shared_buffer_id_; | 235 int next_shared_buffer_id_; |
234 | 236 |
235 // List of the shared buffers registered via |SharedBufferFactory| interface. | 237 // List of the shared buffers registered via |SharedBufferFactory| interface. |
236 typedef std::list<scoped_refptr<SharedBuffer> > SharedBuffers; | 238 typedef std::list<scoped_refptr<media::SharedBuffer> > SharedBuffers; |
237 SharedBuffers shared_buffers_; | 239 SharedBuffers shared_buffers_; |
238 | 240 |
239 // True if the desktop session agent has been started. | 241 // True if the desktop session agent has been started. |
240 bool started_; | 242 bool started_; |
241 | 243 |
242 // Captures the screen. | 244 // Captures the screen. |
243 scoped_ptr<VideoFrameCapturer> video_capturer_; | 245 scoped_ptr<media::ScreenCapturer> video_capturer_; |
244 | 246 |
245 UiStrings ui_strings_; | 247 UiStrings ui_strings_; |
246 | 248 |
247 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgent); | 249 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgent); |
248 }; | 250 }; |
249 | 251 |
250 } // namespace remoting | 252 } // namespace remoting |
251 | 253 |
252 #endif // REMOTING_HOST_DESKTOP_SESSION_AGENT_H_ | 254 #endif // REMOTING_HOST_DESKTOP_SESSION_AGENT_H_ |
OLD | NEW |