1 // Copyright (c) 2012 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_ELEVATED_CONTROLLER_H_
6 #define REMOTING_HOST_WIN_ELEVATED_CONTROLLER_H_
12 #include "remoting/base/scoped_sc_handle_win.h"
14 // chromoting_lib.h contains MIDL-generated declarations.
15 #include "remoting/host/chromoting_lib.h"
19 class __declspec(uuid(DAEMON_CONTROLLER_CLSID)) ElevatedController
20 : public ATL::CComObjectRootEx<ATL::CComSingleThreadModel>,
21 public ATL::CComCoClass<ElevatedController,
22 &__uuidof(ElevatedController)>,
23 public ATL::IDispatchImpl<IDaemonControl2, &IID_IDaemonControl2,
24 &LIBID_ChromotingLib, 1, 0> {
26 // Declare a class factory which must not lock the ATL module. This is the
27 // same as DECLARE_CLASSFACTORY() with the exception that
28 // ATL::CComObjectNoLock is used unconditionally.
30 // By default ATL generates locking class factories (by wrapping them in
31 // ATL::CComObjectCached) for classes hosted in a DLL. This class is compiled
32 // into a DLL but it is registered as an out-of-process class, so its class
33 // factory should not use locking.
34 typedef ATL::CComCreator<ATL::CComObjectNoLock<ATL::CComClassFactory> >
35 _ClassFactoryCreatorClass;
39 HRESULT FinalConstruct();
42 // IDaemonControl implementation.
43 STDMETHOD(GetConfig)(BSTR* config_out);
44 STDMETHOD(GetVersion)(BSTR* version_out);
45 STDMETHOD(SetConfig)(BSTR config);
46 STDMETHOD(SetOwnerWindow)(LONG_PTR owner_window);
47 STDMETHOD(StartDaemon)();
48 STDMETHOD(StopDaemon)();
49 STDMETHOD(UpdateConfig)(BSTR config);
51 // IDaemonControl2 implementation.
52 STDMETHOD(GetUsageStatsConsent)(BOOL* allowed, BOOL* set_by_policy);
53 STDMETHOD(SetUsageStatsConsent)(BOOL allowed);
58 HRESULT OpenService(ScopedScHandle* service_out);
60 BEGIN_COM_MAP(ElevatedController)
61 COM_INTERFACE_ENTRY(IDaemonControl)
62 COM_INTERFACE_ENTRY(IDaemonControl2)
63 COM_INTERFACE_ENTRY(IDispatch)
66 // Handle of the owner window (if any) for any UI to be shown.
69 DECLARE_PROTECT_FINAL_CONSTRUCT()
72 } // namespace remoting
74 #endif // REMOTING_HOST_WIN_ELEVATED_CONTROLLER_H_