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 // ChromotingClient is the controller for the Client implementation. | 5 // ChromotingClient is the controller for the Client implementation. |
6 | 6 |
7 #ifndef REMOTING_CLIENT_CHROMOTING_CLIENT_H_ | 7 #ifndef REMOTING_CLIENT_CHROMOTING_CLIENT_H_ |
8 #define REMOTING_CLIENT_CHROMOTING_CLIENT_H_ | 8 #define REMOTING_CLIENT_CHROMOTING_CLIENT_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 namespace remoting { | 31 namespace remoting { |
32 | 32 |
33 namespace protocol { | 33 namespace protocol { |
34 class CandidateSessionConfig; | 34 class CandidateSessionConfig; |
35 class SessionManager; | 35 class SessionManager; |
36 class TransportContext; | 36 class TransportContext; |
37 class VideoRenderer; | 37 class VideoRenderer; |
38 } // namespace protocol | 38 } // namespace protocol |
39 | 39 |
40 class AudioConsumer; | |
41 class AudioDecodeScheduler; | 40 class AudioDecodeScheduler; |
42 class ClientContext; | 41 class ClientContext; |
43 class ClientUserInterface; | 42 class ClientUserInterface; |
44 class FrameConsumerProxy; | 43 class FrameConsumerProxy; |
45 | 44 |
46 class ChromotingClient : public SignalStrategy::Listener, | 45 class ChromotingClient : public SignalStrategy::Listener, |
47 public protocol::ConnectionToHost::HostEventCallback, | 46 public protocol::ConnectionToHost::HostEventCallback, |
48 public protocol::ClientStub { | 47 public protocol::ClientStub { |
49 public: | 48 public: |
50 // |client_context|, |user_interface| and |video_renderer| must outlive the | 49 // |client_context|, |user_interface| and |video_renderer| must outlive the |
51 // client. |audio_consumer| may be null, in which case audio will not be | 50 // client. |audio_consumer| may be null, in which case audio will not be |
52 // requested. | 51 // requested. |
53 ChromotingClient(ClientContext* client_context, | 52 ChromotingClient(ClientContext* client_context, |
54 ClientUserInterface* user_interface, | 53 ClientUserInterface* user_interface, |
55 protocol::VideoRenderer* video_renderer, | 54 protocol::VideoRenderer* video_renderer, |
56 base::WeakPtr<AudioConsumer> audio_consumer); | 55 base::WeakPtr<protocol::AudioStub> audio_consumer); |
57 | 56 |
58 ~ChromotingClient() override; | 57 ~ChromotingClient() override; |
59 | 58 |
60 void set_protocol_config( | 59 void set_protocol_config( |
61 std::unique_ptr<protocol::CandidateSessionConfig> config); | 60 std::unique_ptr<protocol::CandidateSessionConfig> config); |
62 | 61 |
63 // Used to set fake/mock objects for tests which use the ChromotingClient. | 62 // Used to set fake/mock objects for tests which use the ChromotingClient. |
64 void SetConnectionToHostForTests( | 63 void SetConnectionToHostForTests( |
65 std::unique_ptr<protocol::ConnectionToHost> connection_to_host); | 64 std::unique_ptr<protocol::ConnectionToHost> connection_to_host); |
66 | 65 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 const protocol::TransportRoute& route) override; | 102 const protocol::TransportRoute& route) override; |
104 | 103 |
105 private: | 104 private: |
106 // SignalStrategy::StatusObserver interface. | 105 // SignalStrategy::StatusObserver interface. |
107 void OnSignalStrategyStateChange(SignalStrategy::State state) override; | 106 void OnSignalStrategyStateChange(SignalStrategy::State state) override; |
108 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override; | 107 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override; |
109 | 108 |
110 // Starts connection once |signal_strategy_| is connected. | 109 // Starts connection once |signal_strategy_| is connected. |
111 void StartConnection(); | 110 void StartConnection(); |
112 | 111 |
113 // Called when the connection is authenticated. | |
114 void OnAuthenticated(); | |
115 | |
116 // Called when all channels are connected. | 112 // Called when all channels are connected. |
117 void OnChannelsConnected(); | 113 void OnChannelsConnected(); |
118 | 114 |
119 base::ThreadChecker thread_checker_; | 115 base::ThreadChecker thread_checker_; |
120 | 116 |
| 117 scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner_; |
| 118 |
121 std::unique_ptr<protocol::CandidateSessionConfig> protocol_config_; | 119 std::unique_ptr<protocol::CandidateSessionConfig> protocol_config_; |
122 | 120 |
123 // The following are not owned by this class. | 121 // The following are not owned by this class. |
124 ClientUserInterface* user_interface_ = nullptr; | 122 ClientUserInterface* user_interface_ = nullptr; |
125 protocol::VideoRenderer* video_renderer_ = nullptr; | 123 protocol::VideoRenderer* video_renderer_ = nullptr; |
| 124 base::WeakPtr<protocol::AudioStub> audio_consumer_; |
126 SignalStrategy* signal_strategy_ = nullptr; | 125 SignalStrategy* signal_strategy_ = nullptr; |
127 | 126 |
128 std::string host_jid_; | 127 std::string host_jid_; |
129 protocol::ClientAuthenticationConfig client_auth_config_; | 128 protocol::ClientAuthenticationConfig client_auth_config_; |
130 scoped_refptr<protocol::TransportContext> transport_context_; | 129 scoped_refptr<protocol::TransportContext> transport_context_; |
131 | 130 |
132 std::unique_ptr<protocol::SessionManager> session_manager_; | 131 std::unique_ptr<protocol::SessionManager> session_manager_; |
133 std::unique_ptr<protocol::ConnectionToHost> connection_; | 132 std::unique_ptr<protocol::ConnectionToHost> connection_; |
134 | 133 |
135 protocol::MouseInputFilter mouse_input_scaler_; | 134 protocol::MouseInputFilter mouse_input_scaler_; |
136 | 135 |
137 std::unique_ptr<AudioDecodeScheduler> audio_decode_scheduler_; | |
138 | |
139 std::string local_capabilities_; | 136 std::string local_capabilities_; |
140 | 137 |
141 // The set of all capabilities supported by the host. | 138 // The set of all capabilities supported by the host. |
142 std::string host_capabilities_; | 139 std::string host_capabilities_; |
143 | 140 |
144 // True if |protocol::Capabilities| message has been received. | 141 // True if |protocol::Capabilities| message has been received. |
145 bool host_capabilities_received_ = false; | 142 bool host_capabilities_received_ = false; |
146 | 143 |
147 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); | 144 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); |
148 }; | 145 }; |
149 | 146 |
150 } // namespace remoting | 147 } // namespace remoting |
151 | 148 |
152 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ | 149 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ |
OLD | NEW |