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 <string> | 8 #include <string> |
9 | 9 |
10 #include "remoting/protocol/transport.h" | 10 #include "remoting/protocol/transport.h" |
11 | 11 |
| 12 namespace webrtc { |
| 13 class DesktopCapturer; |
| 14 } // namespace webrtc |
| 15 |
12 namespace remoting { | 16 namespace remoting { |
| 17 |
| 18 class VideoEncoder; |
| 19 |
13 namespace protocol { | 20 namespace protocol { |
14 | 21 |
15 class AudioStub; | 22 class AudioStub; |
16 class ClientStub; | 23 class ClientStub; |
17 class ClipboardStub; | 24 class ClipboardStub; |
18 class HostStub; | 25 class HostStub; |
19 class InputStub; | 26 class InputStub; |
20 class Session; | 27 class Session; |
21 class VideoFeedbackStub; | 28 class VideoStream; |
22 class VideoStub; | |
23 | 29 |
24 // This interface represents a remote viewer connection to the chromoting host. | 30 // This interface represents a remote viewer connection to the chromoting host. |
25 // It sets up all protocol channels and connects them to the stubs. | 31 // It sets up all protocol channels and connects them to the stubs. |
26 class ConnectionToClient { | 32 class ConnectionToClient { |
27 public: | 33 public: |
28 class EventHandler { | 34 class EventHandler { |
29 public: | 35 public: |
30 // Called when the network connection is authenticating | 36 // Called when the network connection is authenticating |
31 virtual void OnConnectionAuthenticating(ConnectionToClient* connection) = 0; | 37 virtual void OnConnectionAuthenticating(ConnectionToClient* connection) = 0; |
32 | 38 |
33 // Called when the network connection is authenticated. | 39 // Called when the network connection is authenticated. |
34 virtual void OnConnectionAuthenticated(ConnectionToClient* connection) = 0; | 40 virtual void OnConnectionAuthenticated(ConnectionToClient* connection) = 0; |
35 | 41 |
36 // Called when the network connection is authenticated and all | 42 // Called when the network connection is authenticated and all |
37 // channels are connected. | 43 // channels are connected. |
38 virtual void OnConnectionChannelsConnected( | 44 virtual void OnConnectionChannelsConnected( |
39 ConnectionToClient* connection) = 0; | 45 ConnectionToClient* connection) = 0; |
40 | 46 |
| 47 // Called when a VideoEncoder is created. Used by ClientSession to modify |
| 48 // the video pipeline if necessary. |
| 49 virtual void OnCreateVideoEncoder(scoped_ptr<VideoEncoder>* encoder) = 0; |
| 50 |
41 // Called when the network connection is closed or failed. | 51 // Called when the network connection is closed or failed. |
42 virtual void OnConnectionClosed(ConnectionToClient* connection, | 52 virtual void OnConnectionClosed(ConnectionToClient* connection, |
43 ErrorCode error) = 0; | 53 ErrorCode error) = 0; |
44 | 54 |
45 // Called when a new input event is received. | 55 // Called when a new input event is received. |
46 virtual void OnInputEventReceived(ConnectionToClient* connection, | 56 virtual void OnInputEventReceived(ConnectionToClient* connection, |
47 int64_t timestamp) = 0; | 57 int64_t timestamp) = 0; |
48 | 58 |
49 // 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 |
50 // channel is connected. | 60 // channel is connected. |
(...skipping 16 matching lines...) Expand all Loading... |
67 // TODO(sergeyu): Remove this method. | 77 // TODO(sergeyu): Remove this method. |
68 virtual Session* session() = 0; | 78 virtual Session* session() = 0; |
69 | 79 |
70 // Disconnect the client connection. | 80 // Disconnect the client connection. |
71 virtual void Disconnect(ErrorCode error) = 0; | 81 virtual void Disconnect(ErrorCode error) = 0; |
72 | 82 |
73 // Callback for HostEventDispatcher to be called with a timestamp for each | 83 // Callback for HostEventDispatcher to be called with a timestamp for each |
74 // received event. | 84 // received event. |
75 virtual void OnInputEventReceived(int64_t timestamp) = 0; | 85 virtual void OnInputEventReceived(int64_t timestamp) = 0; |
76 | 86 |
| 87 // Start video stream that sends screen content from |desktop_capturer| to the |
| 88 // client. |
| 89 virtual scoped_ptr<VideoStream> StartVideoStream( |
| 90 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) = 0; |
| 91 |
77 // Get the stubs used by the host to transmit messages to the client. | 92 // Get the stubs used by the host to transmit messages to the client. |
78 // The stubs must not be accessed before OnConnectionAuthenticated(), or | 93 // The stubs must not be accessed before OnConnectionAuthenticated(), or |
79 // after OnConnectionClosed(). | 94 // after OnConnectionClosed(). |
80 // Note that the audio stub will be nullptr if audio is not enabled. | 95 // Note that the audio stub will be nullptr if audio is not enabled. |
81 virtual VideoStub* video_stub() = 0; | |
82 virtual AudioStub* audio_stub() = 0; | 96 virtual AudioStub* audio_stub() = 0; |
83 virtual ClientStub* client_stub() = 0; | 97 virtual ClientStub* client_stub() = 0; |
84 | 98 |
85 // Set the stubs which will handle messages we receive from the client. These | 99 // Set the stubs which will handle messages we receive from the client. These |
86 // must be called in EventHandler::OnConnectionAuthenticated(). | 100 // must be called in EventHandler::OnConnectionAuthenticated(). |
87 virtual void set_clipboard_stub(ClipboardStub* clipboard_stub) = 0; | 101 virtual void set_clipboard_stub(ClipboardStub* clipboard_stub) = 0; |
88 virtual void set_host_stub(HostStub* host_stub) = 0; | 102 virtual void set_host_stub(HostStub* host_stub) = 0; |
89 virtual void set_input_stub(InputStub* input_stub) = 0; | 103 virtual void set_input_stub(InputStub* input_stub) = 0; |
90 | |
91 // Sets video feedback stub. Can be called at any time after connection is | |
92 // authenticated. | |
93 virtual void set_video_feedback_stub( | |
94 VideoFeedbackStub* video_feedback_stub) = 0; | |
95 }; | 104 }; |
96 | 105 |
97 } // namespace protocol | 106 } // namespace protocol |
98 } // namespace remoting | 107 } // namespace remoting |
99 | 108 |
100 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 109 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
OLD | NEW |