BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / remoting / host / win / rdp_desktop_session.h
blob94237a6b203e18970549c6046c8de5b43356557d
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();
40 ~RdpDesktopSession() override;
42 // IRdpDesktopSession implementation.
43 STDMETHOD(Connect)(long width,
44 long height,
45 BSTR terminal_id,
46 IRdpDesktopSessionEventHandler* event_handler) override;
47 STDMETHOD(Disconnect)() override;
48 STDMETHOD(ChangeResolution)(long width, long height) override;
49 STDMETHOD(InjectSas)() override;
51 DECLARE_NO_REGISTRY()
53 private:
54 // RdpClient::EventHandler interface.
55 void OnRdpConnected() override;
56 void OnRdpClosed() override;
58 BEGIN_COM_MAP(RdpDesktopSession)
59 COM_INTERFACE_ENTRY(IRdpDesktopSession)
60 COM_INTERFACE_ENTRY(IUnknown)
61 END_COM_MAP()
63 // Implements loading and instantiation of the RDP ActiveX client.
64 scoped_ptr<RdpClient> client_;
66 // Holds a reference to the caller's EventHandler, through which notifications
67 // are dispatched. Released in Disconnect(), to prevent further notifications.
68 base::win::ScopedComPtr<IRdpDesktopSessionEventHandler> event_handler_;
70 DECLARE_PROTECT_FINAL_CONSTRUCT()
73 } // namespace remoting
75 #endif // REMOTING_HOST_WIN_RDP_DESKTOP_SESSION_H_