| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <list> | 10 #include <list> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "remoting/base/scoped_thread_proxy.h" | 14 #include "remoting/base/scoped_thread_proxy.h" |
| 15 #include "remoting/client/client_config.h" | 15 #include "remoting/client/client_config.h" |
| 16 #include "remoting/client/chromoting_stats.h" | 16 #include "remoting/client/chromoting_stats.h" |
| 17 #include "remoting/client/chromoting_view.h" | 17 #include "remoting/client/chromoting_view.h" |
| 18 #include "remoting/protocol/client_stub.h" | 18 #include "remoting/protocol/client_stub.h" |
| 19 #include "remoting/protocol/connection_to_host.h" | 19 #include "remoting/protocol/connection_to_host.h" |
| 20 #include "remoting/protocol/input_stub.h" | 20 #include "remoting/protocol/input_stub.h" |
| 21 #include "remoting/protocol/video_stub.h" | 21 #include "remoting/protocol/video_stub.h" |
| 22 #include "remoting/jingle_glue/xmpp_proxy.h" | 22 #include "remoting/jingle_glue/xmpp_proxy.h" |
| 23 | 23 |
| 24 class MessageLoop; | 24 class MessageLoop; |
| 25 | 25 |
| 26 namespace remoting { | 26 namespace remoting { |
| 27 | 27 |
| 28 class ClientContext; | 28 class ClientContext; |
| 29 class InputHandler; | |
| 30 class RectangleUpdateDecoder; | 29 class RectangleUpdateDecoder; |
| 31 | 30 |
| 32 // TODO(sergeyu): Move VideoStub implementation to RectangleUpdateDecoder. | 31 // TODO(sergeyu): Move VideoStub implementation to RectangleUpdateDecoder. |
| 33 class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback, | 32 class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback, |
| 34 public protocol::ClientStub, | 33 public protocol::ClientStub, |
| 35 public protocol::VideoStub { | 34 public protocol::VideoStub { |
| 36 public: | 35 public: |
| 37 // Objects passed in are not owned by this class. | 36 // Objects passed in are not owned by this class. |
| 38 ChromotingClient(const ClientConfig& config, | 37 ChromotingClient(const ClientConfig& config, |
| 39 ClientContext* context, | 38 ClientContext* context, |
| 40 protocol::ConnectionToHost* connection, | 39 protocol::ConnectionToHost* connection, |
| 41 ChromotingView* view, | 40 ChromotingView* view, |
| 42 RectangleUpdateDecoder* rectangle_decoder, | 41 RectangleUpdateDecoder* rectangle_decoder, |
| 43 InputHandler* input_handler, | |
| 44 const base::Closure& client_done); | 42 const base::Closure& client_done); |
| 45 virtual ~ChromotingClient(); | 43 virtual ~ChromotingClient(); |
| 46 | 44 |
| 47 void Start(scoped_refptr<XmppProxy> xmpp_proxy); | 45 void Start(scoped_refptr<XmppProxy> xmpp_proxy); |
| 48 void Stop(const base::Closure& shutdown_task); | 46 void Stop(const base::Closure& shutdown_task); |
| 49 void ClientDone(); | 47 void ClientDone(); |
| 50 | 48 |
| 51 // Return the stats recorded by this client. | 49 // Return the stats recorded by this client. |
| 52 ChromotingStats* GetStats(); | 50 ChromotingStats* GetStats(); |
| 53 | 51 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 void OnPacketDone(bool last_packet, base::Time decode_start); | 85 void OnPacketDone(bool last_packet, base::Time decode_start); |
| 88 | 86 |
| 89 void OnDisconnected(const base::Closure& shutdown_task); | 87 void OnDisconnected(const base::Closure& shutdown_task); |
| 90 | 88 |
| 91 // The following are not owned by this class. | 89 // The following are not owned by this class. |
| 92 ClientConfig config_; | 90 ClientConfig config_; |
| 93 ClientContext* context_; | 91 ClientContext* context_; |
| 94 protocol::ConnectionToHost* connection_; | 92 protocol::ConnectionToHost* connection_; |
| 95 ChromotingView* view_; | 93 ChromotingView* view_; |
| 96 RectangleUpdateDecoder* rectangle_decoder_; | 94 RectangleUpdateDecoder* rectangle_decoder_; |
| 97 InputHandler* input_handler_; | |
| 98 | 95 |
| 99 // If non-NULL, this is called when the client is done. | 96 // If non-NULL, this is called when the client is done. |
| 100 base::Closure client_done_; | 97 base::Closure client_done_; |
| 101 | 98 |
| 102 // Contains all video packets that have been received, but have not yet been | 99 // Contains all video packets that have been received, but have not yet been |
| 103 // processed. | 100 // processed. |
| 104 // | 101 // |
| 105 // Used to serialize sending of messages to the client. | 102 // Used to serialize sending of messages to the client. |
| 106 std::list<QueuedVideoPacket> received_packets_; | 103 std::list<QueuedVideoPacket> received_packets_; |
| 107 | 104 |
| 108 // True if a message is being processed. Can be used to determine if it is | 105 // True if a message is being processed. Can be used to determine if it is |
| 109 // safe to dispatch another message. | 106 // safe to dispatch another message. |
| 110 bool packet_being_processed_; | 107 bool packet_being_processed_; |
| 111 | 108 |
| 112 // Record the statistics of the connection. | 109 // Record the statistics of the connection. |
| 113 ChromotingStats stats_; | 110 ChromotingStats stats_; |
| 114 | 111 |
| 115 // Keep track of the last sequence number bounced back from the host. | 112 // Keep track of the last sequence number bounced back from the host. |
| 116 int64 last_sequence_number_; | 113 int64 last_sequence_number_; |
| 117 | 114 |
| 118 ScopedThreadProxy thread_proxy_; | 115 ScopedThreadProxy thread_proxy_; |
| 119 | 116 |
| 120 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); | 117 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); |
| 121 }; | 118 }; |
| 122 | 119 |
| 123 } // namespace remoting | 120 } // namespace remoting |
| 124 | 121 |
| 125 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ | 122 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ |
| OLD | NEW |