| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/host/chromoting_host.h" | 5 #include "remoting/host/chromoting_host.h" |
| 6 | 6 |
| 7 #include "base/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
| 8 #include "base/task.h" | 8 #include "base/task.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "remoting/base/constants.h" | 10 #include "remoting/base/constants.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 //////////////////////////////////////////////////////////////////////////// | 199 //////////////////////////////////////////////////////////////////////////// |
| 200 // protocol::ConnectionToClient::EventHandler implementations | 200 // protocol::ConnectionToClient::EventHandler implementations |
| 201 void ChromotingHost::OnConnectionOpened(ConnectionToClient* connection) { | 201 void ChromotingHost::OnConnectionOpened(ConnectionToClient* connection) { |
| 202 DCHECK_EQ(context_->network_message_loop(), MessageLoop::current()); | 202 DCHECK_EQ(context_->network_message_loop(), MessageLoop::current()); |
| 203 | 203 |
| 204 // Completes the connection to the client. | 204 // Completes the connection to the client. |
| 205 VLOG(1) << "Connection to client established."; | 205 VLOG(1) << "Connection to client established."; |
| 206 context_->main_message_loop()->PostTask( | 206 context_->main_message_loop()->PostTask( |
| 207 FROM_HERE, | 207 FROM_HERE, |
| 208 NewRunnableMethod(this, &ChromotingHost::OnClientConnected, | 208 NewRunnableMethod(this, &ChromotingHost::OnClientConnected, |
| 209 connection_.get())); | 209 connection_)); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void ChromotingHost::OnConnectionClosed(ConnectionToClient* connection) { | 212 void ChromotingHost::OnConnectionClosed(ConnectionToClient* connection) { |
| 213 DCHECK_EQ(context_->network_message_loop(), MessageLoop::current()); | 213 DCHECK_EQ(context_->network_message_loop(), MessageLoop::current()); |
| 214 | 214 |
| 215 VLOG(1) << "Connection to client closed."; | 215 VLOG(1) << "Connection to client closed."; |
| 216 context_->main_message_loop()->PostTask( | 216 context_->main_message_loop()->PostTask( |
| 217 FROM_HERE, | 217 FROM_HERE, |
| 218 NewRunnableMethod(this, &ChromotingHost::OnClientDisconnected, | 218 NewRunnableMethod(this, &ChromotingHost::OnClientDisconnected, |
| 219 connection_.get())); | 219 connection_)); |
| 220 } | 220 } |
| 221 | 221 |
| 222 void ChromotingHost::OnConnectionFailed(ConnectionToClient* connection) { | 222 void ChromotingHost::OnConnectionFailed(ConnectionToClient* connection) { |
| 223 DCHECK_EQ(context_->network_message_loop(), MessageLoop::current()); | 223 DCHECK_EQ(context_->network_message_loop(), MessageLoop::current()); |
| 224 | 224 |
| 225 LOG(ERROR) << "Connection failed unexpectedly."; | 225 LOG(ERROR) << "Connection failed unexpectedly."; |
| 226 context_->main_message_loop()->PostTask( | 226 context_->main_message_loop()->PostTask( |
| 227 FROM_HERE, | 227 FROM_HERE, |
| 228 NewRunnableMethod(this, &ChromotingHost::OnClientDisconnected, | 228 NewRunnableMethod(this, &ChromotingHost::OnClientDisconnected, |
| 229 connection_.get())); | 229 connection_)); |
| 230 } | 230 } |
| 231 | 231 |
| 232 //////////////////////////////////////////////////////////////////////////// | 232 //////////////////////////////////////////////////////////////////////////// |
| 233 // JingleClient::Callback implementations | 233 // JingleClient::Callback implementations |
| 234 void ChromotingHost::OnStateChange(JingleClient* jingle_client, | 234 void ChromotingHost::OnStateChange(JingleClient* jingle_client, |
| 235 JingleClient::State state) { | 235 JingleClient::State state) { |
| 236 if (state == JingleClient::CONNECTED) { | 236 if (state == JingleClient::CONNECTED) { |
| 237 DCHECK_EQ(jingle_client_.get(), jingle_client); | 237 DCHECK_EQ(jingle_client_.get(), jingle_client); |
| 238 VLOG(1) << "Host connected as " << jingle_client->GetFullJid(); | 238 VLOG(1) << "Host connected as " << jingle_client->GetFullJid(); |
| 239 | 239 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 return NULL; | 337 return NULL; |
| 338 } | 338 } |
| 339 | 339 |
| 340 std::string ChromotingHost::GenerateHostAuthToken( | 340 std::string ChromotingHost::GenerateHostAuthToken( |
| 341 const std::string& encoded_client_token) { | 341 const std::string& encoded_client_token) { |
| 342 // TODO(ajwong): Return the signature of this instead. | 342 // TODO(ajwong): Return the signature of this instead. |
| 343 return encoded_client_token; | 343 return encoded_client_token; |
| 344 } | 344 } |
| 345 | 345 |
| 346 } // namespace remoting | 346 } // namespace remoting |
| OLD | NEW |