| 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> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/weak_ptr.h" |
| 15 #include "remoting/protocol/client_authentication_config.h" | 16 #include "remoting/protocol/client_authentication_config.h" |
| 16 #include "remoting/protocol/client_stub.h" | 17 #include "remoting/protocol/client_stub.h" |
| 17 #include "remoting/protocol/clipboard_stub.h" | 18 #include "remoting/protocol/clipboard_stub.h" |
| 18 #include "remoting/protocol/connection_to_host.h" | 19 #include "remoting/protocol/connection_to_host.h" |
| 19 #include "remoting/protocol/input_stub.h" | 20 #include "remoting/protocol/input_stub.h" |
| 20 #include "remoting/protocol/mouse_input_filter.h" | 21 #include "remoting/protocol/mouse_input_filter.h" |
| 21 #include "remoting/protocol/performance_tracker.h" | 22 #include "remoting/protocol/performance_tracker.h" |
| 22 #include "remoting/protocol/session_config.h" | 23 #include "remoting/protocol/session_config.h" |
| 23 #include "remoting/protocol/video_stub.h" | 24 #include "remoting/protocol/video_stub.h" |
| 24 #include "remoting/signaling/signal_strategy.h" | 25 #include "remoting/signaling/signal_strategy.h" |
| 25 | 26 |
| 26 namespace base { | 27 namespace base { |
| 27 class SingleThreadTaskRunner; | 28 class SingleThreadTaskRunner; |
| 28 } // namespace base | 29 } // namespace base |
| 29 | 30 |
| 30 namespace remoting { | 31 namespace remoting { |
| 31 | 32 |
| 32 namespace protocol { | 33 namespace protocol { |
| 33 class CandidateSessionConfig; | 34 class CandidateSessionConfig; |
| 34 class SessionManager; | 35 class SessionManager; |
| 35 class TransportContext; | 36 class TransportContext; |
| 36 class VideoRenderer; | 37 class VideoRenderer; |
| 37 } // namespace protocol | 38 } // namespace protocol |
| 38 | 39 |
| 40 class AudioConsumer; |
| 39 class AudioDecodeScheduler; | 41 class AudioDecodeScheduler; |
| 40 class AudioPlayer; | |
| 41 class ClientContext; | 42 class ClientContext; |
| 42 class ClientUserInterface; | 43 class ClientUserInterface; |
| 43 class FrameConsumerProxy; | 44 class FrameConsumerProxy; |
| 44 | 45 |
| 45 class ChromotingClient : public SignalStrategy::Listener, | 46 class ChromotingClient : public SignalStrategy::Listener, |
| 46 public protocol::ConnectionToHost::HostEventCallback, | 47 public protocol::ConnectionToHost::HostEventCallback, |
| 47 public protocol::ClientStub { | 48 public protocol::ClientStub { |
| 48 public: | 49 public: |
| 49 // |client_context|, |user_interface| and |video_renderer| must outlive the | 50 // |client_context|, |user_interface| and |video_renderer| must outlive the |
| 50 // client. |audio_player| may be null, in which case audio will not be | 51 // client. |audio_consumer| may be null, in which case audio will not be |
| 51 // requested. | 52 // requested. |
| 52 ChromotingClient(ClientContext* client_context, | 53 ChromotingClient(ClientContext* client_context, |
| 53 ClientUserInterface* user_interface, | 54 ClientUserInterface* user_interface, |
| 54 protocol::VideoRenderer* video_renderer, | 55 protocol::VideoRenderer* video_renderer, |
| 55 std::unique_ptr<AudioPlayer> audio_player); | 56 base::WeakPtr<AudioConsumer> audio_consumer); |
| 56 | 57 |
| 57 ~ChromotingClient() override; | 58 ~ChromotingClient() override; |
| 58 | 59 |
| 59 void set_protocol_config( | 60 void set_protocol_config( |
| 60 std::unique_ptr<protocol::CandidateSessionConfig> config); | 61 std::unique_ptr<protocol::CandidateSessionConfig> config); |
| 61 | 62 |
| 62 // Used to set fake/mock objects for tests which use the ChromotingClient. | 63 // Used to set fake/mock objects for tests which use the ChromotingClient. |
| 63 void SetConnectionToHostForTests( | 64 void SetConnectionToHostForTests( |
| 64 std::unique_ptr<protocol::ConnectionToHost> connection_to_host); | 65 std::unique_ptr<protocol::ConnectionToHost> connection_to_host); |
| 65 | 66 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 95 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override; | 96 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override; |
| 96 | 97 |
| 97 // ConnectionToHost::HostEventCallback implementation. | 98 // ConnectionToHost::HostEventCallback implementation. |
| 98 void OnConnectionState(protocol::ConnectionToHost::State state, | 99 void OnConnectionState(protocol::ConnectionToHost::State state, |
| 99 protocol::ErrorCode error) override; | 100 protocol::ErrorCode error) override; |
| 100 void OnConnectionReady(bool ready) override; | 101 void OnConnectionReady(bool ready) override; |
| 101 void OnRouteChanged(const std::string& channel_name, | 102 void OnRouteChanged(const std::string& channel_name, |
| 102 const protocol::TransportRoute& route) override; | 103 const protocol::TransportRoute& route) override; |
| 103 | 104 |
| 104 private: | 105 private: |
| 105 // SignalStrategy::StatusObserver interface. | 106 // SignalStrategy::StatusObserver interface. |
| 106 void OnSignalStrategyStateChange(SignalStrategy::State state) override; | 107 void OnSignalStrategyStateChange(SignalStrategy::State state) override; |
| 107 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override; | 108 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override; |
| 108 | 109 |
| 109 // Starts connection once |signal_strategy_| is connected. | 110 // Starts connection once |signal_strategy_| is connected. |
| 110 void StartConnection(); | 111 void StartConnection(); |
| 111 | 112 |
| 112 // Called when the connection is authenticated. | 113 // Called when the connection is authenticated. |
| 113 void OnAuthenticated(); | 114 void OnAuthenticated(); |
| 114 | 115 |
| 115 // Called when all channels are connected. | 116 // Called when all channels are connected. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 145 | 146 |
| 146 // Record the statistics of the connection. | 147 // Record the statistics of the connection. |
| 147 protocol::PerformanceTracker perf_tracker_; | 148 protocol::PerformanceTracker perf_tracker_; |
| 148 | 149 |
| 149 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); | 150 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); |
| 150 }; | 151 }; |
| 151 | 152 |
| 152 } // namespace remoting | 153 } // namespace remoting |
| 153 | 154 |
| 154 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ | 155 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ |
| OLD | NEW |