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_PROXY_H_ | 5 #ifndef REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ |
6 #define REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ | 6 #define REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/process.h" | 14 #include "base/process.h" |
15 #include "base/sequenced_task_runner_helpers.h" | 15 #include "base/sequenced_task_runner_helpers.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/audio_capturer.h" | 18 #include "remoting/host/audio_capturer.h" |
20 #include "remoting/host/desktop_environment.h" | 19 #include "remoting/host/desktop_environment.h" |
21 #include "remoting/host/screen_resolution.h" | 20 #include "remoting/host/screen_resolution.h" |
22 #include "remoting/proto/event.pb.h" | 21 #include "remoting/proto/event.pb.h" |
23 #include "remoting/protocol/clipboard_stub.h" | 22 #include "remoting/protocol/clipboard_stub.h" |
24 #include "third_party/skia/include/core/SkRegion.h" | 23 #include "third_party/skia/include/core/SkRegion.h" |
| 24 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" |
25 | 25 |
26 namespace base { | 26 namespace base { |
27 class SingleThreadTaskRunner; | 27 class SingleThreadTaskRunner; |
28 } // namespace base | 28 } // namespace base |
29 | 29 |
30 namespace IPC { | 30 namespace IPC { |
31 class ChannelProxy; | 31 class ChannelProxy; |
32 class Message; | 32 class Message; |
33 } // namespace IPC | 33 } // namespace IPC |
34 | 34 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 70 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
71 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, | 71 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, |
72 base::WeakPtr<ClientSessionControl> client_session_control, | 72 base::WeakPtr<ClientSessionControl> client_session_control, |
73 base::WeakPtr<DesktopSessionConnector> desktop_session_connector, | 73 base::WeakPtr<DesktopSessionConnector> desktop_session_connector, |
74 bool virtual_terminal); | 74 bool virtual_terminal); |
75 | 75 |
76 // Mirrors DesktopEnvironment. | 76 // Mirrors DesktopEnvironment. |
77 scoped_ptr<AudioCapturer> CreateAudioCapturer(); | 77 scoped_ptr<AudioCapturer> CreateAudioCapturer(); |
78 scoped_ptr<InputInjector> CreateInputInjector(); | 78 scoped_ptr<InputInjector> CreateInputInjector(); |
79 scoped_ptr<ScreenControls> CreateScreenControls(); | 79 scoped_ptr<ScreenControls> CreateScreenControls(); |
80 scoped_ptr<media::ScreenCapturer> CreateVideoCapturer(); | 80 scoped_ptr<webrtc::ScreenCapturer> CreateVideoCapturer(); |
81 std::string GetCapabilities() const; | 81 std::string GetCapabilities() const; |
82 void SetCapabilities(const std::string& capabilities); | 82 void SetCapabilities(const std::string& capabilities); |
83 | 83 |
84 // IPC::Listener implementation. | 84 // IPC::Listener implementation. |
85 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 85 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
86 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 86 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
87 virtual void OnChannelError() OVERRIDE; | 87 virtual void OnChannelError() OVERRIDE; |
88 | 88 |
89 // Connects to the desktop session agent. | 89 // Connects to the desktop session agent. |
90 bool AttachToDesktop(base::ProcessHandle desktop_process, | 90 bool AttachToDesktop(base::ProcessHandle desktop_process, |
91 IPC::PlatformFileForTransit desktop_pipe); | 91 IPC::PlatformFileForTransit desktop_pipe); |
92 | 92 |
93 // Closes the connection to the desktop session agent and cleans up | 93 // Closes the connection to the desktop session agent and cleans up |
94 // the associated resources. | 94 // the associated resources. |
95 void DetachFromDesktop(); | 95 void DetachFromDesktop(); |
96 | 96 |
97 // Disconnects the client session that owns |this|. | 97 // Disconnects the client session that owns |this|. |
98 void DisconnectSession(); | 98 void DisconnectSession(); |
99 | 99 |
100 // Stores |audio_capturer| to be used to post captured audio packets. Called | 100 // Stores |audio_capturer| to be used to post captured audio packets. Called |
101 // on the |audio_capture_task_runner_| thread. | 101 // on the |audio_capture_task_runner_| thread. |
102 void SetAudioCapturer(const base::WeakPtr<IpcAudioCapturer>& audio_capturer); | 102 void SetAudioCapturer(const base::WeakPtr<IpcAudioCapturer>& audio_capturer); |
103 | 103 |
104 // APIs used to implement the media::ScreenCapturer interface. These must be | 104 // APIs used to implement the webrtc::ScreenCapturer interface. These must be |
105 // called on the |video_capture_task_runner_| thread. | 105 // called on the |video_capture_task_runner_| thread. |
106 void InvalidateRegion(const SkRegion& invalid_region); | 106 void InvalidateRegion(const SkRegion& invalid_region); |
107 void CaptureFrame(); | 107 void CaptureFrame(); |
108 | 108 |
109 // Stores |video_capturer| to be used to post captured video frames. Called on | 109 // Stores |video_capturer| to be used to post captured video frames. Called on |
110 // the |video_capture_task_runner_| thread. | 110 // the |video_capture_task_runner_| thread. |
111 void SetVideoCapturer( | 111 void SetVideoCapturer( |
112 const base::WeakPtr<IpcVideoFrameCapturer> video_capturer); | 112 const base::WeakPtr<IpcVideoFrameCapturer> video_capturer); |
113 | 113 |
114 // APIs used to implement the InputInjector interface. | 114 // APIs used to implement the InputInjector interface. |
(...skipping 26 matching lines...) Expand all Loading... |
141 IPC::PlatformFileForTransit handle, | 141 IPC::PlatformFileForTransit handle, |
142 uint32 size); | 142 uint32 size); |
143 | 143 |
144 // Drops a cached reference to the shared buffer. | 144 // Drops a cached reference to the shared buffer. |
145 void OnReleaseSharedBuffer(int id); | 145 void OnReleaseSharedBuffer(int id); |
146 | 146 |
147 // Handles CaptureCompleted notification from the desktop session agent. | 147 // Handles CaptureCompleted notification from the desktop session agent. |
148 void OnCaptureCompleted(const SerializedDesktopFrame& serialized_frame); | 148 void OnCaptureCompleted(const SerializedDesktopFrame& serialized_frame); |
149 | 149 |
150 // Handles CursorShapeChanged notification from the desktop session agent. | 150 // Handles CursorShapeChanged notification from the desktop session agent. |
151 void OnCursorShapeChanged(const media::MouseCursorShape& cursor_shape); | 151 void OnCursorShapeChanged(const webrtc::MouseCursorShape& cursor_shape); |
152 | 152 |
153 // Handles InjectClipboardEvent request from the desktop integration process. | 153 // Handles InjectClipboardEvent request from the desktop integration process. |
154 void OnInjectClipboardEvent(const std::string& serialized_event); | 154 void OnInjectClipboardEvent(const std::string& serialized_event); |
155 | 155 |
156 // Posts OnCaptureCompleted() to |video_capturer_| on the video thread, | 156 // Posts OnCaptureCompleted() to |video_capturer_| on the video thread, |
157 // passing |frame|. | 157 // passing |frame|. |
158 void PostCaptureCompleted(scoped_ptr<webrtc::DesktopFrame> frame); | 158 void PostCaptureCompleted(scoped_ptr<webrtc::DesktopFrame> frame); |
159 | 159 |
160 // Posts OnCursorShapeChanged() to |video_capturer_| on the video thread, | 160 // Posts OnCursorShapeChanged() to |video_capturer_| on the video thread, |
161 // passing |cursor_shape|. | 161 // passing |cursor_shape|. |
162 void PostCursorShape(scoped_ptr<media::MouseCursorShape> cursor_shape); | 162 void PostCursorShape(scoped_ptr<webrtc::MouseCursorShape> cursor_shape); |
163 | 163 |
164 // Sends a message to the desktop session agent. The message is silently | 164 // Sends a message to the desktop session agent. The message is silently |
165 // deleted if the channel is broken. | 165 // deleted if the channel is broken. |
166 void SendToDesktop(IPC::Message* message); | 166 void SendToDesktop(IPC::Message* message); |
167 | 167 |
168 // Task runners: | 168 // Task runners: |
169 // - |audio_capturer_| is called back on |audio_capture_task_runner_|. | 169 // - |audio_capturer_| is called back on |audio_capture_task_runner_|. |
170 // - public methods of this class (with some exceptions) are called on | 170 // - public methods of this class (with some exceptions) are called on |
171 // |caller_task_runner_|. | 171 // |caller_task_runner_|. |
172 // - background I/O is served on |io_task_runner_|. | 172 // - background I/O is served on |io_task_runner_|. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 }; | 217 }; |
218 | 218 |
219 // Destroys |DesktopSessionProxy| instances on the caller's thread. | 219 // Destroys |DesktopSessionProxy| instances on the caller's thread. |
220 struct DesktopSessionProxyTraits { | 220 struct DesktopSessionProxyTraits { |
221 static void Destruct(const DesktopSessionProxy* desktop_session_proxy); | 221 static void Destruct(const DesktopSessionProxy* desktop_session_proxy); |
222 }; | 222 }; |
223 | 223 |
224 } // namespace remoting | 224 } // namespace remoting |
225 | 225 |
226 #endif // REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ | 226 #endif // REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ |
OLD | NEW |