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_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 <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 virtual void OnConnectionClosed(ConnectionToClient* connection) = 0; | 46 virtual void OnConnectionClosed(ConnectionToClient* connection) = 0; |
47 | 47 |
48 // Called when the network connection has failed. | 48 // Called when the network connection has failed. |
49 virtual void OnConnectionFailed(ConnectionToClient* connection) = 0; | 49 virtual void OnConnectionFailed(ConnectionToClient* connection) = 0; |
50 | 50 |
51 // Called when sequence number is updated. | 51 // Called when sequence number is updated. |
52 virtual void OnSequenceNumberUpdated(ConnectionToClient* connection, | 52 virtual void OnSequenceNumberUpdated(ConnectionToClient* connection, |
53 int64 sequence_number) = 0; | 53 int64 sequence_number) = 0; |
54 }; | 54 }; |
55 | 55 |
56 // Constructs a ConnectionToClient object. |message_loop| is the message loop | 56 // Constructs a ConnectionToClient object for the |
57 // that this object runs on. A viewer object receives events and messages from | 57 // |session|. |message_loop| is the message loop that this object |
58 // a libjingle channel, these events are delegated to |handler|. | 58 // runs on. |
59 // It is guaranteed that |handler| is called only on the |message_loop|. | 59 ConnectionToClient(base::MessageLoopProxy* message_loop, Session* session); |
60 ConnectionToClient(base::MessageLoopProxy* message_loop, | |
61 EventHandler* handler); | |
62 | 60 |
63 virtual void Init(Session* session); | 61 // Set |event_handler| for connection events. |event_handler| is |
| 62 // guaranteed to be used only on the network thread. Must be called |
| 63 // once when this object is created. |
| 64 void SetEventHandler(EventHandler* event_handler); |
64 | 65 |
65 // Returns the connection in use. | 66 // Returns the connection in use. |
66 virtual Session* session(); | 67 virtual Session* session(); |
67 | 68 |
68 // Disconnect the client connection. This method is allowed to be called | 69 // Disconnect the client connection. This method is allowed to be called |
69 // more than once and calls after the first one will be ignored. | 70 // more than once and calls after the first one will be ignored. |
70 // | 71 // |
71 // After this method is called all the send method calls will be ignored. | 72 // After this method is called all the send method calls will be ignored. |
72 virtual void Disconnect(); | 73 virtual void Disconnect(); |
73 | 74 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 bool input_connected_; | 129 bool input_connected_; |
129 bool video_connected_; | 130 bool video_connected_; |
130 | 131 |
131 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); | 132 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); |
132 }; | 133 }; |
133 | 134 |
134 } // namespace protocol | 135 } // namespace protocol |
135 } // namespace remoting | 136 } // namespace remoting |
136 | 137 |
137 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 138 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
OLD | NEW |