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 #include "remoting/host/chromoting_host.h" | 5 #include "remoting/host/chromoting_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 scoped_ptr<ClientSession> client_destroyer(client); | 247 scoped_ptr<ClientSession> client_destroyer(client); |
248 | 248 |
249 ClientList::iterator it = std::find(clients_.begin(), clients_.end(), client); | 249 ClientList::iterator it = std::find(clients_.begin(), clients_.end(), client); |
250 CHECK(it != clients_.end()); | 250 CHECK(it != clients_.end()); |
251 clients_.erase(it); | 251 clients_.erase(it); |
252 | 252 |
253 if (recorder_.get()) { | 253 if (recorder_.get()) { |
254 recorder_->RemoveConnection(client->connection()); | 254 recorder_->RemoveConnection(client->connection()); |
255 } | 255 } |
256 | 256 |
257 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, | 257 if (client->is_authenticated()) { |
258 OnClientDisconnected(client->client_jid())); | 258 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, |
| 259 OnClientDisconnected(client->client_jid())); |
259 | 260 |
260 if (recorder_.get()) { | 261 // TODO(sergeyu): This teardown logic belongs to ClientSession |
261 // Currently we don't allow more than one simultaneous connection, | 262 // class. It should start/stop screen recorder or tell the host |
262 // so we need to shutdown recorder when a client disconnects. | 263 // when to do it. |
263 StopScreenRecorder(); | 264 if (recorder_.get()) { |
| 265 // Currently we don't allow more than one simultaneous connection, |
| 266 // so we need to shutdown recorder when a client disconnects. |
| 267 StopScreenRecorder(); |
| 268 } |
| 269 desktop_environment_->OnSessionFinished(); |
264 } | 270 } |
265 desktop_environment_->OnSessionFinished(); | |
266 } | 271 } |
267 | 272 |
268 void ChromotingHost::OnSessionSequenceNumber(ClientSession* session, | 273 void ChromotingHost::OnSessionSequenceNumber(ClientSession* session, |
269 int64 sequence_number) { | 274 int64 sequence_number) { |
270 DCHECK(context_->network_message_loop()->BelongsToCurrentThread()); | 275 DCHECK(context_->network_message_loop()->BelongsToCurrentThread()); |
271 if (recorder_.get()) | 276 if (recorder_.get()) |
272 recorder_->UpdateSequenceNumber(sequence_number); | 277 recorder_->UpdateSequenceNumber(sequence_number); |
273 } | 278 } |
274 | 279 |
275 void ChromotingHost::OnSessionRouteChange( | 280 void ChromotingHost::OnSessionRouteChange( |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 OnShutdown()); | 433 OnShutdown()); |
429 | 434 |
430 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin(); | 435 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin(); |
431 it != shutdown_tasks_.end(); ++it) { | 436 it != shutdown_tasks_.end(); ++it) { |
432 it->Run(); | 437 it->Run(); |
433 } | 438 } |
434 shutdown_tasks_.clear(); | 439 shutdown_tasks_.clear(); |
435 } | 440 } |
436 | 441 |
437 } // namespace remoting | 442 } // namespace remoting |
OLD | NEW |