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/clipboard_stub.h" |
13 #include "remoting/protocol/connection_to_client.h" | 14 #include "remoting/protocol/connection_to_client.h" |
| 15 #include "remoting/protocol/host_event_stub.h" |
14 #include "remoting/protocol/host_stub.h" | 16 #include "remoting/protocol/host_stub.h" |
15 #include "remoting/protocol/input_stub.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::HostEventStub, |
25 public protocol::InputStub, | 26 public protocol::HostStub, |
26 public protocol::ConnectionToClient::EventHandler, | 27 public protocol::ConnectionToClient::EventHandler, |
27 public base::NonThreadSafe { | 28 public base::NonThreadSafe { |
28 public: | 29 public: |
29 // Callback interface for passing events to the ChromotingHost. | 30 // Callback interface for passing events to the ChromotingHost. |
30 class EventHandler { | 31 class EventHandler { |
31 public: | 32 public: |
32 virtual ~EventHandler() {} | 33 virtual ~EventHandler() {} |
33 | 34 |
34 // Called after authentication has finished successfully. | 35 // Called after authentication has finished successfully. |
35 virtual void OnSessionAuthenticated(ClientSession* client) = 0; | 36 virtual void OnSessionAuthenticated(ClientSession* client) = 0; |
(...skipping 14 matching lines...) Expand all Loading... |
50 // Called on notification of a route change event, when a channel is | 51 // Called on notification of a route change event, when a channel is |
51 // connected. | 52 // connected. |
52 virtual void OnSessionRouteChange( | 53 virtual void OnSessionRouteChange( |
53 ClientSession* client, | 54 ClientSession* client, |
54 const std::string& channel_name, | 55 const std::string& channel_name, |
55 const net::IPEndPoint& remote_end_point, | 56 const net::IPEndPoint& remote_end_point, |
56 const net::IPEndPoint& local_end_point) = 0; | 57 const net::IPEndPoint& local_end_point) = 0; |
57 }; | 58 }; |
58 | 59 |
59 // Takes ownership of |connection|. Does not take ownership of | 60 // Takes ownership of |connection|. Does not take ownership of |
60 // |event_handler|, |input_stub| or |capturer|. | 61 // |event_handler|, |host_event_stub|, or |capturer|. |
61 ClientSession(EventHandler* event_handler, | 62 ClientSession(EventHandler* event_handler, |
62 protocol::ConnectionToClient* connection, | 63 protocol::ConnectionToClient* connection, |
63 protocol::InputStub* input_stub, | 64 protocol::HostEventStub* host_event_stub, |
64 Capturer* capturer); | 65 Capturer* capturer); |
65 virtual ~ClientSession(); | 66 virtual ~ClientSession(); |
66 | 67 |
| 68 // protocol::ClipboardStub interface. |
| 69 virtual void InjectClipboardEvent( |
| 70 const protocol::ClipboardEvent& event) OVERRIDE; |
| 71 |
67 // protocol::InputStub interface. | 72 // protocol::InputStub interface. |
68 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; | 73 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; |
69 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; | 74 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; |
70 | 75 |
71 // protocol::ConnectionToClient::EventHandler interface. | 76 // protocol::ConnectionToClient::EventHandler interface. |
72 virtual void OnConnectionOpened( | 77 virtual void OnConnectionOpened( |
73 protocol::ConnectionToClient* connection) OVERRIDE; | 78 protocol::ConnectionToClient* connection) OVERRIDE; |
74 virtual void OnConnectionClosed( | 79 virtual void OnConnectionClosed( |
75 protocol::ConnectionToClient* connection) OVERRIDE; | 80 protocol::ConnectionToClient* connection) OVERRIDE; |
76 virtual void OnConnectionFailed(protocol::ConnectionToClient* connection, | 81 virtual void OnConnectionFailed(protocol::ConnectionToClient* connection, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // when the user disconnects. | 128 // when the user disconnects. |
124 void RestoreEventState(); | 129 void RestoreEventState(); |
125 | 130 |
126 EventHandler* event_handler_; | 131 EventHandler* event_handler_; |
127 | 132 |
128 // The connection to the client. | 133 // The connection to the client. |
129 scoped_ptr<protocol::ConnectionToClient> connection_; | 134 scoped_ptr<protocol::ConnectionToClient> connection_; |
130 | 135 |
131 std::string client_jid_; | 136 std::string client_jid_; |
132 | 137 |
133 // The input stub to which this object delegates. | 138 // The host event stub to which this object delegates. |
134 protocol::InputStub* input_stub_; | 139 protocol::HostEventStub* host_event_stub_; |
135 | 140 |
136 // Capturer, used to determine current screen size for ensuring injected | 141 // Capturer, used to determine current screen size for ensuring injected |
137 // mouse events fall within the screen area. | 142 // mouse events fall within the screen area. |
138 // TODO(lambroslambrou): Move floor-control logic, and clamping to screen | 143 // TODO(lambroslambrou): Move floor-control logic, and clamping to screen |
139 // area, out of this class (crbug.com/96508). | 144 // area, out of this class (crbug.com/96508). |
140 Capturer* capturer_; | 145 Capturer* capturer_; |
141 | 146 |
142 // Whether this client is authenticated. | 147 // Whether this client is authenticated. |
143 bool authenticated_; | 148 bool authenticated_; |
144 | 149 |
(...skipping 18 matching lines...) Expand all Loading... |
163 // Set of keys that are currently pressed down by the user. This is used so | 168 // Set of keys that are currently pressed down by the user. This is used so |
164 // we can release them if the user disconnects. | 169 // we can release them if the user disconnects. |
165 std::set<int> pressed_keys_; | 170 std::set<int> pressed_keys_; |
166 | 171 |
167 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 172 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
168 }; | 173 }; |
169 | 174 |
170 } // namespace remoting | 175 } // namespace remoting |
171 | 176 |
172 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 177 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
OLD | NEW |