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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "jingle/glue/thread_wrapper.h" | 13 #include "jingle/glue/thread_wrapper.h" |
14 #include "remoting/base/constants.h" | 14 #include "remoting/base/constants.h" |
15 #include "remoting/base/logging.h" | 15 #include "remoting/base/logging.h" |
16 #include "remoting/host/chromoting_host_context.h" | 16 #include "remoting/host/chromoting_host_context.h" |
17 #include "remoting/host/desktop_environment.h" | 17 #include "remoting/host/desktop_environment.h" |
18 #include "remoting/host/host_config.h" | 18 #include "remoting/host/host_config.h" |
19 #include "remoting/host/input_injector.h" | 19 #include "remoting/host/input_injector.h" |
20 #include "remoting/host/video_frame_recorder.h" | 20 #include "remoting/host/video_frame_recorder.h" |
21 #include "remoting/protocol/connection_to_client.h" | |
22 #include "remoting/protocol/client_stub.h" | 21 #include "remoting/protocol/client_stub.h" |
23 #include "remoting/protocol/host_stub.h" | 22 #include "remoting/protocol/host_stub.h" |
| 23 #include "remoting/protocol/ice_connection_to_client.h" |
24 #include "remoting/protocol/input_stub.h" | 24 #include "remoting/protocol/input_stub.h" |
25 | 25 |
26 using remoting::protocol::ConnectionToClient; | 26 using remoting::protocol::ConnectionToClient; |
27 using remoting::protocol::InputStub; | 27 using remoting::protocol::InputStub; |
28 | 28 |
29 namespace remoting { | 29 namespace remoting { |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
33 const net::BackoffEntry::Policy kDefaultBackoffPolicy = { | 33 const net::BackoffEntry::Policy kDefaultBackoffPolicy = { |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 *response = protocol::SessionManager::OVERLOAD; | 277 *response = protocol::SessionManager::OVERLOAD; |
278 return; | 278 return; |
279 } | 279 } |
280 | 280 |
281 *response = protocol::SessionManager::ACCEPT; | 281 *response = protocol::SessionManager::ACCEPT; |
282 | 282 |
283 HOST_LOG << "Client connected: " << session->jid(); | 283 HOST_LOG << "Client connected: " << session->jid(); |
284 | 284 |
285 // Create a client object. | 285 // Create a client object. |
286 scoped_ptr<protocol::ConnectionToClient> connection( | 286 scoped_ptr<protocol::ConnectionToClient> connection( |
287 new protocol::ConnectionToClient(session)); | 287 new protocol::IceConnectionToClient(make_scoped_ptr(session))); |
288 ClientSession* client = new ClientSession( | 288 ClientSession* client = new ClientSession( |
289 this, | 289 this, |
290 audio_task_runner_, | 290 audio_task_runner_, |
291 input_task_runner_, | 291 input_task_runner_, |
292 video_capture_task_runner_, | 292 video_capture_task_runner_, |
293 video_encode_task_runner_, | 293 video_encode_task_runner_, |
294 network_task_runner_, | 294 network_task_runner_, |
295 ui_task_runner_, | 295 ui_task_runner_, |
296 connection.Pass(), | 296 connection.Pass(), |
297 desktop_environment_factory_, | 297 desktop_environment_factory_, |
298 max_session_duration_, | 298 max_session_duration_, |
299 pairing_registry_, | 299 pairing_registry_, |
300 extensions_.get()); | 300 extensions_.get()); |
301 | 301 |
302 clients_.push_back(client); | 302 clients_.push_back(client); |
303 } | 303 } |
304 | 304 |
305 void ChromotingHost::DisconnectAllClients() { | 305 void ChromotingHost::DisconnectAllClients() { |
306 DCHECK(CalledOnValidThread()); | 306 DCHECK(CalledOnValidThread()); |
307 | 307 |
308 while (!clients_.empty()) { | 308 while (!clients_.empty()) { |
309 size_t size = clients_.size(); | 309 size_t size = clients_.size(); |
310 clients_.front()->DisconnectSession(protocol::OK); | 310 clients_.front()->DisconnectSession(protocol::OK); |
311 CHECK_EQ(clients_.size(), size - 1); | 311 CHECK_EQ(clients_.size(), size - 1); |
312 } | 312 } |
313 } | 313 } |
314 | 314 |
315 } // namespace remoting | 315 } // namespace remoting |
OLD | NEW |