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