Only sync parent directory once after a leveldb file rename.
[chromium-blink-merge.git] / remoting / host / win / rdp_desktop_session.h
blobf48512b82f342117c48412c7cc36e24317615aea
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 net {
19 class IPEndPoint;
20 } // namespace net
22 namespace remoting {
24 // Implements IRdpDesktopSession interface providing a way to host RdpClient
25 // objects in a COM component.
26 class __declspec(uuid(RDP_DESKTOP_SESSION_CLSID)) RdpDesktopSession
27 : public ATL::CComObjectRootEx<ATL::CComSingleThreadModel>,
28 public ATL::CComCoClass<RdpDesktopSession, &__uuidof(RdpDesktopSession)>,
29 public IRdpDesktopSession,
30 public RdpClient::EventHandler {
31 public:
32 // Declare a class factory which must not lock the ATL module. This is the
33 // same as DECLARE_CLASSFACTORY() with the exception that
34 // ATL::CComObjectNoLock is used unconditionally.
36 // By default ATL generates locking class factories (by wrapping them in
37 // ATL::CComObjectCached) for classes hosted in a DLL. This class is compiled
38 // into a DLL but it is registered as an out-of-process class, so its class
39 // factory should not use locking.
40 typedef ATL::CComCreator<ATL::CComObjectNoLock<ATL::CComClassFactory> >
41 _ClassFactoryCreatorClass;
43 RdpDesktopSession();
45 // IRdpDesktopSession implementation.
46 STDMETHOD(Connect)(long width, long height,
47 IRdpDesktopSessionEventHandler* event_handler);
48 STDMETHOD(Disconnect)();
49 STDMETHOD(ChangeResolution)(long width, long height);
51 DECLARE_NO_REGISTRY()
53 private:
54 // RdpClient::EventHandler interface.
55 virtual void OnRdpConnected(const net::IPEndPoint& client_endpoint) OVERRIDE;
56 virtual 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_