MD Downloads: prevent search text from overlapping with the cancel search (X)
[chromium-blink-merge.git] / remoting / host / win / rdp_desktop_session.cc
blob788d06a20ab327d2be88dc5f85788f2e9f9dec31
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 RdpDesktopSession::~RdpDesktopSession() {
20 STDMETHODIMP RdpDesktopSession::Connect(
21 long width,
22 long height,
23 BSTR terminal_id,
24 IRdpDesktopSessionEventHandler* event_handler) {
25 event_handler_ = event_handler;
27 scoped_refptr<AutoThreadTaskRunner> task_runner =
28 ChromotingModule::task_runner();
29 DCHECK(task_runner->BelongsToCurrentThread());
31 client_.reset(new RdpClient(task_runner, task_runner,
32 webrtc::DesktopSize(width, height),
33 base::UTF16ToUTF8(terminal_id), this));
34 return S_OK;
37 STDMETHODIMP RdpDesktopSession::Disconnect() {
38 client_.reset();
39 event_handler_ = nullptr;
40 return S_OK;
43 STDMETHODIMP RdpDesktopSession::ChangeResolution(long width, long height) {
44 return E_NOTIMPL;
47 STDMETHODIMP RdpDesktopSession::InjectSas() {
48 if (client_)
49 client_->InjectSas();
50 return S_OK;
53 void RdpDesktopSession::OnRdpConnected() {
54 HRESULT result = event_handler_->OnRdpConnected();
55 CHECK(SUCCEEDED(result)) << "OnRdpConnected() failed: 0x"
56 << std::hex << result << std::dec << ".";
59 void RdpDesktopSession::OnRdpClosed() {
60 HRESULT result = event_handler_->OnRdpClosed();
61 CHECK(SUCCEEDED(result)) << "OnRdpClosed() failed: 0x" << std::hex << result
62 << std::dec << ".";
65 } // namespace remoting