| 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_desktop_session.h" | 5 #include "remoting/host/win/rdp_desktop_session.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "remoting/base/auto_thread_task_runner.h" | 8 #include "remoting/base/auto_thread_task_runner.h" |
| 9 #include "remoting/host/win/chromoting_module.h" | 9 #include "remoting/host/win/chromoting_module.h" |
| 10 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 10 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| 11 | 11 |
| 12 namespace remoting { | 12 namespace remoting { |
| 13 | 13 |
| 14 RdpDesktopSession::RdpDesktopSession() { | 14 RdpDesktopSession::RdpDesktopSession() { |
| 15 } | 15 } |
| 16 | 16 |
| 17 RdpDesktopSession::~RdpDesktopSession() { | 17 RdpDesktopSession::~RdpDesktopSession() { |
| 18 } | 18 } |
| 19 | 19 |
| 20 STDMETHODIMP RdpDesktopSession::Connect( | 20 STDMETHODIMP RdpDesktopSession::Connect( |
| 21 long width, | 21 long width, |
| 22 long height, | 22 long height, |
| 23 BSTR terminal_id, | 23 BSTR terminal_id, |
| 24 DWORD port_number, |
| 24 IRdpDesktopSessionEventHandler* event_handler) { | 25 IRdpDesktopSessionEventHandler* event_handler) { |
| 25 event_handler_ = event_handler; | 26 event_handler_ = event_handler; |
| 26 | 27 |
| 27 scoped_refptr<AutoThreadTaskRunner> task_runner = | 28 scoped_refptr<AutoThreadTaskRunner> task_runner = |
| 28 ChromotingModule::task_runner(); | 29 ChromotingModule::task_runner(); |
| 29 DCHECK(task_runner->BelongsToCurrentThread()); | 30 DCHECK(task_runner->BelongsToCurrentThread()); |
| 30 | 31 |
| 31 client_.reset(new RdpClient(task_runner, task_runner, | 32 client_.reset(new RdpClient( |
| 32 webrtc::DesktopSize(width, height), | 33 task_runner, task_runner, webrtc::DesktopSize(width, height), |
| 33 base::UTF16ToUTF8(terminal_id), this)); | 34 base::UTF16ToUTF8(terminal_id), port_number, this)); |
| 34 return S_OK; | 35 return S_OK; |
| 35 } | 36 } |
| 36 | 37 |
| 37 STDMETHODIMP RdpDesktopSession::Disconnect() { | 38 STDMETHODIMP RdpDesktopSession::Disconnect() { |
| 38 client_.reset(); | 39 client_.reset(); |
| 39 event_handler_ = nullptr; | 40 event_handler_ = nullptr; |
| 40 return S_OK; | 41 return S_OK; |
| 41 } | 42 } |
| 42 | 43 |
| 43 STDMETHODIMP RdpDesktopSession::ChangeResolution(long width, long height) { | 44 STDMETHODIMP RdpDesktopSession::ChangeResolution(long width, long height) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 56 << std::hex << result << std::dec << "."; | 57 << std::hex << result << std::dec << "."; |
| 57 } | 58 } |
| 58 | 59 |
| 59 void RdpDesktopSession::OnRdpClosed() { | 60 void RdpDesktopSession::OnRdpClosed() { |
| 60 HRESULT result = event_handler_->OnRdpClosed(); | 61 HRESULT result = event_handler_->OnRdpClosed(); |
| 61 CHECK(SUCCEEDED(result)) << "OnRdpClosed() failed: 0x" << std::hex << result | 62 CHECK(SUCCEEDED(result)) << "OnRdpClosed() failed: 0x" << std::hex << result |
| 62 << std::dec << "."; | 63 << std::dec << "."; |
| 63 } | 64 } |
| 64 | 65 |
| 65 } // namespace remoting | 66 } // namespace remoting |
| OLD | NEW |