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
3 // found in the LICENSE file.
5 #include "remoting/host/win/rdp_desktop_session.h"
7 #include "base/strings/utf_string_conversions.h"
8 #include "remoting/base/auto_thread_task_runner.h"
9 #include "remoting/host/win/chromoting_module.h"
13 RdpDesktopSession::RdpDesktopSession() {
16 STDMETHODIMP RdpDesktopSession::Connect(
20 IRdpDesktopSessionEventHandler* event_handler) {
21 event_handler_ = event_handler;
23 scoped_refptr<AutoThreadTaskRunner> task_runner =
24 ChromotingModule::task_runner();
25 DCHECK(task_runner->BelongsToCurrentThread());
27 client_.reset(new RdpClient(task_runner, task_runner,
28 SkISize::Make(width, height),
29 UTF16ToUTF8(terminal_id), this));
33 STDMETHODIMP RdpDesktopSession::Disconnect() {
35 event_handler_ = NULL;
39 STDMETHODIMP RdpDesktopSession::ChangeResolution(long width, long height) {
43 STDMETHODIMP RdpDesktopSession::InjectSas() {
49 void RdpDesktopSession::OnRdpConnected() {
50 HRESULT result = event_handler_->OnRdpConnected();
51 CHECK(SUCCEEDED(result)) << "OnRdpConnected() failed: 0x"
52 << std::hex << result << std::dec << ".";
55 void RdpDesktopSession::OnRdpClosed() {
56 HRESULT result = event_handler_->OnRdpClosed();
57 CHECK(SUCCEEDED(result)) << "OnRdpClosed() failed: 0x" << std::hex << result
61 } // namespace remoting