| 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_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 5 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
| 6 #define REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 6 #define REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // Called when the network connection is authenticated and all | 44 // Called when the network connection is authenticated and all |
| 45 // channels are connected. | 45 // channels are connected. |
| 46 virtual void OnConnectionChannelsConnected( | 46 virtual void OnConnectionChannelsConnected( |
| 47 ConnectionToClient* connection) = 0; | 47 ConnectionToClient* connection) = 0; |
| 48 | 48 |
| 49 // Called when the network connection is closed or failed. | 49 // Called when the network connection is closed or failed. |
| 50 virtual void OnConnectionClosed(ConnectionToClient* connection, | 50 virtual void OnConnectionClosed(ConnectionToClient* connection, |
| 51 ErrorCode error) = 0; | 51 ErrorCode error) = 0; |
| 52 | 52 |
| 53 // Called when sequence number is updated. | 53 // Called when sequence number is updated. |
| 54 virtual void OnSequenceNumberUpdated(ConnectionToClient* connection, | 54 virtual void OnEventTimestamp(ConnectionToClient* connection, |
| 55 int64 sequence_number) = 0; | 55 int64 timestamp) = 0; |
| 56 | 56 |
| 57 // Called on notification of a route change event, which happens when a | 57 // Called on notification of a route change event, which happens when a |
| 58 // channel is connected. | 58 // channel is connected. |
| 59 virtual void OnRouteChange(ConnectionToClient* connection, | 59 virtual void OnRouteChange(ConnectionToClient* connection, |
| 60 const std::string& channel_name, | 60 const std::string& channel_name, |
| 61 const TransportRoute& route) = 0; | 61 const TransportRoute& route) = 0; |
| 62 | 62 |
| 63 protected: | 63 protected: |
| 64 virtual ~EventHandler() {} | 64 virtual ~EventHandler() {} |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 // Constructs a ConnectionToClient object for the |session|. Takes | 67 // Constructs a ConnectionToClient object for the |session|. Takes |
| 68 // ownership of |session|. | 68 // ownership of |session|. |
| 69 explicit ConnectionToClient(Session* session); | 69 explicit ConnectionToClient(Session* session); |
| 70 ~ConnectionToClient() override; | 70 ~ConnectionToClient() override; |
| 71 | 71 |
| 72 // Set |event_handler| for connection events. Must be called once when this | 72 // Set |event_handler| for connection events. Must be called once when this |
| 73 // object is created. | 73 // object is created. |
| 74 void SetEventHandler(EventHandler* event_handler); | 74 void SetEventHandler(EventHandler* event_handler); |
| 75 | 75 |
| 76 // Returns the connection in use. | 76 // Returns the connection in use. |
| 77 virtual Session* session(); | 77 virtual Session* session(); |
| 78 | 78 |
| 79 // Disconnect the client connection. | 79 // Disconnect the client connection. |
| 80 virtual void Disconnect(); | 80 virtual void Disconnect(); |
| 81 | 81 |
| 82 // Update the sequence number when received from the client. EventHandler | 82 // Callback for HostEventDispatcher to be called with a timestamp for each |
| 83 // will be called. | 83 // received event. |
| 84 virtual void UpdateSequenceNumber(int64 sequence_number); | 84 virtual void OnEventTimestamp(int64 timestamp); |
| 85 | 85 |
| 86 // Get the stubs used by the host to transmit messages to the client. | 86 // Get the stubs used by the host to transmit messages to the client. |
| 87 // The stubs must not be accessed before OnConnectionAuthenticated(), or | 87 // The stubs must not be accessed before OnConnectionAuthenticated(), or |
| 88 // after OnConnectionClosed(). | 88 // after OnConnectionClosed(). |
| 89 // Note that the audio stub will be NULL if audio is not enabled. | 89 // Note that the audio stub will be NULL if audio is not enabled. |
| 90 virtual VideoStub* video_stub(); | 90 virtual VideoStub* video_stub(); |
| 91 virtual AudioStub* audio_stub(); | 91 virtual AudioStub* audio_stub(); |
| 92 virtual ClientStub* client_stub(); | 92 virtual ClientStub* client_stub(); |
| 93 | 93 |
| 94 // Set/get the stubs which will handle messages we receive from the client. | 94 // Set/get the stubs which will handle messages we receive from the client. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 scoped_ptr<HostVideoDispatcher> video_dispatcher_; | 132 scoped_ptr<HostVideoDispatcher> video_dispatcher_; |
| 133 scoped_ptr<AudioWriter> audio_writer_; | 133 scoped_ptr<AudioWriter> audio_writer_; |
| 134 | 134 |
| 135 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); | 135 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 } // namespace protocol | 138 } // namespace protocol |
| 139 } // namespace remoting | 139 } // namespace remoting |
| 140 | 140 |
| 141 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 141 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
| OLD | NEW |