blob: 682c3f5040d12d127d53fa95e5d8f39f01098389 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef REMOTING_HOST_WIN_RDP_DESKTOP_SESSION_H_
#define REMOTING_HOST_WIN_RDP_DESKTOP_SESSION_H_
#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>
#include "base/memory/scoped_ptr.h"
#include "base/win/scoped_comptr.h"
// chromoting_lib.h contains MIDL-generated declarations.
#include "remoting/host/chromoting_lib.h"
#include "remoting/host/win/rdp_client.h"
namespace remoting {
// Implements IRdpDesktopSession interface providing a way to host RdpClient
// objects in a COM component.
class __declspec(uuid(RDP_DESKTOP_SESSION_CLSID)) RdpDesktopSession
: public ATL::CComObjectRootEx<ATL::CComSingleThreadModel>,
public ATL::CComCoClass<RdpDesktopSession, &__uuidof(RdpDesktopSession)>,
public IRdpDesktopSession,
public RdpClient::EventHandler {
public:
// Declare a class factory which must not lock the ATL module. This is the
// same as DECLARE_CLASSFACTORY() with the exception that
// ATL::CComObjectNoLock is used unconditionally.
//
// By default ATL generates locking class factories (by wrapping them in
// ATL::CComObjectCached) for classes hosted in a DLL. This class is compiled
// into a DLL but it is registered as an out-of-process class, so its class
// factory should not use locking.
typedef ATL::CComCreator<ATL::CComObjectNoLock<ATL::CComClassFactory> >
_ClassFactoryCreatorClass;
RdpDesktopSession();
// IRdpDesktopSession implementation.
STDMETHOD(Connect)(long width, long height, BSTR terminal_id,
IRdpDesktopSessionEventHandler* event_handler);
STDMETHOD(Disconnect)();
STDMETHOD(ChangeResolution)(long width, long height);
STDMETHOD(InjectSas)();
DECLARE_NO_REGISTRY()
private:
// RdpClient::EventHandler interface.
virtual void OnRdpConnected() OVERRIDE;
virtual void OnRdpClosed() OVERRIDE;
BEGIN_COM_MAP(RdpDesktopSession)
COM_INTERFACE_ENTRY(IRdpDesktopSession)
COM_INTERFACE_ENTRY(IUnknown)
END_COM_MAP()
// Implements loading and instantiation of the RDP ActiveX client.
scoped_ptr<RdpClient> client_;
// Holds a reference to the caller's EventHandler, through which notifications
// are dispatched. Released in Disconnect(), to prevent further notifications.
base::win::ScopedComPtr<IRdpDesktopSessionEventHandler> event_handler_;
DECLARE_PROTECT_FINAL_CONSTRUCT()
};
} // namespace remoting
#endif // REMOTING_HOST_WIN_RDP_DESKTOP_SESSION_H_
|