| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/win/rdp_client_window.h" | 5 #include "remoting/host/win/rdp_client_window.h" |
| 6 | 6 |
| 7 #include <wtsdefs.h> | 7 #include <wtsdefs.h> |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 | 10 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 : event_handler_(event_handler), | 124 : event_handler_(event_handler), |
| 125 server_endpoint_(server_endpoint), | 125 server_endpoint_(server_endpoint), |
| 126 terminal_id_(terminal_id) { | 126 terminal_id_(terminal_id) { |
| 127 } | 127 } |
| 128 | 128 |
| 129 RdpClientWindow::~RdpClientWindow() { | 129 RdpClientWindow::~RdpClientWindow() { |
| 130 if (m_hWnd) { | 130 if (m_hWnd) { |
| 131 DestroyWindow(); | 131 DestroyWindow(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 DCHECK(!client_.get()); | 134 DCHECK(!client_.Get()); |
| 135 DCHECK(!client_9_.get()); | 135 DCHECK(!client_9_.Get()); |
| 136 DCHECK(!client_settings_.get()); | 136 DCHECK(!client_settings_.Get()); |
| 137 } | 137 } |
| 138 | 138 |
| 139 bool RdpClientWindow::Connect(const ScreenResolution& resolution) { | 139 bool RdpClientWindow::Connect(const ScreenResolution& resolution) { |
| 140 DCHECK(!m_hWnd); | 140 DCHECK(!m_hWnd); |
| 141 | 141 |
| 142 screen_resolution_ = resolution; | 142 screen_resolution_ = resolution; |
| 143 RECT rect = {0, 0, screen_resolution_.dimensions().width(), | 143 RECT rect = {0, 0, screen_resolution_.dimensions().width(), |
| 144 screen_resolution_.dimensions().height()}; | 144 screen_resolution_.dimensions().height()}; |
| 145 bool result = Create(nullptr, rect, nullptr) != nullptr; | 145 bool result = Create(nullptr, rect, nullptr) != nullptr; |
| 146 | 146 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 apply_resolution_timer_.Stop(); | 227 apply_resolution_timer_.Stop(); |
| 228 screen_resolution_ = resolution; | 228 screen_resolution_ = resolution; |
| 229 HRESULT result = UpdateDesktopResolution(); | 229 HRESULT result = UpdateDesktopResolution(); |
| 230 if (FAILED(result)) { | 230 if (FAILED(result)) { |
| 231 LOG(WARNING) << "UpdateSessionDisplaySettings() failed: 0x" << std::hex | 231 LOG(WARNING) << "UpdateSessionDisplaySettings() failed: 0x" << std::hex |
| 232 << result; | 232 << result; |
| 233 } | 233 } |
| 234 } | 234 } |
| 235 | 235 |
| 236 void RdpClientWindow::OnClose() { | 236 void RdpClientWindow::OnClose() { |
| 237 if (!client_.get()) { | 237 if (!client_.Get()) { |
| 238 NotifyDisconnected(); | 238 NotifyDisconnected(); |
| 239 return; | 239 return; |
| 240 } | 240 } |
| 241 | 241 |
| 242 // Request a graceful shutdown. | 242 // Request a graceful shutdown. |
| 243 mstsc::ControlCloseStatus close_status; | 243 mstsc::ControlCloseStatus close_status; |
| 244 HRESULT result = client_->RequestClose(&close_status); | 244 HRESULT result = client_->RequestClose(&close_status); |
| 245 if (FAILED(result)) { | 245 if (FAILED(result)) { |
| 246 LOG(ERROR) << "Failed to request a graceful shutdown of an RDP connection" | 246 LOG(ERROR) << "Failed to request a graceful shutdown of an RDP connection" |
| 247 << ", result=0x" << std::hex << result; | 247 << ", result=0x" << std::hex << result; |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 } | 609 } |
| 610 | 610 |
| 611 // Close the window once all pending window messages are processed. | 611 // Close the window once all pending window messages are processed. |
| 612 HWND window = reinterpret_cast<HWND>(wparam); | 612 HWND window = reinterpret_cast<HWND>(wparam); |
| 613 LOG(WARNING) << "RDP: closing a window: " << std::hex << window; | 613 LOG(WARNING) << "RDP: closing a window: " << std::hex << window; |
| 614 ::PostMessage(window, WM_CLOSE, 0, 0); | 614 ::PostMessage(window, WM_CLOSE, 0, 0); |
| 615 return 0; | 615 return 0; |
| 616 } | 616 } |
| 617 | 617 |
| 618 } // namespace remoting | 618 } // namespace remoting |
| OLD | NEW |