Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / remoting / host / win / rdp_desktop_session.cc
blobe7c3c2ba9c2386732ee1535c0c8b0a38c652121e
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"
10 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
12 namespace remoting {
14 RdpDesktopSession::RdpDesktopSession() {
17 STDMETHODIMP RdpDesktopSession::Connect(
18 long width,
19 long height,
20 BSTR terminal_id,
21 IRdpDesktopSessionEventHandler* event_handler) {
22 event_handler_ = event_handler;
24 scoped_refptr<AutoThreadTaskRunner> task_runner =
25 ChromotingModule::task_runner();
26 DCHECK(task_runner->BelongsToCurrentThread());
28 client_.reset(new RdpClient(task_runner, task_runner,
29 webrtc::DesktopSize(width, height),
30 base::UTF16ToUTF8(terminal_id), this));
31 return S_OK;
34 STDMETHODIMP RdpDesktopSession::Disconnect() {
35 client_.reset();
36 event_handler_ = nullptr;
37 return S_OK;
40 STDMETHODIMP RdpDesktopSession::ChangeResolution(long width, long height) {
41 return E_NOTIMPL;
44 STDMETHODIMP RdpDesktopSession::InjectSas() {
45 if (client_)
46 client_->InjectSas();
47 return S_OK;
50 void RdpDesktopSession::OnRdpConnected() {
51 HRESULT result = event_handler_->OnRdpConnected();
52 CHECK(SUCCEEDED(result)) << "OnRdpConnected() failed: 0x"
53 << std::hex << result << std::dec << ".";
56 void RdpDesktopSession::OnRdpClosed() {
57 HRESULT result = event_handler_->OnRdpClosed();
58 CHECK(SUCCEEDED(result)) << "OnRdpClosed() failed: 0x" << std::hex << result
59 << std::dec << ".";
62 } // namespace remoting