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/task.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" |
(...skipping 16 matching lines...) Expand all Loading... |
39 public protocol::ClientStub, | 39 public protocol::ClientStub, |
40 public protocol::VideoStub { | 40 public protocol::VideoStub { |
41 public: | 41 public: |
42 // Objects passed in are not owned by this class. | 42 // Objects passed in are not owned by this class. |
43 ChromotingClient(const ClientConfig& config, | 43 ChromotingClient(const ClientConfig& config, |
44 ClientContext* context, | 44 ClientContext* context, |
45 protocol::ConnectionToHost* connection, | 45 protocol::ConnectionToHost* connection, |
46 ChromotingView* view, | 46 ChromotingView* view, |
47 RectangleUpdateDecoder* rectangle_decoder, | 47 RectangleUpdateDecoder* rectangle_decoder, |
48 InputHandler* input_handler, | 48 InputHandler* input_handler, |
49 Task* client_done); | 49 const base::Closure& client_done); |
50 virtual ~ChromotingClient(); | 50 virtual ~ChromotingClient(); |
51 | 51 |
52 void Start(scoped_refptr<XmppProxy> xmpp_proxy); | 52 void Start(scoped_refptr<XmppProxy> xmpp_proxy); |
53 void Stop(const base::Closure& shutdown_task); | 53 void Stop(const base::Closure& shutdown_task); |
54 void ClientDone(); | 54 void ClientDone(); |
55 | 55 |
56 // Return the stats recorded by this client. | 56 // Return the stats recorded by this client. |
57 ChromotingStats* GetStats(); | 57 ChromotingStats* GetStats(); |
58 | 58 |
59 // Signals that the associated view may need updating. | 59 // Signals that the associated view may need updating. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 // The following are not owned by this class. | 96 // The following are not owned by this class. |
97 ClientConfig config_; | 97 ClientConfig config_; |
98 ClientContext* context_; | 98 ClientContext* context_; |
99 protocol::ConnectionToHost* connection_; | 99 protocol::ConnectionToHost* connection_; |
100 ChromotingView* view_; | 100 ChromotingView* view_; |
101 RectangleUpdateDecoder* rectangle_decoder_; | 101 RectangleUpdateDecoder* rectangle_decoder_; |
102 InputHandler* input_handler_; | 102 InputHandler* input_handler_; |
103 | 103 |
104 // If non-NULL, this is called when the client is done. | 104 // If non-NULL, this is called when the client is done. |
105 Task* client_done_; | 105 base::Closure client_done_; |
106 | 106 |
107 // Contains all video packets that have been received, but have not yet been | 107 // Contains all video packets that have been received, but have not yet been |
108 // processed. | 108 // processed. |
109 // | 109 // |
110 // Used to serialize sending of messages to the client. | 110 // Used to serialize sending of messages to the client. |
111 std::list<QueuedVideoPacket> received_packets_; | 111 std::list<QueuedVideoPacket> received_packets_; |
112 | 112 |
113 // True if a message is being processed. Can be used to determine if it is | 113 // True if a message is being processed. Can be used to determine if it is |
114 // safe to dispatch another message. | 114 // safe to dispatch another message. |
115 bool packet_being_processed_; | 115 bool packet_being_processed_; |
116 | 116 |
117 // Record the statistics of the connection. | 117 // Record the statistics of the connection. |
118 ChromotingStats stats_; | 118 ChromotingStats stats_; |
119 | 119 |
120 // Keep track of the last sequence number bounced back from the host. | 120 // Keep track of the last sequence number bounced back from the host. |
121 int64 last_sequence_number_; | 121 int64 last_sequence_number_; |
122 | 122 |
123 ScopedThreadProxy thread_proxy_; | 123 ScopedThreadProxy thread_proxy_; |
124 | 124 |
125 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); | 125 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); |
126 }; | 126 }; |
127 | 127 |
128 } // namespace remoting | 128 } // namespace remoting |
129 | 129 |
130 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::ChromotingClient); | |
131 | |
132 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ | 130 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ |
OLD | NEW |