OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "remoting/protocol/connection_to_client.h" | 12 #include "remoting/protocol/connection_to_client.h" |
13 #include "remoting/protocol/host_stub.h" | 13 #include "remoting/protocol/host_stub.h" |
14 #include "remoting/protocol/input_stub.h" | 14 #include "remoting/protocol/input_stub.h" |
15 #include "ui/gfx/point.h" | 15 #include "third_party/skia/include/core/SkPoint.h" |
16 | 16 |
17 namespace remoting { | 17 namespace remoting { |
18 | 18 |
19 class Capturer; | 19 class Capturer; |
20 class UserAuthenticator; | 20 class UserAuthenticator; |
21 | 21 |
22 // A ClientSession keeps a reference to a connection to a client, and maintains | 22 // A ClientSession keeps a reference to a connection to a client, and maintains |
23 // per-client state. | 23 // per-client state. |
24 class ClientSession : public protocol::HostStub, | 24 class ClientSession : public protocol::HostStub, |
25 public protocol::InputStub, | 25 public protocol::InputStub, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 void set_awaiting_continue_approval(bool awaiting) { | 74 void set_awaiting_continue_approval(bool awaiting) { |
75 awaiting_continue_approval_ = awaiting; | 75 awaiting_continue_approval_ = awaiting; |
76 } | 76 } |
77 | 77 |
78 const std::string& client_jid() { return client_jid_; } | 78 const std::string& client_jid() { return client_jid_; } |
79 | 79 |
80 // Indicate that local mouse activity has been detected. This causes remote | 80 // Indicate that local mouse activity has been detected. This causes remote |
81 // inputs to be ignored for a short time so that the local user will always | 81 // inputs to be ignored for a short time so that the local user will always |
82 // have the upper hand in 'pointer wars'. | 82 // have the upper hand in 'pointer wars'. |
83 void LocalMouseMoved(const gfx::Point& new_pos); | 83 void LocalMouseMoved(const SkIPoint& new_pos); |
84 | 84 |
85 bool ShouldIgnoreRemoteMouseInput(const protocol::MouseEvent& event) const; | 85 bool ShouldIgnoreRemoteMouseInput(const protocol::MouseEvent& event) const; |
86 bool ShouldIgnoreRemoteKeyboardInput(const protocol::KeyEvent& event) const; | 86 bool ShouldIgnoreRemoteKeyboardInput(const protocol::KeyEvent& event) const; |
87 | 87 |
88 private: | 88 private: |
89 friend class base::RefCountedThreadSafe<ClientSession>; | 89 friend class base::RefCountedThreadSafe<ClientSession>; |
90 friend class ClientSessionTest_RestoreEventState_Test; | 90 friend class ClientSessionTest_RestoreEventState_Test; |
91 virtual ~ClientSession(); | 91 virtual ~ClientSession(); |
92 | 92 |
93 // Keep track of input state so that we can clean up the event queue when | 93 // Keep track of input state so that we can clean up the event queue when |
(...skipping 29 matching lines...) Expand all Loading... |
123 | 123 |
124 // Whether or not inputs from this client are blocked pending approval from | 124 // Whether or not inputs from this client are blocked pending approval from |
125 // the host user to continue the connection. | 125 // the host user to continue the connection. |
126 bool awaiting_continue_approval_; | 126 bool awaiting_continue_approval_; |
127 | 127 |
128 // State to control remote input blocking while the local pointer is in use. | 128 // State to control remote input blocking while the local pointer is in use. |
129 uint32 remote_mouse_button_state_; | 129 uint32 remote_mouse_button_state_; |
130 | 130 |
131 // Current location of the mouse pointer. This is used to provide appropriate | 131 // Current location of the mouse pointer. This is used to provide appropriate |
132 // coordinates when we release the mouse buttons after a user disconnects. | 132 // coordinates when we release the mouse buttons after a user disconnects. |
133 gfx::Point remote_mouse_pos_; | 133 SkIPoint remote_mouse_pos_; |
134 | 134 |
135 // Queue of recently-injected mouse positions. This is used to detect whether | 135 // Queue of recently-injected mouse positions. This is used to detect whether |
136 // mouse events from the local input monitor are echoes of injected positions, | 136 // mouse events from the local input monitor are echoes of injected positions, |
137 // or genuine mouse movements of a local input device. | 137 // or genuine mouse movements of a local input device. |
138 std::list<gfx::Point> injected_mouse_positions_; | 138 std::list<SkIPoint> injected_mouse_positions_; |
139 | 139 |
140 base::Time latest_local_input_time_; | 140 base::Time latest_local_input_time_; |
141 | 141 |
142 // Set of keys that are currently pressed down by the user. This is used so | 142 // Set of keys that are currently pressed down by the user. This is used so |
143 // we can release them if the user disconnects. | 143 // we can release them if the user disconnects. |
144 std::set<int> pressed_keys_; | 144 std::set<int> pressed_keys_; |
145 | 145 |
146 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 146 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
147 }; | 147 }; |
148 | 148 |
149 } // namespace remoting | 149 } // namespace remoting |
150 | 150 |
151 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 151 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
OLD | NEW |