| 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/desktop_session_agent.h" | 5 #include "remoting/host/desktop_session_agent.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 } // namespace | 154 } // namespace |
| 155 | 155 |
| 156 DesktopSessionAgent::Delegate::~Delegate() {} | 156 DesktopSessionAgent::Delegate::~Delegate() {} |
| 157 | 157 |
| 158 DesktopSessionAgent::DesktopSessionAgent( | 158 DesktopSessionAgent::DesktopSessionAgent( |
| 159 scoped_refptr<AutoThreadTaskRunner> audio_capture_task_runner, | 159 scoped_refptr<AutoThreadTaskRunner> audio_capture_task_runner, |
| 160 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 160 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
| 161 scoped_refptr<AutoThreadTaskRunner> input_task_runner, | 161 scoped_refptr<AutoThreadTaskRunner> input_task_runner, |
| 162 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 162 scoped_refptr<AutoThreadTaskRunner> io_task_runner) |
| 163 const DesktopEnvironmentOptions& desktop_environment_options) | |
| 164 : audio_capture_task_runner_(audio_capture_task_runner), | 163 : audio_capture_task_runner_(audio_capture_task_runner), |
| 165 caller_task_runner_(caller_task_runner), | 164 caller_task_runner_(caller_task_runner), |
| 166 input_task_runner_(input_task_runner), | 165 input_task_runner_(input_task_runner), |
| 167 io_task_runner_(io_task_runner), | 166 io_task_runner_(io_task_runner), |
| 168 desktop_environment_options_(desktop_environment_options), | |
| 169 weak_factory_(this) { | 167 weak_factory_(this) { |
| 170 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 168 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 171 } | 169 } |
| 172 | 170 |
| 173 bool DesktopSessionAgent::OnMessageReceived(const IPC::Message& message) { | 171 bool DesktopSessionAgent::OnMessageReceived(const IPC::Message& message) { |
| 174 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 172 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 175 | 173 |
| 176 bool handled = true; | 174 bool handled = true; |
| 177 if (started_) { | 175 if (started_) { |
| 178 IPC_BEGIN_MESSAGE_MAP(DesktopSessionAgent, message) | 176 IPC_BEGIN_MESSAGE_MAP(DesktopSessionAgent, message) |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 void DesktopSessionAgent::SetDisableInputs(bool disable_inputs) { | 246 void DesktopSessionAgent::SetDisableInputs(bool disable_inputs) { |
| 249 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 247 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 250 | 248 |
| 251 // Do not expect this method to be called because it is only used by It2Me. | 249 // Do not expect this method to be called because it is only used by It2Me. |
| 252 NOTREACHED(); | 250 NOTREACHED(); |
| 253 } | 251 } |
| 254 | 252 |
| 255 void DesktopSessionAgent::OnStartSessionAgent( | 253 void DesktopSessionAgent::OnStartSessionAgent( |
| 256 const std::string& authenticated_jid, | 254 const std::string& authenticated_jid, |
| 257 const ScreenResolution& resolution, | 255 const ScreenResolution& resolution, |
| 258 bool virtual_terminal) { | 256 const remoting::DesktopEnvironmentOptions& options) { |
| 259 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 257 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 260 DCHECK(!started_); | 258 DCHECK(!started_); |
| 261 DCHECK(!audio_capturer_); | 259 DCHECK(!audio_capturer_); |
| 262 DCHECK(!desktop_environment_); | 260 DCHECK(!desktop_environment_); |
| 263 DCHECK(!input_injector_); | 261 DCHECK(!input_injector_); |
| 264 DCHECK(!screen_controls_); | 262 DCHECK(!screen_controls_); |
| 265 DCHECK(!video_capturer_); | 263 DCHECK(!video_capturer_); |
| 266 | 264 |
| 267 started_ = true; | 265 started_ = true; |
| 268 client_jid_ = authenticated_jid; | 266 client_jid_ = authenticated_jid; |
| 269 | 267 |
| 270 DesktopEnvironmentOptions options = desktop_environment_options_; | |
| 271 // Enable the curtain mode. | |
| 272 options.set_enable_curtaining(virtual_terminal); | |
| 273 | |
| 274 // Create a desktop environment for the new session. | 268 // Create a desktop environment for the new session. |
| 275 desktop_environment_ = delegate_->desktop_environment_factory().Create( | 269 desktop_environment_ = delegate_->desktop_environment_factory().Create( |
| 276 weak_factory_.GetWeakPtr(), options); | 270 weak_factory_.GetWeakPtr(), options); |
| 277 | 271 |
| 278 // Create the session controller and set the initial screen resolution. | 272 // Create the session controller and set the initial screen resolution. |
| 279 screen_controls_ = desktop_environment_->CreateScreenControls(); | 273 screen_controls_ = desktop_environment_->CreateScreenControls(); |
| 280 SetScreenResolution(resolution); | 274 SetScreenResolution(resolution); |
| 281 | 275 |
| 282 // Create the input injector. | 276 // Create the input injector. |
| 283 input_injector_ = desktop_environment_->CreateInputInjector(); | 277 input_injector_ = desktop_environment_->CreateInputInjector(); |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 } | 553 } |
| 560 } | 554 } |
| 561 | 555 |
| 562 void DesktopSessionAgent::StopAudioCapturer() { | 556 void DesktopSessionAgent::StopAudioCapturer() { |
| 563 DCHECK(audio_capture_task_runner_->BelongsToCurrentThread()); | 557 DCHECK(audio_capture_task_runner_->BelongsToCurrentThread()); |
| 564 | 558 |
| 565 audio_capturer_.reset(); | 559 audio_capturer_.reset(); |
| 566 } | 560 } |
| 567 | 561 |
| 568 } // namespace remoting | 562 } // namespace remoting |
| OLD | NEW |