Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

153 lines
4.7 KiB

  1. /******************************************************************************
  2. Copyright (c) 1999-2000 Microsoft Corporation
  3. Module Name:
  4. MarsHost.h
  5. Abstract:
  6. Initialization of mars
  7. Revision History:
  8. Anand Arvind (aarvind) 2000-01-05
  9. created
  10. Seong Kook Khang (SKKhang) 05/10/00
  11. Clean up for Whistler.
  12. ******************************************************************************/
  13. #ifndef _MARSHOST_H__INCLUDED_
  14. #define _MARSHOST_H__INCLUDED_
  15. #pragma once
  16. #include <atlcom.h>
  17. #include <atlwin.h>
  18. #include <atlhost.h>
  19. #include <atlctl.h>
  20. #include <exdisp.h>
  21. #include <exdispid.h>
  22. #include <marscore.h>
  23. //#define MARS_NEW
  24. /////////////////////////////////////////////////////////////////////////////
  25. //
  26. // CSRWebBrowserEvents
  27. //
  28. /////////////////////////////////////////////////////////////////////////////
  29. class CSRWebBrowserEvents;
  30. typedef IDispEventImpl<0,CSRWebBrowserEvents,&DIID_DWebBrowserEvents2,&LIBID_SHDocVw,1> CSRWebBrowserEvents_DispWBE2;
  31. class ATL_NO_VTABLE CSRWebBrowserEvents :
  32. public CComObjectRootEx<CComMultiThreadModel>,
  33. public CSRWebBrowserEvents_DispWBE2
  34. //public IDispEventImpl<0,CSRWebBrowserEvents,&DIID_DWebBrowserEvents2,&LIBID_SHDocVw,1>
  35. {
  36. public:
  37. CSRWebBrowserEvents();
  38. virtual ~CSRWebBrowserEvents();
  39. DECLARE_NO_REGISTRY()
  40. DECLARE_NOT_AGGREGATABLE(CSRWebBrowserEvents)
  41. DECLARE_PROTECT_FINAL_CONSTRUCT()
  42. BEGIN_COM_MAP(CSRWebBrowserEvents)
  43. COM_INTERFACE_ENTRY2(IDispatch, CSRWebBrowserEvents_DispWBE2)
  44. COM_INTERFACE_ENTRY2(DWebBrowserEvents2, CSRWebBrowserEvents_DispWBE2)
  45. //COM_INTERFACE_ENTRY(IDispatch)
  46. //COM_INTERFACE_ENTRY(DWebBrowserEvents2)
  47. END_COM_MAP()
  48. BEGIN_SINK_MAP(CSRWebBrowserEvents)
  49. SINK_ENTRY_EX(0, DIID_DWebBrowserEvents2, DISPID_BEFORENAVIGATE2, BeforeNavigate2 )
  50. SINK_ENTRY_EX(0, DIID_DWebBrowserEvents2, DISPID_NEWWINDOW2, NewWindow2 )
  51. SINK_ENTRY_EX(0, DIID_DWebBrowserEvents2, DISPID_NAVIGATECOMPLETE2, NavigateComplete2)
  52. SINK_ENTRY_EX(0, DIID_DWebBrowserEvents2, DISPID_DOCUMENTCOMPLETE, DocumentComplete )
  53. END_SINK_MAP()
  54. // Attributes
  55. protected:
  56. CComPtr<IWebBrowser2> m_pWB2;
  57. // Operations
  58. public:
  59. void Attach( /*[in]*/ IWebBrowser2* pWB );
  60. void Detach();
  61. // Event Handlers
  62. public:
  63. void __stdcall BeforeNavigate2( IDispatch *pDisp, VARIANT* URL, VARIANT* Flags, VARIANT* TargetFrameName, VARIANT* PostData, VARIANT* Headers, VARIANT_BOOL* Cancel );
  64. void __stdcall NewWindow2( IDispatch **ppDisp, VARIANT_BOOL* Cancel );
  65. void __stdcall NavigateComplete2( IDispatch *pDisp, VARIANT* URL );
  66. void __stdcall DocumentComplete( IDispatch *pDisp, VARIANT* URL );
  67. };
  68. typedef CComObject<CSRWebBrowserEvents> CSRWebBrowserEvents_Object;
  69. /////////////////////////////////////////////////////////////////////////////
  70. //
  71. // CSRMarsHost
  72. //
  73. /////////////////////////////////////////////////////////////////////////////
  74. class ATL_NO_VTABLE CSRMarsHost :
  75. public CComObjectRootEx<CComMultiThreadModel>,
  76. public CComCoClass<CSRMarsHost>,
  77. public IMarsHost
  78. {
  79. public:
  80. CSRMarsHost();
  81. virtual ~CSRMarsHost();
  82. DECLARE_NO_REGISTRY()
  83. BEGIN_COM_MAP(CSRMarsHost)
  84. COM_INTERFACE_ENTRY(IMarsHost)
  85. END_COM_MAP()
  86. HRESULT FinalConstruct();
  87. HRESULT Passivate();
  88. // Attributes
  89. public:
  90. CComPtr<IInternetSecurityManager> m_secmgr; // Aggregated object.
  91. bool m_fPassivated;
  92. CSRWebBrowserEvents_Object *m_cWebBrowserEvents;
  93. // IMarsHost methods
  94. public:
  95. STDMETHOD(OnHostNotify)( /*[in]*/ MARSHOSTEVENT event,
  96. /*[in]*/ IUnknown *punk,
  97. /*[in]*/ LPARAM lParam );
  98. STDMETHOD(OnNewWindow2)( /*[in,out]*/ IDispatch **ppDisp,
  99. /*[in,out]*/ VARIANT_BOOL *Cancel );
  100. STDMETHOD(FindBehavior)( /*[in]*/ IMarsPanel *pPanel,
  101. /*[in]*/ BSTR bstrBehavior,
  102. /*[in]*/ BSTR bstrBehaviorUrl,
  103. /*[in]*/ IElementBehaviorSite *pSite,
  104. /*[retval,out]*/ IElementBehavior **ppBehavior );
  105. STDMETHOD(OnShowChrome)( /*[in]*/ BSTR bstrWebPanel,
  106. /*[in]*/ DISPID dispidEvent,
  107. /*[in]*/ BOOL fVisible,
  108. /*[in]*/ BSTR bstrCurrentPlace,
  109. /*[in]*/ IMarsPanelCollection *pMarsPanelCollection );
  110. STDMETHOD(PreTranslateMessage)( /*[in]*/ MSG *msg );
  111. };
  112. typedef CComObject<CSRMarsHost> CSRMarsHost_Object;
  113. /////////////////////////////////////////////////////////////////////////////
  114. #endif //_MARSHOST_H__INCLUDED_