| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // @file | 5 // @file |
| 6 // ICeeeBroker implementation. | 6 // ICeeeBroker implementation. |
| 7 | 7 |
| 8 #ifndef CEEE_IE_BROKER_BROKER_H_ | 8 #ifndef CEEE_IE_BROKER_BROKER_H_ |
| 9 #define CEEE_IE_BROKER_BROKER_H_ | 9 #define CEEE_IE_BROKER_BROKER_H_ |
| 10 | 10 |
| 11 #include <atlbase.h> | 11 #include <atlbase.h> |
| 12 #include <atlcom.h> | 12 #include <atlcom.h> |
| 13 | 13 |
| 14 #include "ceee/ie/broker/resource.h" | 14 #include "ceee/ie/broker/resource.h" |
| 15 | 15 |
| 16 #include "broker_lib.h" // NOLINT | 16 #include "broker_lib.h" // NOLINT |
| 17 | 17 |
| 18 class ExecutorsManager; | 18 class ExecutorsManager; |
| 19 class ApiDispatcher; | 19 class ApiDispatcher; |
| 20 | 20 |
| 21 // The CEEE user Broker is a COM object exposed from an executable server | 21 // The CEEE user Broker is a COM object exposed from an executable server |
| 22 // so that we can call it to execute code in destination threads of other | 22 // so that we can call it to execute code in destination threads of other |
| 23 // processes, even if they run at a hight integrity level. | 23 // processes, even if they run at a hight integrity level. |
| 24 | 24 |
| 25 // Entry point to execute code in specific destination threads. | 25 // Entry point to execute code in specific destination threads. |
| 26 class ATL_NO_VTABLE CeeeBroker | 26 class ATL_NO_VTABLE CeeeBroker |
| 27 : public CComObjectRootEx<CComMultiThreadModel>, | 27 : public CComObjectRootEx<CComMultiThreadModel>, |
| 28 public CComCoClass<CeeeBroker, &CLSID_CeeeBroker>, | 28 public CComCoClass<CeeeBroker, &CLSID_CeeeBroker>, |
| 29 public ICeeeBroker, | 29 public ICeeeBroker, |
| 30 public ICeeeBrokerRegistrar, | 30 public ICeeeBrokerRegistrar { |
| 31 public IExternalConnectionImpl<CeeeBroker> { | |
| 32 public: | 31 public: |
| 33 DECLARE_REGISTRY_RESOURCEID(IDR_BROKER) | 32 DECLARE_REGISTRY_RESOURCEID(IDR_BROKER) |
| 34 | 33 |
| 35 DECLARE_NOT_AGGREGATABLE(CeeeBroker) | 34 DECLARE_NOT_AGGREGATABLE(CeeeBroker) |
| 36 BEGIN_COM_MAP(CeeeBroker) | 35 BEGIN_COM_MAP(CeeeBroker) |
| 37 COM_INTERFACE_ENTRY(IExternalConnection) | |
| 38 COM_INTERFACE_ENTRY(ICeeeBrokerRegistrar) | 36 COM_INTERFACE_ENTRY(ICeeeBrokerRegistrar) |
| 39 COM_INTERFACE_ENTRY(ICeeeBroker) | 37 COM_INTERFACE_ENTRY(ICeeeBroker) |
| 40 END_COM_MAP() | 38 END_COM_MAP() |
| 41 DECLARE_PROTECT_FINAL_CONSTRUCT() | 39 DECLARE_PROTECT_FINAL_CONSTRUCT() |
| 42 | 40 |
| 43 // To set get our pointer to the ExecutorsManager and let tests override it. | 41 // To set get our pointer to the ExecutorsManager and let tests override it. |
| 44 virtual HRESULT FinalConstruct(); | 42 virtual HRESULT FinalConstruct(); |
| 45 | 43 |
| 46 // @name ICeeeBroker implementation. | 44 // @name ICeeeBroker implementation. |
| 47 // @{ | 45 // @{ |
| 48 STDMETHOD(Execute)(BSTR function, BSTR* response); | 46 STDMETHOD(Execute)(BSTR function, BSTR* response); |
| 49 STDMETHOD(FireEvent)(BSTR event_name, BSTR event_args); | 47 STDMETHOD(FireEvent)(BSTR event_name, BSTR event_args); |
| 50 // @} | 48 // @} |
| 51 | 49 |
| 52 // @name ICeeeBrokerRegistrar implementation. | 50 // @name ICeeeBrokerRegistrar implementation. |
| 53 // @{ | 51 // @{ |
| 54 STDMETHOD(RegisterWindowExecutor)(long thread_id, IUnknown* executor); | 52 STDMETHOD(RegisterWindowExecutor)(long thread_id, IUnknown* executor); |
| 55 STDMETHOD(RegisterTabExecutor)(long thread_id, IUnknown* executor); | 53 STDMETHOD(RegisterTabExecutor)(long thread_id, IUnknown* executor); |
| 56 STDMETHOD(UnregisterExecutor)(long thread_id); | 54 STDMETHOD(UnregisterExecutor)(long thread_id); |
| 57 STDMETHOD(SetTabIdForHandle)(long tab_id, CeeeWindowHandle handle); | 55 STDMETHOD(SetTabIdForHandle)(long tab_id, CeeeWindowHandle handle); |
| 58 // @} | 56 // @} |
| 59 | 57 |
| 60 // IExternalConnectionImpl overrides | |
| 61 void OnAddConnection(bool first_lock); | |
| 62 void OnReleaseConnection(bool last_unlock, bool last_unlock_releases); | |
| 63 | |
| 64 protected: | 58 protected: |
| 65 // A pointer to single instance objects, or seams set for unittests. | 59 // A pointer to single instance objects, or seams set for unittests. |
| 66 ExecutorsManager * executors_manager_; | 60 ExecutorsManager * executors_manager_; |
| 67 ApiDispatcher* api_dispatcher_; | 61 ApiDispatcher* api_dispatcher_; |
| 68 }; | 62 }; |
| 69 | 63 |
| 70 #endif // CEEE_IE_BROKER_BROKER_H_ | 64 #endif // CEEE_IE_BROKER_BROKER_H_ |
| OLD | NEW |