| 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_win.h" | 5 #include "remoting/host/desktop_session_win.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <sddl.h> | 8 #include <sddl.h> |
| 9 | 9 |
| 10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 218 |
| 219 // Create the RDP wrapper object. | 219 // Create the RDP wrapper object. |
| 220 HRESULT result = rdp_desktop_session_.CreateInstance( | 220 HRESULT result = rdp_desktop_session_.CreateInstance( |
| 221 __uuidof(RdpDesktopSession)); | 221 __uuidof(RdpDesktopSession)); |
| 222 if (FAILED(result)) { | 222 if (FAILED(result)) { |
| 223 LOG(ERROR) << "Failed to create RdpSession object, 0x" | 223 LOG(ERROR) << "Failed to create RdpSession object, 0x" |
| 224 << std::hex << result << std::dec << "."; | 224 << std::hex << result << std::dec << "."; |
| 225 return false; | 225 return false; |
| 226 } | 226 } |
| 227 | 227 |
| 228 // DaemonProcess::CreateDesktopSession() verifies that the resolution is | |
| 229 // valid. | |
| 230 DCHECK(resolution.IsValid()); | |
| 231 | |
| 232 ScreenResolution local_resolution = resolution; | 228 ScreenResolution local_resolution = resolution; |
| 233 | 229 |
| 234 // If the screen resolution is not specified, use the default screen | 230 // If the screen resolution is not specified, use the default screen |
| 235 // resolution. | 231 // resolution. |
| 236 if (local_resolution.IsEmpty()) { | 232 if (local_resolution.IsEmpty()) { |
| 237 local_resolution.dimensions_.set(kDefaultRdpScreenWidth, | 233 local_resolution = ScreenResolution( |
| 238 kDefaultRdpScreenHeight); | 234 webrtc::DesktopSize(kDefaultRdpScreenWidth, kDefaultRdpScreenHeight), |
| 239 local_resolution.dpi_.set(kDefaultRdpDpi, kDefaultRdpDpi); | 235 webrtc::DesktopVector(kDefaultRdpDpi, kDefaultRdpDpi)); |
| 240 } | 236 } |
| 241 | 237 |
| 242 // Get the screen dimensions assuming the default DPI. | 238 // Get the screen dimensions assuming the default DPI. |
| 243 SkISize host_size = local_resolution.ScaleDimensionsToDpi( | 239 webrtc::DesktopSize host_size = local_resolution.ScaleDimensionsToDpi( |
| 244 SkIPoint::Make(kDefaultRdpDpi, kDefaultRdpDpi)); | 240 webrtc::DesktopVector(kDefaultRdpDpi, kDefaultRdpDpi)); |
| 245 | 241 |
| 246 // Make sure that the host resolution is within the limits supported by RDP. | 242 // Make sure that the host resolution is within the limits supported by RDP. |
| 247 host_size = SkISize::Make( | 243 host_size = webrtc::DesktopSize( |
| 248 std::min(kMaxRdpScreenWidth, | 244 std::min(kMaxRdpScreenWidth, |
| 249 std::max(kMinRdpScreenWidth, host_size.width())), | 245 std::max(kMinRdpScreenWidth, host_size.width())), |
| 250 std::min(kMaxRdpScreenHeight, | 246 std::min(kMaxRdpScreenHeight, |
| 251 std::max(kMinRdpScreenHeight, host_size.height()))); | 247 std::max(kMinRdpScreenHeight, host_size.height()))); |
| 252 | 248 |
| 253 // Create an RDP session. | 249 // Create an RDP session. |
| 254 base::win::ScopedComPtr<IRdpDesktopSessionEventHandler> event_handler( | 250 base::win::ScopedComPtr<IRdpDesktopSessionEventHandler> event_handler( |
| 255 new EventHandler(weak_factory_.GetWeakPtr())); | 251 new EventHandler(weak_factory_.GetWeakPtr())); |
| 256 result = rdp_desktop_session_->Connect(host_size.width(), | 252 result = rdp_desktop_session_->Connect(host_size.width(), |
| 257 host_size.height(), | 253 host_size.height(), |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 } | 550 } |
| 555 | 551 |
| 556 void DesktopSessionWin::CrashDesktopProcess( | 552 void DesktopSessionWin::CrashDesktopProcess( |
| 557 const tracked_objects::Location& location) { | 553 const tracked_objects::Location& location) { |
| 558 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 554 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 559 | 555 |
| 560 launcher_->Crash(location); | 556 launcher_->Crash(location); |
| 561 } | 557 } |
| 562 | 558 |
| 563 } // namespace remoting | 559 } // namespace remoting |
| OLD | NEW |