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 <map> | 8 #include <map> |
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 "media/video/capture/screen/screen_capturer.h" | |
19 #include "remoting/host/client_session_control.h" | 18 #include "remoting/host/client_session_control.h" |
20 #include "remoting/protocol/clipboard_stub.h" | 19 #include "remoting/protocol/clipboard_stub.h" |
21 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 20 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| 21 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" |
22 | 22 |
23 namespace IPC { | 23 namespace IPC { |
24 class ChannelProxy; | 24 class ChannelProxy; |
25 class Message; | 25 class Message; |
26 } // namespace IPC | 26 } // namespace IPC |
27 | 27 |
28 namespace remoting { | 28 namespace remoting { |
29 | 29 |
30 class AudioCapturer; | 30 class AudioCapturer; |
31 class AudioPacket; | 31 class AudioPacket; |
32 class AutoThreadTaskRunner; | 32 class AutoThreadTaskRunner; |
33 class DesktopEnvironment; | 33 class DesktopEnvironment; |
34 class DesktopEnvironmentFactory; | 34 class DesktopEnvironmentFactory; |
35 class InputInjector; | 35 class InputInjector; |
36 class RemoteInputFilter; | 36 class RemoteInputFilter; |
37 class ScreenControls; | 37 class ScreenControls; |
38 class ScreenResolution; | 38 class ScreenResolution; |
39 | 39 |
40 namespace protocol { | 40 namespace protocol { |
41 class InputEventTracker; | 41 class InputEventTracker; |
42 } // namespace protocol | 42 } // namespace protocol |
43 | 43 |
44 // Provides screen/audio capturing and input injection services for | 44 // Provides screen/audio capturing and input injection services for |
45 // the network process. | 45 // the network process. |
46 class DesktopSessionAgent | 46 class DesktopSessionAgent |
47 : public base::RefCountedThreadSafe<DesktopSessionAgent>, | 47 : public base::RefCountedThreadSafe<DesktopSessionAgent>, |
48 public IPC::Listener, | 48 public IPC::Listener, |
49 public webrtc::DesktopCapturer::Callback, | 49 public webrtc::DesktopCapturer::Callback, |
50 public media::ScreenCapturer::MouseShapeObserver, | 50 public webrtc::ScreenCapturer::MouseShapeObserver, |
51 public ClientSessionControl { | 51 public ClientSessionControl { |
52 public: | 52 public: |
53 class Delegate { | 53 class Delegate { |
54 public: | 54 public: |
55 virtual ~Delegate(); | 55 virtual ~Delegate(); |
56 | 56 |
57 // Returns an instance of desktop environment factory used. | 57 // Returns an instance of desktop environment factory used. |
58 virtual DesktopEnvironmentFactory& desktop_environment_factory() = 0; | 58 virtual DesktopEnvironmentFactory& desktop_environment_factory() = 0; |
59 | 59 |
60 // Notifies the delegate that the network-to-desktop channel has been | 60 // Notifies the delegate that the network-to-desktop channel has been |
(...skipping 10 matching lines...) Expand all Loading... |
71 | 71 |
72 // IPC::Listener implementation. | 72 // IPC::Listener implementation. |
73 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 73 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
74 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 74 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
75 virtual void OnChannelError() OVERRIDE; | 75 virtual void OnChannelError() OVERRIDE; |
76 | 76 |
77 // webrtc::DesktopCapturer::Callback implementation. | 77 // webrtc::DesktopCapturer::Callback implementation. |
78 virtual webrtc::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE; | 78 virtual webrtc::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE; |
79 virtual void OnCaptureCompleted(webrtc::DesktopFrame* frame) OVERRIDE; | 79 virtual void OnCaptureCompleted(webrtc::DesktopFrame* frame) OVERRIDE; |
80 | 80 |
81 // media::ScreenCapturer::MouseShapeObserver implementation. | 81 // webrtc::ScreenCapturer::MouseShapeObserver implementation. |
82 virtual void OnCursorShapeChanged( | 82 virtual void OnCursorShapeChanged( |
83 scoped_ptr<media::MouseCursorShape> cursor_shape) OVERRIDE; | 83 webrtc::MouseCursorShape* cursor_shape) OVERRIDE; |
84 | 84 |
85 // Forwards a local clipboard event though the IPC channel to the network | 85 // Forwards a local clipboard event though the IPC channel to the network |
86 // process. | 86 // process. |
87 void InjectClipboardEvent(const protocol::ClipboardEvent& event); | 87 void InjectClipboardEvent(const protocol::ClipboardEvent& event); |
88 | 88 |
89 // Forwards an audio packet though the IPC channel to the network process. | 89 // Forwards an audio packet though the IPC channel to the network process. |
90 void ProcessAudioPacket(scoped_ptr<AudioPacket> packet); | 90 void ProcessAudioPacket(scoped_ptr<AudioPacket> packet); |
91 | 91 |
92 // Creates desktop integration components and a connected IPC channel to be | 92 // Creates desktop integration components and a connected IPC channel to be |
93 // used to access them. The client end of the channel is returned in | 93 // used to access them. The client end of the channel is returned in |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // Next shared buffer ID to be used. | 207 // Next shared buffer ID to be used. |
208 int next_shared_buffer_id_; | 208 int next_shared_buffer_id_; |
209 | 209 |
210 // The number of currently allocated shared buffers. | 210 // The number of currently allocated shared buffers. |
211 int shared_buffers_; | 211 int shared_buffers_; |
212 | 212 |
213 // True if the desktop session agent has been started. | 213 // True if the desktop session agent has been started. |
214 bool started_; | 214 bool started_; |
215 | 215 |
216 // Captures the screen. | 216 // Captures the screen. |
217 scoped_ptr<media::ScreenCapturer> video_capturer_; | 217 scoped_ptr<webrtc::ScreenCapturer> video_capturer_; |
218 | 218 |
219 // Keep reference to the last frame sent to make sure shared buffer is alive | 219 // Keep reference to the last frame sent to make sure shared buffer is alive |
220 // before it's received. | 220 // before it's received. |
221 scoped_ptr<webrtc::DesktopFrame> last_frame_; | 221 scoped_ptr<webrtc::DesktopFrame> last_frame_; |
222 | 222 |
223 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgent); | 223 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgent); |
224 }; | 224 }; |
225 | 225 |
226 } // namespace remoting | 226 } // namespace remoting |
227 | 227 |
228 #endif // REMOTING_HOST_DESKTOP_SESSION_AGENT_H_ | 228 #endif // REMOTING_HOST_DESKTOP_SESSION_AGENT_H_ |
OLD | NEW |