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 <list> | 8 #include <list> |
9 | 9 |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "base/timer.h" | 11 #include "base/timer.h" |
12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
13 #include "remoting/host/remote_input_filter.h" | 13 #include "remoting/host/remote_input_filter.h" |
14 #include "remoting/protocol/clipboard_echo_filter.h" | 14 #include "remoting/protocol/clipboard_echo_filter.h" |
| 15 #include "remoting/protocol/clipboard_filter.h" |
15 #include "remoting/protocol/clipboard_stub.h" | 16 #include "remoting/protocol/clipboard_stub.h" |
16 #include "remoting/protocol/connection_to_client.h" | 17 #include "remoting/protocol/connection_to_client.h" |
17 #include "remoting/protocol/host_stub.h" | 18 #include "remoting/protocol/host_stub.h" |
18 #include "remoting/protocol/input_event_tracker.h" | 19 #include "remoting/protocol/input_event_tracker.h" |
19 #include "remoting/protocol/input_filter.h" | 20 #include "remoting/protocol/input_filter.h" |
20 #include "remoting/protocol/input_stub.h" | 21 #include "remoting/protocol/input_stub.h" |
21 #include "remoting/protocol/mouse_input_filter.h" | 22 #include "remoting/protocol/mouse_input_filter.h" |
22 #include "third_party/skia/include/core/SkPoint.h" | 23 #include "third_party/skia/include/core/SkPoint.h" |
23 | 24 |
24 namespace remoting { | 25 namespace remoting { |
25 | 26 |
26 class VideoFrameCapturer; | 27 class VideoFrameCapturer; |
27 | 28 |
28 // A ClientSession keeps a reference to a connection to a client, and maintains | 29 // A ClientSession keeps a reference to a connection to a client, and maintains |
29 // per-client state. | 30 // per-client state. |
30 class ClientSession : public protocol::ClipboardStub, | 31 class ClientSession : public protocol::HostStub, |
31 public protocol::HostStub, | |
32 public protocol::InputStub, | 32 public protocol::InputStub, |
33 public protocol::ConnectionToClient::EventHandler, | 33 public protocol::ConnectionToClient::EventHandler, |
34 public base::NonThreadSafe { | 34 public base::NonThreadSafe { |
35 public: | 35 public: |
36 // Callback interface for passing events to the ChromotingHost. | 36 // Callback interface for passing events to the ChromotingHost. |
37 class EventHandler { | 37 class EventHandler { |
38 public: | 38 public: |
39 // Called after authentication has finished successfully. | 39 // Called after authentication has finished successfully. |
40 virtual void OnSessionAuthenticated(ClientSession* client) = 0; | 40 virtual void OnSessionAuthenticated(ClientSession* client) = 0; |
41 | 41 |
(...skipping 25 matching lines...) Expand all Loading... |
67 }; | 67 }; |
68 | 68 |
69 ClientSession(EventHandler* event_handler, | 69 ClientSession(EventHandler* event_handler, |
70 scoped_ptr<protocol::ConnectionToClient> connection, | 70 scoped_ptr<protocol::ConnectionToClient> connection, |
71 protocol::ClipboardStub* host_clipboard_stub, | 71 protocol::ClipboardStub* host_clipboard_stub, |
72 protocol::InputStub* host_input_stub, | 72 protocol::InputStub* host_input_stub, |
73 VideoFrameCapturer* capturer, | 73 VideoFrameCapturer* capturer, |
74 const base::TimeDelta& max_duration); | 74 const base::TimeDelta& max_duration); |
75 virtual ~ClientSession(); | 75 virtual ~ClientSession(); |
76 | 76 |
77 // protocol::ClipboardStub interface. | |
78 virtual void InjectClipboardEvent( | |
79 const protocol::ClipboardEvent& event) OVERRIDE; | |
80 | |
81 // protocol::InputStub interface. | 77 // protocol::InputStub interface. |
82 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; | 78 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; |
83 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; | 79 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; |
84 | 80 |
85 // protocol::HostStub interface. | 81 // protocol::HostStub interface. |
86 virtual void NotifyClientDimensions( | 82 virtual void NotifyClientDimensions( |
87 const protocol::ClientDimensions& dimensions) OVERRIDE; | 83 const protocol::ClientDimensions& dimensions) OVERRIDE; |
88 virtual void ControlVideo( | 84 virtual void ControlVideo( |
89 const protocol::VideoControl& video_control) OVERRIDE; | 85 const protocol::VideoControl& video_control) OVERRIDE; |
90 | 86 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 141 |
146 // Tracker used to release pressed keys and buttons when disconnecting. | 142 // Tracker used to release pressed keys and buttons when disconnecting. |
147 protocol::InputEventTracker input_tracker_; | 143 protocol::InputEventTracker input_tracker_; |
148 | 144 |
149 // Filter used to disable remote inputs during local input activity. | 145 // Filter used to disable remote inputs during local input activity. |
150 RemoteInputFilter remote_input_filter_; | 146 RemoteInputFilter remote_input_filter_; |
151 | 147 |
152 // Filter used to clamp mouse events to the current display dimensions. | 148 // Filter used to clamp mouse events to the current display dimensions. |
153 protocol::MouseInputFilter mouse_input_filter_; | 149 protocol::MouseInputFilter mouse_input_filter_; |
154 | 150 |
155 // Filter used to manage enabling & disabling of client input events. | 151 // Filters used to manage enabling & disabling of input & clipboard. |
156 protocol::InputFilter disable_input_filter_; | 152 protocol::InputFilter disable_input_filter_; |
| 153 protocol::ClipboardFilter disable_clipboard_filter_; |
157 | 154 |
158 // Filter used to disable inputs when we're not authenticated. | 155 // Filters used to disable input & clipboard when we're not authenticated. |
159 protocol::InputFilter auth_input_filter_; | 156 protocol::InputFilter auth_input_filter_; |
| 157 protocol::ClipboardFilter auth_clipboard_filter_; |
160 | 158 |
161 // Filter to used to stop clipboard items sent from the client being echoed | 159 // Filter to used to stop clipboard items sent from the client being echoed |
162 // back to it. | 160 // back to it. |
163 protocol::ClipboardEchoFilter clipboard_echo_filter_; | 161 protocol::ClipboardEchoFilter clipboard_echo_filter_; |
164 | 162 |
165 // Factory for weak pointers to the client clipboard stub. | 163 // Factory for weak pointers to the client clipboard stub. |
166 // This must appear after |clipboard_echo_filter_|, so that it won't outlive | 164 // This must appear after |clipboard_echo_filter_|, so that it won't outlive |
167 // it. | 165 // it. |
168 base::WeakPtrFactory<ClipboardStub> client_clipboard_factory_; | 166 base::WeakPtrFactory<protocol::ClipboardStub> client_clipboard_factory_; |
169 | 167 |
170 // VideoFrameCapturer, used to determine current screen size for ensuring | 168 // VideoFrameCapturer, used to determine current screen size for ensuring |
171 // injected mouse events fall within the screen area. | 169 // injected mouse events fall within the screen area. |
172 // TODO(lambroslambrou): Move floor-control logic, and clamping to screen | 170 // TODO(lambroslambrou): Move floor-control logic, and clamping to screen |
173 // area, out of this class (crbug.com/96508). | 171 // area, out of this class (crbug.com/96508). |
174 VideoFrameCapturer* capturer_; | 172 VideoFrameCapturer* capturer_; |
175 | 173 |
176 // The maximum duration of this session. | 174 // The maximum duration of this session. |
177 // There is no maximum if this value is <= 0. | 175 // There is no maximum if this value is <= 0. |
178 base::TimeDelta max_duration_; | 176 base::TimeDelta max_duration_; |
179 | 177 |
180 // A timer that triggers a disconnect when the maximum session duration | 178 // A timer that triggers a disconnect when the maximum session duration |
181 // is reached. | 179 // is reached. |
182 base::OneShotTimer<ClientSession> max_duration_timer_; | 180 base::OneShotTimer<ClientSession> max_duration_timer_; |
183 | 181 |
184 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 182 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
185 }; | 183 }; |
186 | 184 |
187 } // namespace remoting | 185 } // namespace remoting |
188 | 186 |
189 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 187 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
OLD | NEW |