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_CLIENT_SESSION_H_ | 5 #ifndef REMOTING_HOST_CLIENT_SESSION_H_ |
6 #define REMOTING_HOST_CLIENT_SESSION_H_ | 6 #define REMOTING_HOST_CLIENT_SESSION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_vector.h" |
11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
12 #include "base/sequenced_task_runner_helpers.h" | 13 #include "base/sequenced_task_runner_helpers.h" |
13 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
15 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
16 #include "remoting/host/client_session_control.h" | 17 #include "remoting/host/client_session_control.h" |
17 #include "remoting/host/gnubby_auth_handler.h" | 18 #include "remoting/host/gnubby_auth_handler.h" |
| 19 #include "remoting/host/host_extension.h" |
| 20 #include "remoting/host/host_extension_session.h" |
18 #include "remoting/host/mouse_clamping_filter.h" | 21 #include "remoting/host/mouse_clamping_filter.h" |
19 #include "remoting/host/remote_input_filter.h" | 22 #include "remoting/host/remote_input_filter.h" |
20 #include "remoting/protocol/clipboard_echo_filter.h" | 23 #include "remoting/protocol/clipboard_echo_filter.h" |
21 #include "remoting/protocol/clipboard_filter.h" | 24 #include "remoting/protocol/clipboard_filter.h" |
22 #include "remoting/protocol/clipboard_stub.h" | 25 #include "remoting/protocol/clipboard_stub.h" |
23 #include "remoting/protocol/connection_to_client.h" | 26 #include "remoting/protocol/connection_to_client.h" |
24 #include "remoting/protocol/host_stub.h" | 27 #include "remoting/protocol/host_stub.h" |
25 #include "remoting/protocol/input_event_tracker.h" | 28 #include "remoting/protocol/input_event_tracker.h" |
26 #include "remoting/protocol/input_filter.h" | 29 #include "remoting/protocol/input_filter.h" |
27 #include "remoting/protocol/input_stub.h" | 30 #include "remoting/protocol/input_stub.h" |
(...skipping 29 matching lines...) Expand all Loading... |
57 // Called after authentication has started. | 60 // Called after authentication has started. |
58 virtual void OnSessionAuthenticating(ClientSession* client) = 0; | 61 virtual void OnSessionAuthenticating(ClientSession* client) = 0; |
59 | 62 |
60 // Called after authentication has finished successfully. Returns true if | 63 // Called after authentication has finished successfully. Returns true if |
61 // the connection is allowed, or false otherwise. | 64 // the connection is allowed, or false otherwise. |
62 virtual bool OnSessionAuthenticated(ClientSession* client) = 0; | 65 virtual bool OnSessionAuthenticated(ClientSession* client) = 0; |
63 | 66 |
64 // Called after we've finished connecting all channels. | 67 // Called after we've finished connecting all channels. |
65 virtual void OnSessionChannelsConnected(ClientSession* client) = 0; | 68 virtual void OnSessionChannelsConnected(ClientSession* client) = 0; |
66 | 69 |
| 70 // Called after client has reported capabilities. |
| 71 virtual void OnSessionClientCapabilities(ClientSession* client) = 0; |
| 72 |
67 // Called after authentication has failed. Must not tear down this | 73 // Called after authentication has failed. Must not tear down this |
68 // object. OnSessionClosed() is notified after this handler | 74 // object. OnSessionClosed() is notified after this handler |
69 // returns. | 75 // returns. |
70 virtual void OnSessionAuthenticationFailed(ClientSession* client) = 0; | 76 virtual void OnSessionAuthenticationFailed(ClientSession* client) = 0; |
71 | 77 |
72 // Called after connection has failed or after the client closed it. | 78 // Called after connection has failed or after the client closed it. |
73 virtual void OnSessionClosed(ClientSession* client) = 0; | 79 virtual void OnSessionClosed(ClientSession* client) = 0; |
74 | 80 |
75 // Called to notify of each message's sequence number. The | 81 // Called to notify of each message's sequence number. The |
76 // callback must not tear down this object. | 82 // callback must not tear down this object. |
(...skipping 19 matching lines...) Expand all Loading... |
96 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, | 102 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, |
97 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner, | 103 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner, |
98 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, | 104 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
99 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 105 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
100 scoped_ptr<protocol::ConnectionToClient> connection, | 106 scoped_ptr<protocol::ConnectionToClient> connection, |
101 DesktopEnvironmentFactory* desktop_environment_factory, | 107 DesktopEnvironmentFactory* desktop_environment_factory, |
102 const base::TimeDelta& max_duration, | 108 const base::TimeDelta& max_duration, |
103 scoped_refptr<protocol::PairingRegistry> pairing_registry); | 109 scoped_refptr<protocol::PairingRegistry> pairing_registry); |
104 virtual ~ClientSession(); | 110 virtual ~ClientSession(); |
105 | 111 |
| 112 // Adds an extension to client to handle extension messages. |
| 113 void AddExtensionSession(scoped_ptr<HostExtensionSession> extension_session); |
| 114 |
| 115 // Adds extended capabilities to advertise to the client, e.g. those |
| 116 // implemented by |DesktopEnvironment| or |HostExtension|s. |
| 117 void AddHostCapabilities(const std::string& capability); |
| 118 |
106 // protocol::HostStub interface. | 119 // protocol::HostStub interface. |
107 virtual void NotifyClientResolution( | 120 virtual void NotifyClientResolution( |
108 const protocol::ClientResolution& resolution) OVERRIDE; | 121 const protocol::ClientResolution& resolution) OVERRIDE; |
109 virtual void ControlVideo( | 122 virtual void ControlVideo( |
110 const protocol::VideoControl& video_control) OVERRIDE; | 123 const protocol::VideoControl& video_control) OVERRIDE; |
111 virtual void ControlAudio( | 124 virtual void ControlAudio( |
112 const protocol::AudioControl& audio_control) OVERRIDE; | 125 const protocol::AudioControl& audio_control) OVERRIDE; |
113 virtual void SetCapabilities( | 126 virtual void SetCapabilities( |
114 const protocol::Capabilities& capabilities) OVERRIDE; | 127 const protocol::Capabilities& capabilities) OVERRIDE; |
115 virtual void RequestPairing( | 128 virtual void RequestPairing( |
(...skipping 25 matching lines...) Expand all Loading... |
141 virtual void SetDisableInputs(bool disable_inputs) OVERRIDE; | 154 virtual void SetDisableInputs(bool disable_inputs) OVERRIDE; |
142 | 155 |
143 void SetGnubbyAuthHandlerForTesting(GnubbyAuthHandler* gnubby_auth_handler); | 156 void SetGnubbyAuthHandlerForTesting(GnubbyAuthHandler* gnubby_auth_handler); |
144 | 157 |
145 protocol::ConnectionToClient* connection() const { | 158 protocol::ConnectionToClient* connection() const { |
146 return connection_.get(); | 159 return connection_.get(); |
147 } | 160 } |
148 | 161 |
149 bool is_authenticated() { return auth_input_filter_.enabled(); } | 162 bool is_authenticated() { return auth_input_filter_.enabled(); } |
150 | 163 |
| 164 const std::string* client_capabilities() const { |
| 165 return client_capabilities_.get(); |
| 166 } |
| 167 |
151 private: | 168 private: |
| 169 typedef ScopedVector<HostExtensionSession> HostExtensionSessionList; |
| 170 |
152 // Creates a proxy for sending clipboard events to the client. | 171 // Creates a proxy for sending clipboard events to the client. |
153 scoped_ptr<protocol::ClipboardStub> CreateClipboardProxy(); | 172 scoped_ptr<protocol::ClipboardStub> CreateClipboardProxy(); |
154 | 173 |
155 // Creates an audio encoder for the specified configuration. | 174 // Creates an audio encoder for the specified configuration. |
156 static scoped_ptr<AudioEncoder> CreateAudioEncoder( | 175 static scoped_ptr<AudioEncoder> CreateAudioEncoder( |
157 const protocol::SessionConfig& config); | 176 const protocol::SessionConfig& config); |
158 | 177 |
159 // Creates a video encoder for the specified configuration. | 178 // Creates a video encoder for the specified configuration. |
160 static scoped_ptr<VideoEncoder> CreateVideoEncoder( | 179 static scoped_ptr<VideoEncoder> CreateVideoEncoder( |
161 const protocol::SessionConfig& config); | 180 const protocol::SessionConfig& config); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 256 |
238 // Used to apply client-requested changes in screen resolution. | 257 // Used to apply client-requested changes in screen resolution. |
239 scoped_ptr<ScreenControls> screen_controls_; | 258 scoped_ptr<ScreenControls> screen_controls_; |
240 | 259 |
241 // The pairing registry for PIN-less authentication. | 260 // The pairing registry for PIN-less authentication. |
242 scoped_refptr<protocol::PairingRegistry> pairing_registry_; | 261 scoped_refptr<protocol::PairingRegistry> pairing_registry_; |
243 | 262 |
244 // Used to proxy gnubby auth traffic. | 263 // Used to proxy gnubby auth traffic. |
245 scoped_ptr<GnubbyAuthHandler> gnubby_auth_handler_; | 264 scoped_ptr<GnubbyAuthHandler> gnubby_auth_handler_; |
246 | 265 |
| 266 // Host extension sessions, used to handle extension messages. |
| 267 HostExtensionSessionList extension_sessions_; |
| 268 |
247 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 269 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
248 }; | 270 }; |
249 | 271 |
250 } // namespace remoting | 272 } // namespace remoting |
251 | 273 |
252 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 274 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
OLD | NEW |