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 #include "remoting/client/chromoting_client.h" | 5 #include "remoting/client/chromoting_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "remoting/client/chromoting_view.h" | 8 #include "remoting/client/chromoting_view.h" |
9 #include "remoting/client/client_context.h" | 9 #include "remoting/client/client_context.h" |
10 #include "remoting/client/input_handler.h" | 10 #include "remoting/client/input_handler.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 rectangle_decoder_->DecodePacket( | 148 rectangle_decoder_->DecodePacket( |
149 packet, NewRunnableMethod(this, &ChromotingClient::OnPacketDone, | 149 packet, NewRunnableMethod(this, &ChromotingClient::OnPacketDone, |
150 last_packet, decode_start)); | 150 last_packet, decode_start)); |
151 } | 151 } |
152 | 152 |
153 void ChromotingClient::OnConnectionState( | 153 void ChromotingClient::OnConnectionState( |
154 protocol::ConnectionToHost::State state, | 154 protocol::ConnectionToHost::State state, |
155 protocol::ConnectionToHost::Error error) { | 155 protocol::ConnectionToHost::Error error) { |
156 DCHECK(message_loop()->BelongsToCurrentThread()); | 156 DCHECK(message_loop()->BelongsToCurrentThread()); |
157 VLOG(1) << "ChromotingClient::OnConnectionState(" << state << ")"; | 157 VLOG(1) << "ChromotingClient::OnConnectionState(" << state << ")"; |
158 if (state == protocol::ConnectionToHost::CONNECTED) | 158 if (state == protocol::ConnectionToHost::CONNECTED || |
| 159 state == protocol::ConnectionToHost::AUTHENTICATED) |
159 Initialize(); | 160 Initialize(); |
160 view_->SetConnectionState(state, error); | 161 view_->SetConnectionState(state, error); |
161 } | 162 } |
162 | 163 |
163 base::MessageLoopProxy* ChromotingClient::message_loop() { | 164 base::MessageLoopProxy* ChromotingClient::message_loop() { |
164 return context_->network_message_loop(); | 165 return context_->network_message_loop(); |
165 } | 166 } |
166 | 167 |
167 void ChromotingClient::OnPacketDone(bool last_packet, | 168 void ChromotingClient::OnPacketDone(bool last_packet, |
168 base::Time decode_start) { | 169 base::Time decode_start) { |
(...skipping 27 matching lines...) Expand all Loading... |
196 return; | 197 return; |
197 } | 198 } |
198 | 199 |
199 // Initialize the decoder. | 200 // Initialize the decoder. |
200 rectangle_decoder_->Initialize(connection_->config()); | 201 rectangle_decoder_->Initialize(connection_->config()); |
201 | 202 |
202 // Schedule the input handler to process the event queue. | 203 // Schedule the input handler to process the event queue. |
203 input_handler_->Initialize(); | 204 input_handler_->Initialize(); |
204 } | 205 } |
205 | 206 |
206 //////////////////////////////////////////////////////////////////////////// | |
207 // ClientStub control channel interface. | |
208 void ChromotingClient::BeginSessionResponse( | |
209 const protocol::LocalLoginStatus* msg, const base::Closure& done) { | |
210 if (!message_loop()->BelongsToCurrentThread()) { | |
211 thread_proxy_.PostTask(FROM_HERE, base::Bind( | |
212 &ChromotingClient::BeginSessionResponse, base::Unretained(this), | |
213 msg, done)); | |
214 return; | |
215 } | |
216 | |
217 VLOG(1) << "BeginSessionResponse received"; | |
218 | |
219 // Inform the connection that the client has been authenticated. This will | |
220 // enable the communication channels. | |
221 if (msg->success()) { | |
222 connection_->OnClientAuthenticated(); | |
223 } | |
224 | |
225 view_->UpdateLoginStatus(msg->success(), msg->error_info()); | |
226 done.Run(); | |
227 } | |
228 | |
229 } // namespace remoting | 207 } // namespace remoting |
OLD | NEW |