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 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 class ClientSession : public protocol::HostStub, | 24 class ClientSession : public protocol::HostStub, |
| 25 public protocol::InputStub, | 25 public protocol::InputStub, |
| 26 public protocol::ConnectionToClient::EventHandler, | 26 public protocol::ConnectionToClient::EventHandler, |
| 27 public base::NonThreadSafe { | 27 public base::NonThreadSafe { |
| 28 public: | 28 public: |
| 29 // Callback interface for passing events to the ChromotingHost. | 29 // Callback interface for passing events to the ChromotingHost. |
| 30 class EventHandler { | 30 class EventHandler { |
| 31 public: | 31 public: |
| 32 virtual ~EventHandler() {} | 32 virtual ~EventHandler() {} |
| 33 | 33 |
| 34 // Called after authentication has finished successfully. | |
| 34 virtual void OnSessionAuthenticated(ClientSession* client) = 0; | 35 virtual void OnSessionAuthenticated(ClientSession* client) = 0; |
| 36 | |
| 37 // Called after authentication has failed. Must not tear down this | |
| 38 // object. Separate OnSessionClosed() is made after this handler | |
|
Wez
2011/11/29 05:58:47
nit: Separate OnSessionClosed() is made ... -> OnS
Sergey Ulanov
2011/11/29 18:52:01
Done.
| |
| 39 // returns. | |
| 40 virtual void OnSessionAuthenticationFailed(ClientSession* client) = 0; | |
| 41 | |
| 42 // Called if connection has failed or after the client closed it. | |
|
Wez
2011/11/29 05:58:47
nit: if -> after?
Sergey Ulanov
2011/11/29 18:52:01
Done.
| |
| 35 virtual void OnSessionClosed(ClientSession* client) = 0; | 43 virtual void OnSessionClosed(ClientSession* client) = 0; |
| 44 | |
| 45 // Called for to notify of each message's sequence number. The | |
|
Wez
2011/11/29 05:58:47
nit: for to notify of each message's ... -> to not
Sergey Ulanov
2011/11/29 18:52:01
Done.
| |
| 46 // callback cannot tear down this object. | |
|
Wez
2011/11/29 05:58:47
nit: cannot -> must not
Sergey Ulanov
2011/11/29 18:52:01
Done.
| |
| 36 virtual void OnSessionSequenceNumber(ClientSession* client, | 47 virtual void OnSessionSequenceNumber(ClientSession* client, |
| 37 int64 sequence_number) = 0; | 48 int64 sequence_number) = 0; |
| 38 }; | 49 }; |
| 39 | 50 |
| 40 // Takes ownership of |connection|. Does not take ownership of | 51 // Takes ownership of |connection|. Does not take ownership of |
| 41 // |event_handler|, |input_stub| or |capturer|. | 52 // |event_handler|, |input_stub| or |capturer|. |
| 42 ClientSession(EventHandler* event_handler, | 53 ClientSession(EventHandler* event_handler, |
| 43 protocol::ConnectionToClient* connection, | 54 protocol::ConnectionToClient* connection, |
| 44 protocol::InputStub* input_stub, | 55 protocol::InputStub* input_stub, |
| 45 Capturer* capturer); | 56 Capturer* capturer); |
| 46 virtual ~ClientSession(); | 57 virtual ~ClientSession(); |
| 47 | 58 |
| 48 // protocol::InputStub interface. | 59 // protocol::InputStub interface. |
| 49 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; | 60 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; |
| 50 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; | 61 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; |
| 51 | 62 |
| 52 // protocol::ConnectionToClient::EventHandler interface. | 63 // protocol::ConnectionToClient::EventHandler interface. |
| 53 virtual void OnConnectionOpened( | 64 virtual void OnConnectionOpened( |
| 54 protocol::ConnectionToClient* connection) OVERRIDE; | 65 protocol::ConnectionToClient* connection) OVERRIDE; |
| 55 virtual void OnConnectionClosed( | 66 virtual void OnConnectionClosed( |
| 56 protocol::ConnectionToClient* connection) OVERRIDE; | 67 protocol::ConnectionToClient* connection) OVERRIDE; |
| 57 virtual void OnConnectionFailed( | 68 virtual void OnConnectionFailed(protocol::ConnectionToClient* connection, |
| 58 protocol::ConnectionToClient* connection) OVERRIDE; | 69 protocol::Session::Error error) OVERRIDE; |
| 59 virtual void OnSequenceNumberUpdated( | 70 virtual void OnSequenceNumberUpdated( |
| 60 protocol::ConnectionToClient* connection, int64 sequence_number) OVERRIDE; | 71 protocol::ConnectionToClient* connection, int64 sequence_number) OVERRIDE; |
| 61 | 72 |
| 62 // Disconnects the session and destroys the transport. Event handler | 73 // Disconnects the session and destroys the transport. Event handler |
| 63 // is guaranteed not to be called after this method is called. Can | 74 // is guaranteed not to be called after this method is called. Can |
| 64 // be called multiple times. The object should not be used after | 75 // be called multiple times. The object should not be used after |
| 65 // this method returns. | 76 // this method returns. |
| 66 void Disconnect(); | 77 void Disconnect(); |
| 67 | 78 |
| 68 protocol::ConnectionToClient* connection() const { | 79 protocol::ConnectionToClient* connection() const { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 // Set of keys that are currently pressed down by the user. This is used so | 150 // Set of keys that are currently pressed down by the user. This is used so |
| 140 // we can release them if the user disconnects. | 151 // we can release them if the user disconnects. |
| 141 std::set<int> pressed_keys_; | 152 std::set<int> pressed_keys_; |
| 142 | 153 |
| 143 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 154 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
| 144 }; | 155 }; |
| 145 | 156 |
| 146 } // namespace remoting | 157 } // namespace remoting |
| 147 | 158 |
| 148 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 159 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
| OLD | NEW |