Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / remoting / host / win / rdp_desktop_session.h
blob682c3f5040d12d127d53fa95e5d8f39f01098389
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 #ifndef REMOTING_HOST_WIN_RDP_DESKTOP_SESSION_H_
6 #define REMOTING_HOST_WIN_RDP_DESKTOP_SESSION_H_
8 #include <atlbase.h>
9 #include <atlcom.h>
10 #include <atlctl.h>
12 #include "base/memory/scoped_ptr.h"
13 #include "base/win/scoped_comptr.h"
14 // chromoting_lib.h contains MIDL-generated declarations.
15 #include "remoting/host/chromoting_lib.h"
16 #include "remoting/host/win/rdp_client.h"
18 namespace remoting {
20 // Implements IRdpDesktopSession interface providing a way to host RdpClient
21 // objects in a COM component.
22 class __declspec(uuid(RDP_DESKTOP_SESSION_CLSID)) RdpDesktopSession
23 : public ATL::CComObjectRootEx<ATL::CComSingleThreadModel>,
24 public ATL::CComCoClass<RdpDesktopSession, &__uuidof(RdpDesktopSession)>,
25 public IRdpDesktopSession,
26 public RdpClient::EventHandler {
27 public:
28 // Declare a class factory which must not lock the ATL module. This is the
29 // same as DECLARE_CLASSFACTORY() with the exception that
30 // ATL::CComObjectNoLock is used unconditionally.
32 // By default ATL generates locking class factories (by wrapping them in
33 // ATL::CComObjectCached) for classes hosted in a DLL. This class is compiled
34 // into a DLL but it is registered as an out-of-process class, so its class
35 // factory should not use locking.
36 typedef ATL::CComCreator<ATL::CComObjectNoLock<ATL::CComClassFactory> >
37 _ClassFactoryCreatorClass;
39 RdpDesktopSession();
41 // IRdpDesktopSession implementation.
42 STDMETHOD(Connect)(long width, long height, BSTR terminal_id,
43 IRdpDesktopSessionEventHandler* event_handler);
44 STDMETHOD(Disconnect)();
45 STDMETHOD(ChangeResolution)(long width, long height);
46 STDMETHOD(InjectSas)();
48 DECLARE_NO_REGISTRY()
50 private:
51 // RdpClient::EventHandler interface.
52 virtual void OnRdpConnected() OVERRIDE;
53 virtual void OnRdpClosed() OVERRIDE;
55 BEGIN_COM_MAP(RdpDesktopSession)
56 COM_INTERFACE_ENTRY(IRdpDesktopSession)
57 COM_INTERFACE_ENTRY(IUnknown)
58 END_COM_MAP()
60 // Implements loading and instantiation of the RDP ActiveX client.
61 scoped_ptr<RdpClient> client_;
63 // Holds a reference to the caller's EventHandler, through which notifications
64 // are dispatched. Released in Disconnect(), to prevent further notifications.
65 base::win::ScopedComPtr<IRdpDesktopSessionEventHandler> event_handler_;
67 DECLARE_PROTECT_FINAL_CONSTRUCT()
70 } // namespace remoting
72 #endif // REMOTING_HOST_WIN_RDP_DESKTOP_SESSION_H_