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/logging.h" | |
12 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
13 #include "build/build_config.h" | 12 #include "build/build_config.h" |
14 #include "remoting/base/constants.h" | 13 #include "remoting/base/constants.h" |
| 14 #include "remoting/base/logging.h" |
15 #include "remoting/host/chromoting_host_context.h" | 15 #include "remoting/host/chromoting_host_context.h" |
16 #include "remoting/host/desktop_environment.h" | 16 #include "remoting/host/desktop_environment.h" |
17 #include "remoting/host/host_config.h" | 17 #include "remoting/host/host_config.h" |
18 #include "remoting/host/input_injector.h" | 18 #include "remoting/host/input_injector.h" |
19 #include "remoting/protocol/connection_to_client.h" | 19 #include "remoting/protocol/connection_to_client.h" |
20 #include "remoting/protocol/client_stub.h" | 20 #include "remoting/protocol/client_stub.h" |
21 #include "remoting/protocol/host_stub.h" | 21 #include "remoting/protocol/host_stub.h" |
22 #include "remoting/protocol/input_stub.h" | 22 #include "remoting/protocol/input_stub.h" |
23 #include "remoting/protocol/session_config.h" | 23 #include "remoting/protocol/session_config.h" |
24 | 24 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 // Notify observers. | 111 // Notify observers. |
112 if (started_) | 112 if (started_) |
113 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, OnShutdown()); | 113 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, OnShutdown()); |
114 } | 114 } |
115 | 115 |
116 void ChromotingHost::Start(const std::string& host_owner) { | 116 void ChromotingHost::Start(const std::string& host_owner) { |
117 DCHECK(CalledOnValidThread()); | 117 DCHECK(CalledOnValidThread()); |
118 DCHECK(!started_); | 118 DCHECK(!started_); |
119 | 119 |
120 LOG(INFO) << "Starting host"; | 120 LOG_INFO << "Starting host"; |
121 started_ = true; | 121 started_ = true; |
122 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, OnStart(host_owner)); | 122 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, OnStart(host_owner)); |
123 | 123 |
124 // Start the SessionManager, supplying this ChromotingHost as the listener. | 124 // Start the SessionManager, supplying this ChromotingHost as the listener. |
125 session_manager_->Init(signal_strategy_, this); | 125 session_manager_->Init(signal_strategy_, this); |
126 } | 126 } |
127 | 127 |
128 void ChromotingHost::AddStatusObserver(HostStatusObserver* observer) { | 128 void ChromotingHost::AddStatusObserver(HostStatusObserver* observer) { |
129 DCHECK(CalledOnValidThread()); | 129 DCHECK(CalledOnValidThread()); |
130 status_observers_.AddObserver(observer); | 130 status_observers_.AddObserver(observer); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 LOG(WARNING) << "Rejecting connection from " << session->jid() | 280 LOG(WARNING) << "Rejecting connection from " << session->jid() |
281 << " because no compatible configuration has been found."; | 281 << " because no compatible configuration has been found."; |
282 *response = protocol::SessionManager::INCOMPATIBLE; | 282 *response = protocol::SessionManager::INCOMPATIBLE; |
283 return; | 283 return; |
284 } | 284 } |
285 | 285 |
286 session->set_config(config); | 286 session->set_config(config); |
287 | 287 |
288 *response = protocol::SessionManager::ACCEPT; | 288 *response = protocol::SessionManager::ACCEPT; |
289 | 289 |
290 LOG(INFO) << "Client connected: " << session->jid(); | 290 LOG_INFO << "Client connected: " << session->jid(); |
291 | 291 |
292 // Create a client object. | 292 // Create a client object. |
293 scoped_ptr<protocol::ConnectionToClient> connection( | 293 scoped_ptr<protocol::ConnectionToClient> connection( |
294 new protocol::ConnectionToClient(session)); | 294 new protocol::ConnectionToClient(session)); |
295 ClientSession* client = new ClientSession( | 295 ClientSession* client = new ClientSession( |
296 this, | 296 this, |
297 audio_task_runner_, | 297 audio_task_runner_, |
298 input_task_runner_, | 298 input_task_runner_, |
299 video_capture_task_runner_, | 299 video_capture_task_runner_, |
300 video_encode_task_runner_, | 300 video_encode_task_runner_, |
(...skipping 18 matching lines...) Expand all Loading... |
319 DCHECK(CalledOnValidThread()); | 319 DCHECK(CalledOnValidThread()); |
320 | 320 |
321 while (!clients_.empty()) { | 321 while (!clients_.empty()) { |
322 size_t size = clients_.size(); | 322 size_t size = clients_.size(); |
323 clients_.front()->DisconnectSession(); | 323 clients_.front()->DisconnectSession(); |
324 CHECK_EQ(clients_.size(), size - 1); | 324 CHECK_EQ(clients_.size(), size - 1); |
325 } | 325 } |
326 } | 326 } |
327 | 327 |
328 } // namespace remoting | 328 } // namespace remoting |
OLD | NEW |