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 <string> | 10 #include <string> |
(...skipping 18 matching lines...) Expand all Loading... |
29 namespace protocol { | 29 namespace protocol { |
30 class TransportFactory; | 30 class TransportFactory; |
31 } // namespace protocol | 31 } // namespace protocol |
32 | 32 |
33 class AudioDecodeScheduler; | 33 class AudioDecodeScheduler; |
34 class AudioPlayer; | 34 class AudioPlayer; |
35 class ClientContext; | 35 class ClientContext; |
36 class ClientUserInterface; | 36 class ClientUserInterface; |
37 class FrameConsumerProxy; | 37 class FrameConsumerProxy; |
38 class FrameProducer; | 38 class FrameProducer; |
39 class RectangleUpdateDecoder; | 39 class VideoRenderer; |
40 class SignalStrategy; | 40 class SignalStrategy; |
41 | 41 |
42 class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback, | 42 class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback, |
43 public protocol::ClientStub { | 43 public protocol::ClientStub { |
44 public: | 44 public: |
45 // |audio_player| may be null, in which case audio will not be requested. | 45 // |audio_player| may be null, in which case audio will not be requested. |
46 ChromotingClient(const ClientConfig& config, | 46 ChromotingClient(const ClientConfig& config, |
47 ClientContext* client_context, | 47 ClientContext* client_context, |
48 protocol::ConnectionToHost* connection, | 48 protocol::ConnectionToHost* connection, |
49 ClientUserInterface* user_interface, | 49 ClientUserInterface* user_interface, |
50 scoped_refptr<FrameConsumerProxy> frame_consumer, | 50 VideoRenderer* video_renderer, |
51 scoped_ptr<AudioPlayer> audio_player); | 51 scoped_ptr<AudioPlayer> audio_player); |
52 | 52 |
53 virtual ~ChromotingClient(); | 53 virtual ~ChromotingClient(); |
54 | 54 |
55 // Start the client. Must be called on the main thread. |signal_strategy| | 55 // Start the client. Must be called on the main thread. |signal_strategy| |
56 // must outlive the client. | 56 // must outlive the client. |
57 void Start(SignalStrategy* signal_strategy, | 57 void Start(SignalStrategy* signal_strategy, |
58 scoped_ptr<protocol::TransportFactory> transport_factory); | 58 scoped_ptr<protocol::TransportFactory> transport_factory); |
59 | 59 |
60 FrameProducer* GetFrameProducer(); | |
61 | |
62 // Return the stats recorded by this client. | |
63 ChromotingStats* GetStats(); | |
64 | |
65 // ClientStub implementation. | 60 // ClientStub implementation. |
66 virtual void SetCapabilities( | 61 virtual void SetCapabilities( |
67 const protocol::Capabilities& capabilities) OVERRIDE; | 62 const protocol::Capabilities& capabilities) OVERRIDE; |
68 virtual void SetPairingResponse( | 63 virtual void SetPairingResponse( |
69 const protocol::PairingResponse& pairing_response) OVERRIDE; | 64 const protocol::PairingResponse& pairing_response) OVERRIDE; |
70 virtual void DeliverHostMessage( | 65 virtual void DeliverHostMessage( |
71 const protocol::ExtensionMessage& message) OVERRIDE; | 66 const protocol::ExtensionMessage& message) OVERRIDE; |
72 | 67 |
73 // ClipboardStub implementation for receiving clipboard data from host. | 68 // ClipboardStub implementation for receiving clipboard data from host. |
74 virtual void InjectClipboardEvent( | 69 virtual void InjectClipboardEvent( |
(...skipping 16 matching lines...) Expand all Loading... |
91 void OnAuthenticated(); | 86 void OnAuthenticated(); |
92 | 87 |
93 // Called when all channels are connected. | 88 // Called when all channels are connected. |
94 void OnChannelsConnected(); | 89 void OnChannelsConnected(); |
95 | 90 |
96 // The following are not owned by this class. | 91 // The following are not owned by this class. |
97 ClientConfig config_; | 92 ClientConfig config_; |
98 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 93 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
99 protocol::ConnectionToHost* connection_; | 94 protocol::ConnectionToHost* connection_; |
100 ClientUserInterface* user_interface_; | 95 ClientUserInterface* user_interface_; |
101 scoped_refptr<RectangleUpdateDecoder> rectangle_decoder_; | 96 VideoRenderer* video_renderer_; |
102 | 97 |
103 scoped_ptr<AudioDecodeScheduler> audio_decode_scheduler_; | 98 scoped_ptr<AudioDecodeScheduler> audio_decode_scheduler_; |
104 | 99 |
105 // If non-NULL, this is called when the client is done. | 100 // If non-NULL, this is called when the client is done. |
106 base::Closure client_done_; | 101 base::Closure client_done_; |
107 | 102 |
108 // The set of all capabilities supported by the host. | 103 // The set of all capabilities supported by the host. |
109 std::string host_capabilities_; | 104 std::string host_capabilities_; |
110 | 105 |
111 // True if |protocol::Capabilities| message has been received. | 106 // True if |protocol::Capabilities| message has been received. |
112 bool host_capabilities_received_; | 107 bool host_capabilities_received_; |
113 | 108 |
114 // Record the statistics of the connection. | 109 // Record the statistics of the connection. |
115 ChromotingStats stats_; | 110 ChromotingStats stats_; |
116 | 111 |
117 // WeakPtr used to avoid tasks accessing the client after it is deleted. | 112 // WeakPtr used to avoid tasks accessing the client after it is deleted. |
118 base::WeakPtr<ChromotingClient> weak_ptr_; | 113 base::WeakPtr<ChromotingClient> weak_ptr_; |
119 base::WeakPtrFactory<ChromotingClient> weak_factory_; | 114 base::WeakPtrFactory<ChromotingClient> weak_factory_; |
120 | 115 |
121 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); | 116 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); |
122 }; | 117 }; |
123 | 118 |
124 } // namespace remoting | 119 } // namespace remoting |
125 | 120 |
126 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ | 121 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ |
OLD | NEW |