| 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 18 matching lines...) Expand all Loading... |
| 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 { |
| 38 public: | 38 public: |
| 39 virtual ~EventHandler() {} | |
| 40 | |
| 41 // Called after authentication has finished successfully. | 39 // Called after authentication has finished successfully. |
| 42 virtual void OnSessionAuthenticated(ClientSession* client) = 0; | 40 virtual void OnSessionAuthenticated(ClientSession* client) = 0; |
| 43 | 41 |
| 44 // Called after we've finished connecting all channels. | 42 // Called after we've finished connecting all channels. |
| 45 virtual void OnSessionChannelsConnected(ClientSession* client) = 0; | 43 virtual void OnSessionChannelsConnected(ClientSession* client) = 0; |
| 46 | 44 |
| 47 // Called after authentication has failed. Must not tear down this | 45 // Called after authentication has failed. Must not tear down this |
| 48 // object. OnSessionClosed() is notified after this handler | 46 // object. OnSessionClosed() is notified after this handler |
| 49 // returns. | 47 // returns. |
| 50 virtual void OnSessionAuthenticationFailed(ClientSession* client) = 0; | 48 virtual void OnSessionAuthenticationFailed(ClientSession* client) = 0; |
| 51 | 49 |
| 52 // Called after connection has failed or after the client closed it. | 50 // Called after connection has failed or after the client closed it. |
| 53 virtual void OnSessionClosed(ClientSession* client) = 0; | 51 virtual void OnSessionClosed(ClientSession* client) = 0; |
| 54 | 52 |
| 55 // Called to notify of each message's sequence number. The | 53 // Called to notify of each message's sequence number. The |
| 56 // callback must not tear down this object. | 54 // callback must not tear down this object. |
| 57 virtual void OnSessionSequenceNumber(ClientSession* client, | 55 virtual void OnSessionSequenceNumber(ClientSession* client, |
| 58 int64 sequence_number) = 0; | 56 int64 sequence_number) = 0; |
| 59 | 57 |
| 60 // Called on notification of a route change event, when a channel is | 58 // Called on notification of a route change event, when a channel is |
| 61 // connected. | 59 // connected. |
| 62 virtual void OnSessionRouteChange( | 60 virtual void OnSessionRouteChange( |
| 63 ClientSession* client, | 61 ClientSession* client, |
| 64 const std::string& channel_name, | 62 const std::string& channel_name, |
| 65 const protocol::TransportRoute& route) = 0; | 63 const protocol::TransportRoute& route) = 0; |
| 64 |
| 65 protected: |
| 66 virtual ~EventHandler() {} |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 ClientSession(EventHandler* event_handler, | 69 ClientSession(EventHandler* event_handler, |
| 69 scoped_ptr<protocol::ConnectionToClient> connection, | 70 scoped_ptr<protocol::ConnectionToClient> connection, |
| 70 protocol::HostEventStub* host_event_stub, | 71 protocol::HostEventStub* host_event_stub, |
| 71 Capturer* capturer, | 72 Capturer* capturer, |
| 72 const base::TimeDelta& max_duration); | 73 const base::TimeDelta& max_duration); |
| 73 virtual ~ClientSession(); | 74 virtual ~ClientSession(); |
| 74 | 75 |
| 75 // protocol::ClipboardStub interface. | 76 // protocol::ClipboardStub interface. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // A timer that triggers a disconnect when the maximum session duration | 177 // A timer that triggers a disconnect when the maximum session duration |
| 177 // is reached. | 178 // is reached. |
| 178 base::OneShotTimer<ClientSession> max_duration_timer_; | 179 base::OneShotTimer<ClientSession> max_duration_timer_; |
| 179 | 180 |
| 180 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 181 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
| 181 }; | 182 }; |
| 182 | 183 |
| 183 } // namespace remoting | 184 } // namespace remoting |
| 184 | 185 |
| 185 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 186 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
| OLD | NEW |