Chromium Code Reviews| 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 #include <string> | |
| 10 | 11 |
| 11 #include "base/time.h" | 12 #include "base/time.h" |
| 12 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
| 13 #include "remoting/protocol/connection_to_client.h" | 14 #include "remoting/protocol/connection_to_client.h" |
| 14 #include "remoting/protocol/host_stub.h" | 15 #include "remoting/protocol/host_stub.h" |
| 15 #include "remoting/protocol/input_stub.h" | 16 #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 |
| 19 namespace net { | |
| 20 class IpEndPoint; | |
| 21 } // namespace net | |
| 22 | |
| 18 namespace remoting { | 23 namespace remoting { |
| 19 | 24 |
| 20 class Capturer; | 25 class Capturer; |
| 21 | 26 |
| 22 // 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 |
| 23 // per-client state. | 28 // per-client state. |
| 24 class ClientSession : public protocol::HostStub, | 29 class ClientSession : public protocol::HostStub, |
| 25 public protocol::InputStub, | 30 public protocol::InputStub, |
| 26 public protocol::ConnectionToClient::EventHandler, | 31 public protocol::ConnectionToClient::EventHandler, |
| 27 public base::NonThreadSafe { | 32 public base::NonThreadSafe { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 39 // returns. | 44 // returns. |
| 40 virtual void OnSessionAuthenticationFailed(ClientSession* client) = 0; | 45 virtual void OnSessionAuthenticationFailed(ClientSession* client) = 0; |
| 41 | 46 |
| 42 // Called after connection has failed or after the client closed it. | 47 // Called after connection has failed or after the client closed it. |
| 43 virtual void OnSessionClosed(ClientSession* client) = 0; | 48 virtual void OnSessionClosed(ClientSession* client) = 0; |
| 44 | 49 |
| 45 // Called to notify of each message's sequence number. The | 50 // Called to notify of each message's sequence number. The |
| 46 // callback must not tear down this object. | 51 // callback must not tear down this object. |
| 47 virtual void OnSessionSequenceNumber(ClientSession* client, | 52 virtual void OnSessionSequenceNumber(ClientSession* client, |
| 48 int64 sequence_number) = 0; | 53 int64 sequence_number) = 0; |
| 54 | |
| 55 // Called on notification of a route change event, when a channel is | |
| 56 // connected. | |
| 57 virtual void OnSessionIpEndPoint(ClientSession* client, | |
|
Sergey Ulanov
2012/01/25 01:56:48
OnSessionIpAddress?
Lambros
2012/01/25 19:27:10
Done.
| |
| 58 const std::string& channel_name, | |
| 59 const net::IPEndPoint& end_point) = 0; | |
| 49 }; | 60 }; |
| 50 | 61 |
| 51 // Takes ownership of |connection|. Does not take ownership of | 62 // Takes ownership of |connection|. Does not take ownership of |
| 52 // |event_handler|, |input_stub| or |capturer|. | 63 // |event_handler|, |input_stub| or |capturer|. |
| 53 ClientSession(EventHandler* event_handler, | 64 ClientSession(EventHandler* event_handler, |
| 54 protocol::ConnectionToClient* connection, | 65 protocol::ConnectionToClient* connection, |
| 55 protocol::InputStub* input_stub, | 66 protocol::InputStub* input_stub, |
| 56 Capturer* capturer); | 67 Capturer* capturer); |
| 57 virtual ~ClientSession(); | 68 virtual ~ClientSession(); |
| 58 | 69 |
| 59 // protocol::InputStub interface. | 70 // protocol::InputStub interface. |
| 60 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; | 71 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; |
| 61 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; | 72 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; |
| 62 | 73 |
| 63 // protocol::ConnectionToClient::EventHandler interface. | 74 // protocol::ConnectionToClient::EventHandler interface. |
| 64 virtual void OnConnectionOpened( | 75 virtual void OnConnectionOpened( |
| 65 protocol::ConnectionToClient* connection) OVERRIDE; | 76 protocol::ConnectionToClient* connection) OVERRIDE; |
| 66 virtual void OnConnectionClosed( | 77 virtual void OnConnectionClosed( |
| 67 protocol::ConnectionToClient* connection) OVERRIDE; | 78 protocol::ConnectionToClient* connection) OVERRIDE; |
| 68 virtual void OnConnectionFailed(protocol::ConnectionToClient* connection, | 79 virtual void OnConnectionFailed(protocol::ConnectionToClient* connection, |
| 69 protocol::Session::Error error) OVERRIDE; | 80 protocol::Session::Error error) OVERRIDE; |
| 70 virtual void OnSequenceNumberUpdated( | 81 virtual void OnSequenceNumberUpdated( |
| 71 protocol::ConnectionToClient* connection, int64 sequence_number) OVERRIDE; | 82 protocol::ConnectionToClient* connection, int64 sequence_number) OVERRIDE; |
| 83 virtual void OnClientIpEndPoint(protocol::ConnectionToClient* connection, | |
| 84 const std::string& channel_name, | |
| 85 const net::IPEndPoint& end_point) OVERRIDE; | |
| 72 | 86 |
| 73 // Disconnects the session and destroys the transport. Event handler | 87 // Disconnects the session and destroys the transport. Event handler |
| 74 // is guaranteed not to be called after this method is called. Can | 88 // is guaranteed not to be called after this method is called. Can |
| 75 // be called multiple times. The object should not be used after | 89 // be called multiple times. The object should not be used after |
| 76 // this method returns. | 90 // this method returns. |
| 77 void Disconnect(); | 91 void Disconnect(); |
| 78 | 92 |
| 79 protocol::ConnectionToClient* connection() const { | 93 protocol::ConnectionToClient* connection() const { |
| 80 return connection_.get(); | 94 return connection_.get(); |
| 81 } | 95 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 // Set of keys that are currently pressed down by the user. This is used so | 164 // Set of keys that are currently pressed down by the user. This is used so |
| 151 // we can release them if the user disconnects. | 165 // we can release them if the user disconnects. |
| 152 std::set<int> pressed_keys_; | 166 std::set<int> pressed_keys_; |
| 153 | 167 |
| 154 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 168 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
| 155 }; | 169 }; |
| 156 | 170 |
| 157 } // namespace remoting | 171 } // namespace remoting |
| 158 | 172 |
| 159 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 173 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
| OLD | NEW |