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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 // Called when the network connection is authenticated and all | 46 // Called when the network connection is authenticated and all |
47 // channels are connected. | 47 // channels are connected. |
48 virtual void OnConnectionChannelsConnected( | 48 virtual void OnConnectionChannelsConnected( |
49 ConnectionToClient* connection) = 0; | 49 ConnectionToClient* connection) = 0; |
50 | 50 |
51 // Called when the network connection is closed or failed. | 51 // Called when the network connection is closed or failed. |
52 virtual void OnConnectionClosed(ConnectionToClient* connection, | 52 virtual void OnConnectionClosed(ConnectionToClient* connection, |
53 ErrorCode error) = 0; | 53 ErrorCode error) = 0; |
54 | 54 |
55 // Called when sequence number is updated. | 55 // Called when a new input event is received. |
56 virtual void OnEventTimestamp(ConnectionToClient* connection, | 56 virtual void OnInputEventReceived(ConnectionToClient* connection, |
57 int64 timestamp) = 0; | 57 int64_t timestamp) = 0; |
58 | 58 |
59 // Called on notification of a route change event, which happens when a | 59 // Called on notification of a route change event, which happens when a |
60 // channel is connected. | 60 // channel is connected. |
61 virtual void OnRouteChange(ConnectionToClient* connection, | 61 virtual void OnRouteChange(ConnectionToClient* connection, |
62 const std::string& channel_name, | 62 const std::string& channel_name, |
63 const TransportRoute& route) = 0; | 63 const TransportRoute& route) = 0; |
64 | 64 |
65 protected: | 65 protected: |
66 virtual ~EventHandler() {} | 66 virtual ~EventHandler() {} |
67 }; | 67 }; |
68 | 68 |
69 // Constructs a ConnectionToClient object for the |session|. Takes | 69 // Constructs a ConnectionToClient object for the |session|. Takes |
70 // ownership of |session|. | 70 // ownership of |session|. |
71 explicit ConnectionToClient(Session* session); | 71 explicit ConnectionToClient(Session* session); |
72 ~ConnectionToClient() override; | 72 ~ConnectionToClient() override; |
73 | 73 |
74 // Set |event_handler| for connection events. Must be called once when this | 74 // Set |event_handler| for connection events. Must be called once when this |
75 // object is created. | 75 // object is created. |
76 void SetEventHandler(EventHandler* event_handler); | 76 void SetEventHandler(EventHandler* event_handler); |
77 | 77 |
78 // Returns the connection in use. | 78 // Returns the connection in use. |
79 virtual Session* session(); | 79 virtual Session* session(); |
80 | 80 |
81 // Disconnect the client connection. | 81 // Disconnect the client connection. |
82 virtual void Disconnect(); | 82 virtual void Disconnect(); |
83 | 83 |
84 // Callback for HostEventDispatcher to be called with a timestamp for each | 84 // Callback for HostEventDispatcher to be called with a timestamp for each |
85 // received event. | 85 // received event. |
86 virtual void OnEventTimestamp(int64 timestamp); | 86 virtual void OnInputEventReceived(int64_t timestamp); |
87 | 87 |
88 // Get the stubs used by the host to transmit messages to the client. | 88 // Get the stubs used by the host to transmit messages to the client. |
89 // The stubs must not be accessed before OnConnectionAuthenticated(), or | 89 // The stubs must not be accessed before OnConnectionAuthenticated(), or |
90 // after OnConnectionClosed(). | 90 // after OnConnectionClosed(). |
91 // Note that the audio stub will be nullptr if audio is not enabled. | 91 // Note that the audio stub will be nullptr if audio is not enabled. |
92 virtual VideoStub* video_stub(); | 92 virtual VideoStub* video_stub(); |
93 virtual AudioStub* audio_stub(); | 93 virtual AudioStub* audio_stub(); |
94 virtual ClientStub* client_stub(); | 94 virtual ClientStub* client_stub(); |
95 | 95 |
96 // Set the stubs which will handle messages we receive from the client. These | 96 // Set the stubs which will handle messages we receive from the client. These |
(...skipping 35 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 |