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_stub.h" | 15 #include "remoting/protocol/clipboard_stub.h" |
16 #include "remoting/protocol/connection_to_client.h" | 16 #include "remoting/protocol/connection_to_client.h" |
17 #include "remoting/protocol/host_event_stub.h" | 17 #include "remoting/protocol/host_event_stub.h" |
18 #include "remoting/protocol/host_stub.h" | 18 #include "remoting/protocol/host_stub.h" |
19 #include "remoting/protocol/input_event_tracker.h" | 19 #include "remoting/protocol/input_event_tracker.h" |
20 #include "remoting/protocol/input_filter.h" | 20 #include "remoting/protocol/input_filter.h" |
21 #include "remoting/protocol/input_stub.h" | 21 #include "remoting/protocol/input_stub.h" |
22 #include "remoting/protocol/mouse_input_filter.h" | 22 #include "remoting/protocol/mouse_input_filter.h" |
23 #include "third_party/skia/include/core/SkPoint.h" | 23 #include "third_party/skia/include/core/SkPoint.h" |
24 | 24 |
25 namespace remoting { | 25 namespace remoting { |
26 | 26 |
27 class Capturer; | 27 class VideoFrameCapturer; |
28 | 28 |
29 // 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 |
30 // per-client state. | 30 // per-client state. |
31 class ClientSession : public protocol::HostEventStub, | 31 class ClientSession : public protocol::HostEventStub, |
32 public protocol::HostStub, | 32 public protocol::HostStub, |
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 { |
(...skipping 24 matching lines...) Expand all Loading... |
62 const std::string& channel_name, | 62 const std::string& channel_name, |
63 const protocol::TransportRoute& route) = 0; | 63 const protocol::TransportRoute& route) = 0; |
64 | 64 |
65 protected: | 65 protected: |
66 virtual ~EventHandler() {} | 66 virtual ~EventHandler() {} |
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::HostEventStub* host_event_stub, | 71 protocol::HostEventStub* host_event_stub, |
72 Capturer* capturer, | 72 VideoFrameCapturer* capturer, |
73 const base::TimeDelta& max_duration); | 73 const base::TimeDelta& max_duration); |
74 virtual ~ClientSession(); | 74 virtual ~ClientSession(); |
75 | 75 |
76 // protocol::ClipboardStub interface. | 76 // protocol::ClipboardStub interface. |
77 virtual void InjectClipboardEvent( | 77 virtual void InjectClipboardEvent( |
78 const protocol::ClipboardEvent& event) OVERRIDE; | 78 const protocol::ClipboardEvent& event) OVERRIDE; |
79 | 79 |
80 // protocol::InputStub interface. | 80 // protocol::InputStub interface. |
81 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; | 81 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; |
82 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; | 82 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 // Filter to used to stop clipboard items sent from the client being echoed | 158 // Filter to used to stop clipboard items sent from the client being echoed |
159 // back to it. | 159 // back to it. |
160 protocol::ClipboardEchoFilter clipboard_echo_filter_; | 160 protocol::ClipboardEchoFilter clipboard_echo_filter_; |
161 | 161 |
162 // Factory for weak pointers to the client clipboard stub. | 162 // Factory for weak pointers to the client clipboard stub. |
163 // This must appear after |clipboard_echo_filter_|, so that it won't outlive | 163 // This must appear after |clipboard_echo_filter_|, so that it won't outlive |
164 // it. | 164 // it. |
165 base::WeakPtrFactory<ClipboardStub> client_clipboard_factory_; | 165 base::WeakPtrFactory<ClipboardStub> client_clipboard_factory_; |
166 | 166 |
167 // Capturer, used to determine current screen size for ensuring injected | 167 // VideoFrameCapturer, used to determine current screen size for ensuring |
168 // mouse events fall within the screen area. | 168 // injected mouse events fall within the screen area. |
169 // TODO(lambroslambrou): Move floor-control logic, and clamping to screen | 169 // TODO(lambroslambrou): Move floor-control logic, and clamping to screen |
170 // area, out of this class (crbug.com/96508). | 170 // area, out of this class (crbug.com/96508). |
171 Capturer* capturer_; | 171 VideoFrameCapturer* capturer_; |
172 | 172 |
173 // The maximum duration of this session. | 173 // The maximum duration of this session. |
174 // There is no maximum if this value is <= 0. | 174 // There is no maximum if this value is <= 0. |
175 base::TimeDelta max_duration_; | 175 base::TimeDelta max_duration_; |
176 | 176 |
177 // A timer that triggers a disconnect when the maximum session duration | 177 // A timer that triggers a disconnect when the maximum session duration |
178 // is reached. | 178 // is reached. |
179 base::OneShotTimer<ClientSession> max_duration_timer_; | 179 base::OneShotTimer<ClientSession> max_duration_timer_; |
180 | 180 |
181 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 181 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
182 }; | 182 }; |
183 | 183 |
184 } // namespace remoting | 184 } // namespace remoting |
185 | 185 |
186 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 186 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
OLD | NEW |