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 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
13 #include "remoting/protocol/connection_to_client.h" | 13 #include "remoting/protocol/connection_to_client.h" |
14 #include "remoting/protocol/host_stub.h" | 14 #include "remoting/protocol/host_stub.h" |
15 #include "remoting/protocol/input_stub.h" | 15 #include "remoting/protocol/input_stub.h" |
| 16 #include "remoting/protocol/key_event_tracker.h" |
16 #include "third_party/skia/include/core/SkPoint.h" | 17 #include "third_party/skia/include/core/SkPoint.h" |
17 | 18 |
18 namespace remoting { | 19 namespace remoting { |
19 | 20 |
20 class Capturer; | 21 class Capturer; |
21 | 22 |
22 // A ClientSession keeps a reference to a connection to a client, and maintains | 23 // A ClientSession keeps a reference to a connection to a client, and maintains |
23 // per-client state. | 24 // per-client state. |
24 class ClientSession : public protocol::HostStub, | 25 class ClientSession : public protocol::HostStub, |
25 public protocol::InputStub, | 26 public protocol::InputStub, |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // when the user disconnects. | 124 // when the user disconnects. |
124 void RestoreEventState(); | 125 void RestoreEventState(); |
125 | 126 |
126 EventHandler* event_handler_; | 127 EventHandler* event_handler_; |
127 | 128 |
128 // The connection to the client. | 129 // The connection to the client. |
129 scoped_ptr<protocol::ConnectionToClient> connection_; | 130 scoped_ptr<protocol::ConnectionToClient> connection_; |
130 | 131 |
131 std::string client_jid_; | 132 std::string client_jid_; |
132 | 133 |
133 // The input stub to which this object delegates. | 134 // Key event tracker to allow us to release all pressed keys on disconnect. |
134 protocol::InputStub* input_stub_; | 135 protocol::KeyEventTracker key_tracker_; |
135 | 136 |
136 // Capturer, used to determine current screen size for ensuring injected | 137 // Capturer, used to determine current screen size for ensuring injected |
137 // mouse events fall within the screen area. | 138 // mouse events fall within the screen area. |
138 // TODO(lambroslambrou): Move floor-control logic, and clamping to screen | 139 // TODO(lambroslambrou): Move floor-control logic, and clamping to screen |
139 // area, out of this class (crbug.com/96508). | 140 // area, out of this class (crbug.com/96508). |
140 Capturer* capturer_; | 141 Capturer* capturer_; |
141 | 142 |
142 // Whether this client is authenticated. | 143 // Whether this client is authenticated. |
143 bool authenticated_; | 144 bool authenticated_; |
144 | 145 |
145 // Whether or not inputs from this client are blocked pending approval from | 146 // Whether or not inputs from this client are blocked pending approval from |
146 // the host user to continue the connection. | 147 // the host user to continue the connection. |
147 bool awaiting_continue_approval_; | 148 bool awaiting_continue_approval_; |
148 | 149 |
149 // State to control remote input blocking while the local pointer is in use. | 150 // State to control remote input blocking while the local pointer is in use. |
150 uint32 remote_mouse_button_state_; | 151 uint32 remote_mouse_button_state_; |
151 | 152 |
152 // Current location of the mouse pointer. This is used to provide appropriate | 153 // Current location of the mouse pointer. This is used to provide appropriate |
153 // coordinates when we release the mouse buttons after a user disconnects. | 154 // coordinates when we release the mouse buttons after a user disconnects. |
154 SkIPoint remote_mouse_pos_; | 155 SkIPoint remote_mouse_pos_; |
155 | 156 |
156 // Queue of recently-injected mouse positions. This is used to detect whether | 157 // Queue of recently-injected mouse positions. This is used to detect whether |
157 // mouse events from the local input monitor are echoes of injected positions, | 158 // mouse events from the local input monitor are echoes of injected positions, |
158 // or genuine mouse movements of a local input device. | 159 // or genuine mouse movements of a local input device. |
159 std::list<SkIPoint> injected_mouse_positions_; | 160 std::list<SkIPoint> injected_mouse_positions_; |
160 | 161 |
161 base::Time latest_local_input_time_; | 162 base::Time latest_local_input_time_; |
162 | 163 |
163 // Set of keys that are currently pressed down by the user. This is used so | |
164 // we can release them if the user disconnects. | |
165 std::set<int> pressed_keys_; | |
166 | |
167 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 164 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
168 }; | 165 }; |
169 | 166 |
170 } // namespace remoting | 167 } // namespace remoting |
171 | 168 |
172 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 169 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
OLD | NEW |