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_HOST_H_ | 5 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/weak_ptr.h" |
12 #include "remoting/protocol/errors.h" | 13 #include "remoting/protocol/errors.h" |
13 | 14 |
| 15 namespace base { |
| 16 class SingleThreadTaskRunner; |
| 17 } // namespace base |
| 18 |
14 namespace remoting { | 19 namespace remoting { |
15 namespace protocol { | 20 namespace protocol { |
16 | 21 |
17 class AudioStub; | 22 class AudioStub; |
18 class Authenticator; | 23 class Authenticator; |
19 class ClientStub; | 24 class ClientStub; |
20 class ClipboardStub; | 25 class ClipboardStub; |
21 class HostStub; | 26 class HostStub; |
22 class InputStub; | 27 class InputStub; |
23 class Session; | 28 class Session; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 69 |
65 virtual ~ConnectionToHost() {} | 70 virtual ~ConnectionToHost() {} |
66 | 71 |
67 // Set the stubs which will handle messages from the host. | 72 // Set the stubs which will handle messages from the host. |
68 // The caller must ensure that stubs out-live the connection. | 73 // The caller must ensure that stubs out-live the connection. |
69 // Unless otherwise specified, all stubs must be set before Connect() | 74 // Unless otherwise specified, all stubs must be set before Connect() |
70 // is called. | 75 // is called. |
71 virtual void set_client_stub(ClientStub* client_stub) = 0; | 76 virtual void set_client_stub(ClientStub* client_stub) = 0; |
72 virtual void set_clipboard_stub(ClipboardStub* clipboard_stub) = 0; | 77 virtual void set_clipboard_stub(ClipboardStub* clipboard_stub) = 0; |
73 virtual void set_video_renderer(VideoRenderer* video_renderer) = 0; | 78 virtual void set_video_renderer(VideoRenderer* video_renderer) = 0; |
74 // If no audio stub is specified then audio will not be requested. | 79 |
75 virtual void set_audio_stub(AudioStub* audio_stub) = 0; | 80 // Initializes audio stream. Must be called before Connect(). |
| 81 // |audio_decode_task_runner| will be used for audio decoding. |audio_stub| |
| 82 // will be called on the main thread. |
| 83 virtual void InitializeAudio( |
| 84 scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner, |
| 85 base::WeakPtr<AudioStub> audio_stub) = 0; |
76 | 86 |
77 // Initiates a connection using |session|. |event_callback| will be notified | 87 // Initiates a connection using |session|. |event_callback| will be notified |
78 // of changes in the state of the connection and must outlive the | 88 // of changes in the state of the connection and must outlive the |
79 // ConnectionToHost. Caller must set stubs (see below) before calling Connect. | 89 // ConnectionToHost. Caller must set stubs (see below) before calling Connect. |
80 virtual void Connect(std::unique_ptr<Session> session, | 90 virtual void Connect(std::unique_ptr<Session> session, |
81 scoped_refptr<TransportContext> transport_context, | 91 scoped_refptr<TransportContext> transport_context, |
82 HostEventCallback* event_callback) = 0; | 92 HostEventCallback* event_callback) = 0; |
83 | 93 |
84 // Returns the session configuration that was negotiated with the host. | 94 // Returns the session configuration that was negotiated with the host. |
85 virtual const SessionConfig& config() = 0; | 95 virtual const SessionConfig& config() = 0; |
86 | 96 |
87 // Stubs for sending data to the host. | 97 // Stubs for sending data to the host. |
88 virtual ClipboardStub* clipboard_forwarder() = 0; | 98 virtual ClipboardStub* clipboard_forwarder() = 0; |
89 virtual HostStub* host_stub() = 0; | 99 virtual HostStub* host_stub() = 0; |
90 virtual InputStub* input_stub() = 0; | 100 virtual InputStub* input_stub() = 0; |
91 | 101 |
92 // Return the current state of ConnectionToHost. | 102 // Return the current state of ConnectionToHost. |
93 virtual State state() const = 0; | 103 virtual State state() const = 0; |
94 }; | 104 }; |
95 | 105 |
96 } // namespace protocol | 106 } // namespace protocol |
97 } // namespace remoting | 107 } // namespace remoting |
98 | 108 |
99 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 109 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
OLD | NEW |