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" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // A ClientSession keeps a reference to a connection to a client, and maintains | 27 // A ClientSession keeps a reference to a connection to a client, and maintains |
28 // per-client state. | 28 // per-client state. |
29 class ClientSession : public protocol::HostEventStub, | 29 class ClientSession : public protocol::HostEventStub, |
30 public protocol::HostStub, | 30 public protocol::HostStub, |
31 public protocol::ConnectionToClient::EventHandler, | 31 public protocol::ConnectionToClient::EventHandler, |
32 public base::NonThreadSafe { | 32 public base::NonThreadSafe { |
33 public: | 33 public: |
34 // Callback interface for passing events to the ChromotingHost. | 34 // Callback interface for passing events to the ChromotingHost. |
35 class EventHandler { | 35 class EventHandler { |
36 public: | 36 public: |
37 virtual ~EventHandler() {} | |
38 | |
39 // Called after authentication has finished successfully. | 37 // Called after authentication has finished successfully. |
40 virtual void OnSessionAuthenticated(ClientSession* client) = 0; | 38 virtual void OnSessionAuthenticated(ClientSession* client) = 0; |
41 | 39 |
42 // Called after we've finished connecting all channels. | 40 // Called after we've finished connecting all channels. |
43 virtual void OnSessionChannelsConnected(ClientSession* client) = 0; | 41 virtual void OnSessionChannelsConnected(ClientSession* client) = 0; |
44 | 42 |
45 // Called after authentication has failed. Must not tear down this | 43 // Called after authentication has failed. Must not tear down this |
46 // object. OnSessionClosed() is notified after this handler | 44 // object. OnSessionClosed() is notified after this handler |
47 // returns. | 45 // returns. |
48 virtual void OnSessionAuthenticationFailed(ClientSession* client) = 0; | 46 virtual void OnSessionAuthenticationFailed(ClientSession* client) = 0; |
49 | 47 |
50 // Called after connection has failed or after the client closed it. | 48 // Called after connection has failed or after the client closed it. |
51 virtual void OnSessionClosed(ClientSession* client) = 0; | 49 virtual void OnSessionClosed(ClientSession* client) = 0; |
52 | 50 |
53 // Called to notify of each message's sequence number. The | 51 // Called to notify of each message's sequence number. The |
54 // callback must not tear down this object. | 52 // callback must not tear down this object. |
55 virtual void OnSessionSequenceNumber(ClientSession* client, | 53 virtual void OnSessionSequenceNumber(ClientSession* client, |
56 int64 sequence_number) = 0; | 54 int64 sequence_number) = 0; |
57 | 55 |
58 // Called on notification of a route change event, when a channel is | 56 // Called on notification of a route change event, when a channel is |
59 // connected. | 57 // connected. |
60 virtual void OnSessionRouteChange( | 58 virtual void OnSessionRouteChange( |
61 ClientSession* client, | 59 ClientSession* client, |
62 const std::string& channel_name, | 60 const std::string& channel_name, |
63 const protocol::TransportRoute& route) = 0; | 61 const protocol::TransportRoute& route) = 0; |
| 62 |
| 63 protected: |
| 64 virtual ~EventHandler() {} |
64 }; | 65 }; |
65 | 66 |
66 ClientSession(EventHandler* event_handler, | 67 ClientSession(EventHandler* event_handler, |
67 scoped_ptr<protocol::ConnectionToClient> connection, | 68 scoped_ptr<protocol::ConnectionToClient> connection, |
68 protocol::HostEventStub* host_event_stub, | 69 protocol::HostEventStub* host_event_stub, |
69 Capturer* capturer); | 70 Capturer* capturer); |
70 virtual ~ClientSession(); | 71 virtual ~ClientSession(); |
71 | 72 |
72 // protocol::ClipboardStub interface. | 73 // protocol::ClipboardStub interface. |
73 virtual void InjectClipboardEvent( | 74 virtual void InjectClipboardEvent( |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // TODO(lambroslambrou): Move floor-control logic, and clamping to screen | 151 // TODO(lambroslambrou): Move floor-control logic, and clamping to screen |
151 // area, out of this class (crbug.com/96508). | 152 // area, out of this class (crbug.com/96508). |
152 Capturer* capturer_; | 153 Capturer* capturer_; |
153 | 154 |
154 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 155 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
155 }; | 156 }; |
156 | 157 |
157 } // namespace remoting | 158 } // namespace remoting |
158 | 159 |
159 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 160 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
OLD | NEW |