Source code of Windows XP (NT5)
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.

1338 lines
62 KiB

  1. #ifndef _HLFRAME_H_
  2. #define _HLFRAME_H_
  3. #include "iface.h"
  4. #include <mshtml.h>
  5. #include "cnctnpt.h"
  6. #include "dspsprt.h"
  7. #include "expdsprt.h"
  8. #include "caggunk.h"
  9. #include <opsprof.h>
  10. #include <msiehost.h>
  11. #include "iforms.h"
  12. #include <limits.h>
  13. #ifdef _USE_PSTORE_
  14. #include "pstore.h"
  15. #else
  16. #include "wab.h"
  17. #endif // _USE_PSTORE_
  18. #ifndef HLNF_EXTERNALNAVIGATE
  19. #define HLNF_EXTERNALNAVIGATE 0x10000000
  20. #endif
  21. #ifndef HLNF_ALLOW_AUTONAVIGATE
  22. #define HLNF_ALLOW_AUTONAVIGATE 0x20000000
  23. #endif
  24. // structure for information about event sinks we hold
  25. typedef struct tagSINKINFO {
  26. LPUNKNOWN pUnknown;
  27. IConnectionPoint *pCP; // the connection point we're connected to
  28. DWORD dwConnectionCookie;
  29. } SINKINFO;
  30. // Helper function in mshtml.dll.
  31. typedef HRESULT (STDAPICALLTYPE *PFN_MatchExactGetIDsOfNames)(ITypeInfo *pTI,
  32. REFIID riid,
  33. LPOLESTR *rgzNames,
  34. UINT cNames,
  35. LCID lcid,
  36. DISPID *rgdispid,
  37. BOOL fCaseSensitive);
  38. STDAPI ResetProfileSharing(HWND hwin);
  39. class CIEFrameAutoProp;
  40. class CIEFrameAuto : protected CImpIDispatch
  41. , public IWebBrowser2
  42. , public CImpIConnectionPointContainer
  43. , public CImpIExpDispSupport
  44. , public IExternalConnection
  45. , public IShellService
  46. , public IHlinkFrame
  47. , public IServiceProvider
  48. , public IUrlHistoryNotify
  49. , public ITargetFrame2
  50. , public ITargetNotify
  51. , public ITargetFramePriv
  52. , public CAggregatedUnknown
  53. , public IEFrameAuto
  54. , public IWebBrowserPriv
  55. {
  56. public:
  57. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj)
  58. { return CAggregatedUnknown::QueryInterface(riid, ppvObj); }
  59. virtual STDMETHODIMP_(ULONG) AddRef(void)
  60. { return CAggregatedUnknown::AddRef(); }
  61. virtual STDMETHODIMP_(ULONG) Release(void)
  62. { return CAggregatedUnknown::Release(); }
  63. /* forward IDispatch to CImpIDispatch */
  64. virtual STDMETHODIMP GetTypeInfoCount(UINT FAR* pctinfo)
  65. { return CImpIDispatch::GetTypeInfoCount(pctinfo); }
  66. virtual STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo FAR* FAR* pptinfo)
  67. { return CImpIDispatch::GetTypeInfo(itinfo, lcid, pptinfo); }
  68. virtual STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR FAR* FAR* rgszNames, UINT cNames, LCID lcid, DISPID FAR* rgdispid)
  69. { return CImpIDispatch::GetIDsOfNames(riid, rgszNames, cNames, lcid, rgdispid); }
  70. virtual STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR* pdispparams, VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, UINT FAR* puArgErr)
  71. { return CImpIDispatch::Invoke(dispidMember, riid, lcid, wFlags, pdispparams, pvarResult, pexcepinfo, puArgErr); }
  72. /* IWebBrowser methods */
  73. STDMETHOD(GoBack)(THIS);
  74. STDMETHOD(GoForward)(THIS);
  75. STDMETHOD(GoHome)(THIS);
  76. STDMETHOD(GoSearch)(THIS);
  77. STDMETHOD(Navigate)(THIS_ BSTR URL, VARIANT FAR* Flags, VARIANT FAR* TargetFrameName, VARIANT FAR* PostData, VARIANT FAR* Headers);
  78. STDMETHOD(Refresh)(THIS);
  79. STDMETHOD(Refresh2)(THIS_ VARIANT FAR* Level);
  80. STDMETHOD(Stop)(THIS);
  81. STDMETHOD(get_Application)(THIS_ IDispatch * FAR* ppDisp);
  82. STDMETHOD(get_Parent)(THIS_ IDispatch * FAR* ppDisp);
  83. STDMETHOD(get_Container)(THIS_ IDispatch * FAR* ppDisp);
  84. STDMETHOD(get_Document)(THIS_ IDispatch * FAR* ppDisp);
  85. STDMETHOD(get_TopLevelContainer)(THIS_ VARIANT_BOOL FAR* pBool);
  86. STDMETHOD(get_Type)(THIS_ BSTR FAR* pbstrType);
  87. STDMETHOD(get_Left)(THIS_ long FAR* pl);
  88. STDMETHOD(put_Left)(THIS_ long Left);
  89. STDMETHOD(get_Top)(THIS_ long FAR* pl);
  90. STDMETHOD(put_Top)(THIS_ long Top);
  91. STDMETHOD(get_Width)(THIS_ long FAR* pl);
  92. STDMETHOD(put_Width)(THIS_ long Width);
  93. STDMETHOD(get_Height)(THIS_ long FAR* pl);
  94. STDMETHOD(put_Height)(THIS_ long Height);
  95. STDMETHOD(get_LocationName)(THIS_ BSTR FAR* pbstrLocationName);
  96. STDMETHOD(get_LocationURL)(THIS_ BSTR FAR* pbstrLocationURL);
  97. STDMETHOD(get_Busy)(THIS_ VARIANT_BOOL FAR* pBool);
  98. /* IWebBrowserApp methods */
  99. STDMETHOD(Quit)(THIS);
  100. STDMETHOD(ClientToWindow)(THIS_ int FAR* pcx, int FAR* pcy);
  101. STDMETHOD(PutProperty)(THIS_ BSTR szProperty, VARIANT vtValue);
  102. STDMETHOD(GetProperty)(THIS_ BSTR szProperty, VARIANT FAR* pvtValue);
  103. STDMETHOD(get_Name)(THIS_ BSTR FAR* pbstrName);
  104. STDMETHOD(get_HWND)(THIS_ LONG_PTR* pHWND);
  105. STDMETHOD(get_FullName)(THIS_ BSTR FAR* pbstrFullName);
  106. STDMETHOD(get_Path)(THIS_ BSTR FAR* pbstrPath);
  107. STDMETHOD(get_FullScreen)(THIS_ VARIANT_BOOL FAR* pBool);
  108. STDMETHOD(put_FullScreen)(THIS_ VARIANT_BOOL Value);
  109. STDMETHOD(get_Visible)(THIS_ VARIANT_BOOL FAR* pBool);
  110. STDMETHOD(put_Visible)(THIS_ VARIANT_BOOL Value);
  111. STDMETHOD(get_StatusBar)(THIS_ VARIANT_BOOL FAR* pBool);
  112. STDMETHOD(put_StatusBar)(THIS_ VARIANT_BOOL Value);
  113. STDMETHOD(get_StatusText)(THIS_ BSTR FAR* pbstr);
  114. STDMETHOD(put_StatusText)(THIS_ BSTR bstr);
  115. STDMETHOD(get_ToolBar)(THIS_ int FAR* pBool);
  116. STDMETHOD(put_ToolBar)(THIS_ int Value);
  117. STDMETHOD(get_MenuBar)(THIS_ VARIANT_BOOL FAR* pValue);
  118. STDMETHOD(put_MenuBar)(THIS_ VARIANT_BOOL Value);
  119. // IWebBrowser2 methods
  120. STDMETHOD(Navigate2)(THIS_ VARIANT FAR* URL, VARIANT FAR* Flags, VARIANT FAR* TargetFrameName, VARIANT FAR* PostData, VARIANT FAR* Headers);
  121. STDMETHOD(ShowBrowserBar)(THIS_ VARIANT FAR* pvaClsid, VARIANT FAR* pvaShow, VARIANT FAR* pvaSize);
  122. STDMETHOD(QueryStatusWB)(THIS_ OLECMDID cmdID, OLECMDF FAR* pcmdf);
  123. STDMETHOD(ExecWB)(THIS_ OLECMDID cmdID, OLECMDEXECOPT cmdexecopt, VARIANT FAR* pvaIn, VARIANT FAR* pvaOut);
  124. STDMETHOD(get_ReadyState)(THIS_ READYSTATE FAR* plReadyState);
  125. STDMETHOD(get_Offline)(THIS_ VARIANT_BOOL FAR* pbOffline);
  126. STDMETHOD(put_Offline)(THIS_ VARIANT_BOOL bOffline);
  127. STDMETHOD(get_Silent)(THIS_ VARIANT_BOOL FAR* pbSilent);
  128. STDMETHOD(put_Silent)(THIS_ VARIANT_BOOL bSilent);
  129. STDMETHOD(get_RegisterAsBrowser)(THIS_ VARIANT_BOOL FAR* pbRegister);
  130. STDMETHOD(put_RegisterAsBrowser)(THIS_ VARIANT_BOOL bRegister);
  131. STDMETHOD(get_RegisterAsDropTarget)(THIS_ VARIANT_BOOL FAR* pbRegister);
  132. STDMETHOD(put_RegisterAsDropTarget)(THIS_ VARIANT_BOOL bRegister);
  133. STDMETHOD(get_TheaterMode)(THIS_ VARIANT_BOOL FAR* pbRegister);
  134. STDMETHOD(put_TheaterMode)(THIS_ VARIANT_BOOL bRegister);
  135. STDMETHOD(get_AddressBar)(THIS_ VARIANT_BOOL FAR* Value);
  136. STDMETHOD(put_AddressBar)(THIS_ VARIANT_BOOL Value);
  137. STDMETHOD(get_Resizable)(THIS_ VARIANT_BOOL FAR* Value);
  138. STDMETHOD(put_Resizable)(THIS_ VARIANT_BOOL Value);
  139. // IWebBrowserPriv
  140. STDMETHOD(NavigateWithBindCtx)(VARIANT FAR * pvarUrl,
  141. VARIANT FAR * pvarFlags,
  142. VARIANT FAR * pvarTargetFrameName,
  143. VARIANT FAR * pvarPostData,
  144. VARIANT FAR * pvarHeaders,
  145. IBindCtx * pBindCtx,
  146. BSTR bstrLocation);
  147. STDMETHOD(OnClose)();
  148. // *** CImpIConnectionPointContainer ***
  149. virtual STDMETHODIMP EnumConnectionPoints(LPENUMCONNECTIONPOINTS FAR* ppEnum);
  150. // *** CImpIExpDispSupport override ***
  151. virtual STDMETHODIMP OnInvoke(DISPID dispidMember, REFIID iid, LCID lcid, WORD wFlags, DISPPARAMS FAR* pdispparams,
  152. VARIANT FAR* pVarResult,EXCEPINFO FAR* pexcepinfo,UINT FAR* puArgErr);
  153. // *** IExternalConnection ***
  154. virtual DWORD __stdcall AddConnection(DWORD extconn, DWORD reserved);
  155. virtual DWORD __stdcall ReleaseConnection(DWORD extconn, DWORD reserved, BOOL fLastReleaseCloses);
  156. // *** IShellService ***
  157. virtual STDMETHODIMP SetOwner(IUnknown* punkOwner);
  158. // *** IEFrameAuto ***
  159. virtual STDMETHODIMP SetOwnerHwnd(HWND hwndOwner);
  160. virtual STDMETHODIMP put_DefaultReadyState(DWORD dwDefaultReadyState, BOOL fUpdateBrowserReadyState);
  161. virtual STDMETHODIMP OnDocumentComplete(void);
  162. virtual STDMETHODIMP OnWindowsListMarshalled(void);
  163. virtual STDMETHODIMP SetDocHostFlags(DWORD dwDocHostFlags);
  164. DWORD GetDocHostFlags() { return _dwDocHostInfoFlags; };
  165. // Embed our Connection Point object - implmentation in cnctnpt.cpp
  166. CConnectionPoint m_cpWebBrowserEvents;
  167. CConnectionPoint m_cpWebBrowserEvents2;
  168. CConnectionPoint m_cpPropNotify;
  169. HRESULT put_Titlebar(BOOL fValue);
  170. // Embed handler for defunct ITargetFrame interface for backwards compat.
  171. // HTML frames - implementation in iedisp.cpp
  172. class CTargetFrame : public ITargetFrame {
  173. friend CIEFrameAuto;
  174. public:
  175. // IUnknown methods
  176. //
  177. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  178. virtual STDMETHODIMP_(ULONG) AddRef(void) ;
  179. virtual STDMETHODIMP_(ULONG) Release(void);
  180. // ITargetFrame methods
  181. //
  182. virtual STDMETHODIMP SetFrameName(LPCOLESTR pszFrameName);
  183. virtual STDMETHODIMP GetFrameName(LPOLESTR *ppszFrameName);
  184. virtual STDMETHODIMP GetParentFrame(LPUNKNOWN *ppunkParentFrame);
  185. virtual STDMETHODIMP FindFrame(LPCOLESTR pszTargetName, LPUNKNOWN punkContextFrame, DWORD dwFlags, LPUNKNOWN *ppunkTargetFrame);
  186. virtual STDMETHODIMP SetFrameSrc(LPCOLESTR pszFrameSrc);
  187. virtual STDMETHODIMP GetFrameSrc(LPOLESTR *ppszFrameSrc);
  188. virtual STDMETHODIMP GetFramesContainer(LPOLECONTAINER *ppContainer);
  189. virtual STDMETHODIMP SetFrameOptions(DWORD dwFlags);
  190. virtual STDMETHODIMP GetFrameOptions(LPDWORD pdwFlags);
  191. virtual STDMETHODIMP SetFrameMargins(DWORD dwWidth, DWORD dwHeight);
  192. virtual STDMETHODIMP GetFrameMargins(LPDWORD pdwWidth, LPDWORD pdwHeight);
  193. virtual STDMETHODIMP RemoteNavigate(ULONG cLength,ULONG *pulData);
  194. virtual STDMETHODIMP OnChildFrameActivate(LPUNKNOWN pUnkChildFrame) { return S_OK; }
  195. virtual STDMETHODIMP OnChildFrameDeactivate(LPUNKNOWN pUnkChildFrame) { return S_OK; }
  196. } _TargetFrame;
  197. friend class CTargetFrame;
  198. // IHlinkFrame
  199. virtual STDMETHODIMP GetBrowseContext(IHlinkBrowseContext **ppihlbc);
  200. virtual STDMETHODIMP OnNavigate(
  201. /* [in] */ DWORD grfHLNF,
  202. /* [unique][in] */ IMoniker *pimkTarget,
  203. /* [unique][in] */ LPCWSTR pwzLocation,
  204. /* [unique][in] */ LPCWSTR pwzFriendlyName,
  205. /* [in] */ DWORD dwreserved) ;
  206. virtual STDMETHODIMP UpdateHlink(ULONG uHLID,
  207. IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
  208. { return E_NOTIMPL;};
  209. virtual STDMETHODIMP SetBrowseContext(
  210. /* [unique][in] */ IHlinkBrowseContext *pihlbc);
  211. #ifdef OLD_HLIFACE
  212. virtual STDMETHODIMP PrepareForNavigation(
  213. DWORD grfHLBF, LPBC pbc,
  214. IBindStatusCallback *pibsc, IHlink *pihlNavigate);
  215. virtual STDMETHODIMP Navigate(
  216. DWORD grfHLNF, IHlink *pihlNavigate);
  217. virtual STDMETHODIMP OnReleaseNavigationState(
  218. IHlink *pihlNavigate, DWORD dwReserved);
  219. #else
  220. virtual STDMETHODIMP Navigate(
  221. /* [in] */ DWORD grfHLNF,
  222. /* [in] */ LPBC pbc,
  223. /* [in] */ IBindStatusCallback *pibsc,
  224. /* [in] */ IHlink *pihlNavigate);
  225. #endif
  226. // *** IServiceProvider methods ***
  227. virtual STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, LPVOID* ppvObj);
  228. // IOleCommandTarget and IUrlHistoryNotify
  229. virtual STDMETHODIMP QueryStatus(const GUID *pguidCmdGroup,
  230. ULONG cCmds, MSOCMD rgCmds[], MSOCMDTEXT *pcmdtext);
  231. virtual STDMETHODIMP Exec(const GUID *pguidCmdGroup,
  232. DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut);
  233. // *** ITargetFrame2 ***
  234. virtual STDMETHODIMP SetFrameName(LPCOLESTR pszFrameName);
  235. virtual STDMETHODIMP GetFrameName(LPOLESTR *ppszFrameName);
  236. virtual STDMETHODIMP GetParentFrame(LPUNKNOWN *ppunkParentFrame);
  237. virtual STDMETHODIMP SetFrameSrc(LPCOLESTR pszFrameSrc);
  238. virtual STDMETHODIMP GetFrameSrc(LPOLESTR *ppszFrameSrc);
  239. virtual STDMETHODIMP GetFramesContainer(LPOLECONTAINER *ppContainer);
  240. virtual STDMETHODIMP SetFrameOptions(DWORD dwFlags);
  241. virtual STDMETHODIMP GetFrameOptions(LPDWORD pdwFlags);
  242. virtual STDMETHODIMP SetFrameMargins(DWORD dwWidth, DWORD dwHeight);
  243. virtual STDMETHODIMP GetFrameMargins(LPDWORD pdwWidth, LPDWORD pdwHeight);
  244. virtual STDMETHODIMP FindFrame(LPCWSTR pszTargetName,DWORD dwFlags,LPUNKNOWN *ppunkTargetFrame);
  245. virtual STDMETHODIMP GetTargetAlias(LPCOLESTR pszTargetName, LPOLESTR *ppszTargetAlias);
  246. // *** ITargetFramePriv ***
  247. virtual STDMETHODIMP FindFrameDownwards(LPCWSTR pszTargetName, DWORD dwFlags,LPUNKNOWN *ppunkTargetFrame);
  248. virtual STDMETHODIMP FindFrameInContext(LPCWSTR pszTargetName, LPUNKNOWN punkContextFrame,DWORD dwFlags,LPUNKNOWN *ppunkTargetFrame);
  249. virtual STDMETHODIMP OnChildFrameActivate(LPUNKNOWN pUnkChildFrame) { return E_NOTIMPL; }
  250. virtual STDMETHODIMP OnChildFrameDeactivate(LPUNKNOWN pUnkChildFrame) { return E_NOTIMPL; }
  251. virtual STDMETHODIMP NavigateHack(DWORD grfHLNF, LPBC pbc, IBindStatusCallback *pibsc, LPCWSTR pszTargetName, LPCWSTR pszUrl, LPCWSTR pszLocation);
  252. virtual STDMETHODIMP FindBrowserByIndex(DWORD dwID,IUnknown **ppunkBrowser);
  253. // *** ITargetNotify ***
  254. virtual STDMETHODIMP OnCreate(LPUNKNOWN pUnkDestination, ULONG cbCookie);
  255. virtual STDMETHODIMP OnReuse(LPUNKNOWN pUnkDestination);
  256. protected:
  257. void Exception(WORD wException);
  258. HWND _GetHWND(void);
  259. HRESULT _PidlFromUrlEtc(UINT uiCP, LPCWSTR pszUrl, LPWSTR pszLocation, LPITEMIDLIST* ppidl);
  260. HRESULT _BrowseObject(LPCITEMIDLIST pidl, UINT wFlags);
  261. HRESULT _GoStdLocation(DWORD dwWhich);
  262. HRESULT _NavigateMagnum(DWORD grfHLNF, LPBC pbc, IBindStatusCallback *pibsc, LPCWSTR pszTargetName, LPCWSTR pszUrl, LPCWSTR pszLocation, IHlink *pihlNavigate, IMoniker *pmkTarget);
  263. // methods to pass the referring url to a new window
  264. HRESULT _ReferrerHack(LPCWSTR pszUrl);
  265. void _SetReferrer(LPTARGETFRAMEPRIV ptgfp);
  266. // *** misc helper methods for ITargetFrame implementation
  267. void _SetPendingNavigateContext(LPBC pbc, IBindStatusCallback *pibsc);
  268. void _ActivatePendingNavigateContext(void);
  269. HRESULT _JumpTo(LPBC pbc, LPWSTR pszLocation, DWORD grfHLNF, IBindStatusCallback __RPC_FAR *pibsc,
  270. /* [in] */ IHlink __RPC_FAR *pihlNavigate, LPCWSTR pszFrameName, LPCWSTR pszUrl);
  271. void _CancelPendingNavigation(VARIANTARG* pvar);
  272. BOOL _fNavigationPending();
  273. HRESULT _DoNamedTarget(LPCOLESTR pszTargetName, LPUNKNOWN punkContextFrame, DWORD dwFlags, LPUNKNOWN *ppunkTargetFrame);
  274. HRESULT _GetOleObject(IOleObject** ppobj);
  275. IShellView* _GetShellView(void);
  276. HRESULT _get_Location(BSTR FAR* pbstr, UINT uFlags);
  277. void _ClearPropertyList(void);
  278. HRESULT _WaitForNotify();
  279. HRESULT _RegisterCallback(TCHAR *szFrameName, LPTARGETNOTIFY ptgnNotify);
  280. HRESULT _RevokeCallback();
  281. virtual HRESULT v_InternalQueryInterface(REFIID riid, LPVOID * ppvObj);
  282. virtual CConnectionPoint* _FindCConnectionPointNoRef(BOOL fdisp, REFIID iid);
  283. HRESULT _QueryDelegate(IDispatch **pidDelegate);
  284. HRESULT _QueryPendingUrl(VARIANT *pvarResult);
  285. HRESULT _RetryNavigate();
  286. HRESULT _QueryPendingDelegate(IDispatch **ppDisp, VARIANT *pvarargIn);
  287. BOOL _fDesktopComponent();
  288. HRESULT _GetParentFramePrivate(LPUNKNOWN *ppunkParentFrame);
  289. HRESULT _FindWindowByName(IOleContainer * pOleContainer,
  290. LPCOLESTR pszTargetName,
  291. LPUNKNOWN * ppunkTargetFrame);
  292. HRESULT _NavigateHelper(BSTR URL,
  293. VARIANT * Flags,
  294. VARIANT * TargetFrameName,
  295. VARIANT * PostData,
  296. VARIANT * Headers,
  297. IBindCtx * pNavBindCtx = NULL,
  298. BSTR bstrLocation = NULL);
  299. HRESULT _NavIEShortcut(VARIANT *pvarIn, VARIANT *pvarFlags);
  300. void _HandleOpenOptions( IUnknown * pUnkDestination, ITargetNotify * ptgnNotify);
  301. // constructor and destructor are private...
  302. // use CIEFrameAuto_CreateInstance to get at this object
  303. CIEFrameAuto(IUnknown* punkAgg=NULL);
  304. ~CIEFrameAuto();
  305. friend HRESULT CIEFrameAuto_CreateInstance(IUnknown* pUnkOuter, IUnknown** ppunk);
  306. friend HRESULT GetRootDelegate( CIEFrameAuto* pauto, IDispatch ** const ppRootDelegate );
  307. friend DWORD OpenAndNavigateToURL(CIEFrameAuto *pauto, BSTR *pbstrURL, const WCHAR *pwzTarget, ITargetNotify *pNotify, BOOL bNoHistory, BOOL bSilent);
  308. // Member variables for automation
  309. IBrowserService *_pbs;
  310. ITypeInfo *_pITI; //Type information
  311. HWND _hwnd;
  312. UINT _cLocks;
  313. CIEFrameAutoProp *_pProps;
  314. DWORD _dwDefaultReadyState;
  315. BOOL m_bOffline:1; // Indicates if this frame is offline or not
  316. BOOL m_bSilent:1; // Indicates if this frame is silent or not
  317. DWORD _dwDocHostInfoFlags; // Flags from GetHostInfo (CDocObjectHost)
  318. // for IHlinkFrame implementation
  319. IServiceProvider* _psp; // browser
  320. LPBC _pbc;
  321. IBindStatusCallback * _pbsc;
  322. LPBC _pbcPending;
  323. IBindStatusCallback * _pbscPending;
  324. IShellBrowser* _psb;
  325. IShellBrowser* _psbTop;
  326. IShellBrowser* _psbFrameTop;
  327. IOleCommandTarget* _poctFrameTop;
  328. IShellBrowser* _psbProxy;
  329. IOleCommandTarget* _pmsc;
  330. IHlinkBrowseContext* _phlbc;
  331. LPWSTR _pwszShortcutPath;
  332. LPWSTR _pwszShortcutPathPending;
  333. DWORD _dwRegHLBC;
  334. BOOL _fBusy:1;
  335. BOOL _fRegistered:1;
  336. BOOL _fDesktopFrame:1;
  337. BOOL _fSuppressHistory:1;
  338. BOOL _fSuppressSelect:1;
  339. BOOL _fWindowsListMarshalled:1;
  340. BOOL _fRegisterAsBrowser:1;
  341. BOOL _fQuitInProgress:1;
  342. long _cbCookie;
  343. LPTARGETNOTIFY _ptgnNotify;
  344. DWORD _dwTickPropertySweep;
  345. // for ITargetFrame implementation
  346. LPOLESTR m_pszFrameName; // Name of our frame
  347. LPOLESTR m_pszFrameSrc; // Original source of our frame (for embedded OC's)
  348. DWORD m_dwFrameOptions; // Frame options
  349. DWORD m_dwFrameMarginWidth; // Frame marginwidth
  350. DWORD m_dwFrameMarginHeight;// Frame marginheight
  351. HINSTANCE _hinstMSHTML;
  352. PFN_MatchExactGetIDsOfNames _pfnMEGetIDsOfNames;
  353. class CAutomationStub : public IDispatchEx, public IProvideClassInfo
  354. {
  355. friend class CIEFrameAuto;
  356. public:
  357. CAutomationStub( DISPID min, DISPID max, BOOL fOwnDefaultDispid );
  358. HRESULT Init( void *instance, REFIID iid, REFIID clsid, CIEFrameAuto *pauto );
  359. virtual ~CAutomationStub();
  360. // Only used internally so we don't need to Addref
  361. CIEFrameAuto *IEFrameAuto() const { return _pAuto; }
  362. // *** IUnknown members ***
  363. STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  364. STDMETHODIMP_(ULONG) AddRef(void) ;
  365. STDMETHODIMP_(ULONG) Release(void);
  366. // *** IDispatch members ***
  367. virtual STDMETHODIMP GetTypeInfoCount(UINT *);
  368. virtual STDMETHODIMP GetTypeInfo(UINT, LCID, ITypeInfo **);
  369. virtual STDMETHODIMP GetIDsOfNames(REFIID, OLECHAR **, UINT, LCID, DISPID *);
  370. virtual STDMETHODIMP Invoke(DISPID, REFIID, LCID, WORD, DISPPARAMS *, VARIANT *, EXCEPINFO *, UINT *);
  371. // *** IDispatchEx members ***
  372. STDMETHODIMP GetDispID(BSTR bstrName, DWORD grfdex, DISPID *pid);
  373. STDMETHODIMP InvokeEx(DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller);
  374. STDMETHODIMP DeleteMemberByName(BSTR bstr, DWORD grfdex);
  375. STDMETHODIMP DeleteMemberByDispID(DISPID id);
  376. STDMETHODIMP GetMemberProperties(DISPID id, DWORD grfdexFetch, DWORD *pgrfdex);
  377. STDMETHODIMP GetMemberName(DISPID id, BSTR *pbstrName);
  378. STDMETHODIMP GetNextDispID(DWORD grfdex, DISPID id, DISPID *pid);
  379. STDMETHODIMP GetNameSpaceParent(IUnknown **ppunk);
  380. // *** IProvideClassInfo members ***
  381. STDMETHODIMP GetClassInfo( ITypeInfo** ppTI );
  382. protected:
  383. virtual HRESULT _GetIDispatchExDelegate( IDispatchEx ** const ) = 0;
  384. virtual HRESULT _InternalQueryInterface( REFIID riid, void** const ppvObj ) = 0;
  385. CIEFrameAuto *_pAuto;
  386. private:
  387. HRESULT ResolveTypeInfo2( );
  388. void *_pInstance;
  389. ITypeInfo2 *_pInterfaceTypeInfo2;
  390. ITypeInfo2 *_pCoClassTypeInfo2;
  391. BOOL _fLoaded;
  392. IID _iid;
  393. CLSID _clsid;
  394. const DISPID _MinDispid;
  395. const DISPID _MaxDispid;
  396. const BOOL _fOwnDefaultDispid;
  397. };
  398. friend class CAutomationStub;
  399. public:
  400. class COmWindow :
  401. public IHTMLWindow2,
  402. public CAutomationStub,
  403. public ITargetNotify,
  404. public IShellHTMLWindowSupport2,
  405. public IProvideMultipleClassInfo,
  406. public IConnectionPointCB,
  407. public IConnectionPointContainer,
  408. public IServiceProvider,
  409. #ifndef NO_MARSHALLING
  410. public IHTMLWindow3
  411. #else
  412. public IHTMLWindow3,
  413. public IWindowStatus
  414. #endif
  415. {
  416. public:
  417. friend class CIEFrameAuto;
  418. COmWindow();
  419. HRESULT Init();
  420. ~COmWindow() { VariantClear(&_varOpener); UnsinkDelegate(); DestroyIntelliForms( ); }
  421. HRESULT DeInit( ) { VariantClear(&_varOpener); return S_OK; }
  422. // *** IUnknown members ***
  423. STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj) { return CAutomationStub::QueryInterface(riid, ppvObj); }
  424. STDMETHODIMP_(ULONG) AddRef(void) { return CAutomationStub::AddRef( ); }
  425. STDMETHODIMP_(ULONG) Release(void) { return CAutomationStub::Release( ); }
  426. // *** IDispatch members ***
  427. STDMETHODIMP GetTypeInfoCount(UINT *pi) { return CAutomationStub::GetTypeInfoCount(pi); }
  428. STDMETHODIMP GetTypeInfo(UINT it, LCID lcid, ITypeInfo **pptypeinfo) { return CAutomationStub::GetTypeInfo(it,lcid,pptypeinfo); }
  429. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { return CAutomationStub::GetIDsOfNames(riid,rgszNames,cNames,lcid,rgDispId); }
  430. STDMETHODIMP Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *dispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr )
  431. { return CAutomationStub::Invoke(dispid,riid,lcid,wFlags,dispparams,pvarResult,pexcepinfo,puArgErr ); }
  432. // *** IDispatchEx members ***
  433. STDMETHODIMP GetDispID(BSTR bstrName, DWORD grfdex, DISPID *pid);
  434. STDMETHODIMP InvokeEx(DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
  435. { return CAutomationStub::InvokeEx(id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); }
  436. STDMETHODIMP DeleteMemberByName(BSTR bstr, DWORD grfdex)
  437. { return CAutomationStub::DeleteMemberByName(bstr, grfdex); }
  438. STDMETHODIMP DeleteMemberByDispID(DISPID id)
  439. { return CAutomationStub::DeleteMemberByDispID(id); }
  440. STDMETHODIMP GetMemberProperties(DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
  441. { return CAutomationStub::GetMemberProperties(id, grfdexFetch, pgrfdex); }
  442. STDMETHODIMP GetMemberName(DISPID id, BSTR *pbstrName)
  443. { return CAutomationStub::GetMemberName(id, pbstrName); }
  444. STDMETHODIMP GetNextDispID(DWORD grfdex, DISPID id, DISPID *pid)
  445. { return CAutomationStub::GetNextDispID(grfdex, id, pid); }
  446. STDMETHODIMP GetNameSpaceParent(IUnknown **ppunk)
  447. { return CAutomationStub::GetNameSpaceParent(ppunk); }
  448. // *** IHTMLFramesCollection2 ***
  449. STDMETHODIMP item( VARIANT *pvarIndex, VARIANT* pvarResult );
  450. STDMETHODIMP get_length(long* pl);
  451. // *** IHTMLWindow2 ***
  452. STDMETHODIMP get_name (BSTR FAR* retval);
  453. STDMETHODIMP put_name (BSTR theName);
  454. STDMETHODIMP get_parent(IHTMLWindow2** retval);
  455. STDMETHODIMP get_top(IHTMLWindow2** retval);
  456. STDMETHODIMP get_self(IHTMLWindow2** retval);
  457. STDMETHODIMP get_opener(VARIANT* retval);
  458. STDMETHODIMP put_opener(VARIANT opener);
  459. STDMETHODIMP get_window(IHTMLWindow2** retval);
  460. STDMETHODIMP get_document(IHTMLDocument2** retval);
  461. STDMETHODIMP get_frames(IHTMLFramesCollection2** retval);
  462. STDMETHODIMP get_location(IHTMLLocation** retval);
  463. STDMETHODIMP get_navigator(IOmNavigator** retval);
  464. STDMETHODIMP get_history(IOmHistory** retval);
  465. STDMETHODIMP put_defaultStatus(BSTR statusmsg);
  466. STDMETHODIMP get_defaultStatus(BSTR *retval);
  467. STDMETHODIMP put_status(BSTR statusmsg);
  468. STDMETHODIMP get_status(BSTR *retval);
  469. STDMETHODIMP open( BSTR url, BSTR name, BSTR features, VARIANT_BOOL replace, IHTMLWindow2** ppomWindowResult );
  470. STDMETHODIMP alert(BSTR message);
  471. STDMETHODIMP close();
  472. STDMETHODIMP confirm(BSTR message, VARIANT_BOOL* confirmed);
  473. STDMETHODIMP prompt(BSTR message, BSTR defstr, VARIANT* textdata);
  474. STDMETHODIMP setTimeout(BSTR expression, long msec, VARIANT* language, long FAR* timerID);
  475. STDMETHODIMP clearTimeout(long timerID);
  476. STDMETHODIMP navigate(BSTR url);
  477. STDMETHODIMP get_Image(IHTMLImageElementFactory** retval);
  478. STDMETHODIMP get_event( IHTMLEventObj* * p);
  479. STDMETHODIMP get__newEnum(IUnknown* * p);
  480. STDMETHODIMP showModalDialog(BSTR dialog,VARIANT* varArgIn, VARIANT* varOptions,VARIANT* varArgOut);
  481. STDMETHODIMP showHelp(BSTR helpURL, VARIANT helpArg, BSTR features);
  482. STDMETHODIMP execScript(BSTR bstrCode, BSTR bstrLanguage, VARIANT * pvarRet);
  483. STDMETHODIMP get_screen( IHTMLScreen ** p);
  484. STDMETHODIMP get_Option(IHTMLOptionElementFactory** retval);
  485. STDMETHODIMP focus();
  486. STDMETHODIMP get_closed(VARIANT_BOOL*retval);
  487. STDMETHODIMP blur();
  488. STDMETHODIMP scroll(long x, long y);
  489. STDMETHODIMP put_onblur(VARIANT v);
  490. STDMETHODIMP get_onblur(VARIANT*p);
  491. STDMETHODIMP put_onfocus(VARIANT v);
  492. STDMETHODIMP get_onfocus(VARIANT*p);
  493. STDMETHODIMP put_onload(VARIANT v);
  494. STDMETHODIMP get_onload(VARIANT*p);
  495. STDMETHODIMP put_onunload(VARIANT v);
  496. STDMETHODIMP get_onunload(VARIANT*p);
  497. STDMETHODIMP put_onhelp(VARIANT v);
  498. STDMETHODIMP get_onhelp(VARIANT*p);
  499. STDMETHODIMP put_onerror(VARIANT v);
  500. STDMETHODIMP get_onerror(VARIANT*p);
  501. STDMETHODIMP put_onscroll(VARIANT v);
  502. STDMETHODIMP get_onscroll(VARIANT*p);
  503. STDMETHODIMP put_onresize(VARIANT v);
  504. STDMETHODIMP get_onresize(VARIANT*p);
  505. STDMETHODIMP get_clientInformation( IOmNavigator ** retval );
  506. STDMETHODIMP setInterval(BSTR expression,long msec,VARIANT* language,long* timerID);
  507. STDMETHODIMP clearInterval(long timerID);
  508. STDMETHODIMP put_offscreenBuffering(VARIANT var);
  509. STDMETHODIMP get_offscreenBuffering(VARIANT *retval);
  510. STDMETHODIMP put_onbeforeunload(VARIANT v);
  511. STDMETHODIMP get_onbeforeunload(VARIANT*p);
  512. STDMETHODIMP toString(BSTR *String);
  513. STDMETHODIMP scrollBy(long x, long y);
  514. STDMETHODIMP scrollTo(long x, long y);
  515. STDMETHODIMP moveTo(long x, long y);
  516. STDMETHODIMP moveBy(long x, long y);
  517. STDMETHODIMP resizeTo(long x, long y);
  518. STDMETHODIMP resizeBy(long x, long y);
  519. STDMETHODIMP get_external(IDispatch **ppDisp);
  520. // *** IHTMLWindow3 ***
  521. STDMETHODIMP get_screenTop(long*p);
  522. STDMETHODIMP get_screenLeft(long*p);
  523. STDMETHODIMP attachEvent(BSTR event, IDispatch * pDisp, VARIANT_BOOL *pResult);
  524. STDMETHODIMP detachEvent(BSTR event, IDispatch * pDisp);
  525. STDMETHODIMP setTimeout(VARIANT *pExpression, long msec, VARIANT* language, long FAR* timerID);
  526. STDMETHODIMP setInterval(VARIANT *pExpression, long msec, VARIANT* language, long FAR* timerID);
  527. STDMETHODIMP print();
  528. STDMETHODIMP put_onbeforeprint(VARIANT v);
  529. STDMETHODIMP get_onbeforeprint(VARIANT*p);
  530. STDMETHODIMP put_onafterprint(VARIANT v);
  531. STDMETHODIMP get_onafterprint(VARIANT*p);
  532. STDMETHODIMP get_clipboardData(IHTMLDataTransfer **ppDataTransfer);
  533. STDMETHOD(showModelessDialog)(BSTR strUrl,
  534. VARIANT * pvarArgIn,
  535. VARIANT * pvarOptions,
  536. IHTMLWindow2 ** ppDialog);
  537. // *** IConnectionPointContainer ***
  538. STDMETHODIMP EnumConnectionPoints( LPENUMCONNECTIONPOINTS *ppEnum );
  539. STDMETHODIMP FindConnectionPoint( REFIID iid, LPCONNECTIONPOINT *ppCP );
  540. // *** IConnectionPointCB ***
  541. STDMETHODIMP OnAdvise(REFIID iid, DWORD cSinks, DWORD_PTR dwCookie);
  542. STDMETHODIMP OnUnadvise(REFIID iid, DWORD cSinks, DWORD_PTR dwCookie) { return S_OK; }
  543. // *** ITargetNotify members ***
  544. STDMETHODIMP OnCreate(IUnknown *pUnkDestination, ULONG cbCookie);
  545. STDMETHODIMP OnReuse(IUnknown *pUnkDestination);
  546. // *** IShellHTMLWindowSupport ***
  547. STDMETHODIMP ViewReleaseIntelliForms();
  548. STDMETHODIMP ViewReleased();
  549. STDMETHODIMP ViewActivated();
  550. STDMETHODIMP ReadyStateChangedTo( long, IShellView* );
  551. STDMETHODIMP CanNavigate();
  552. STDMETHODIMP ActiveElementChanged(IHTMLElement * pHTMLElement);
  553. STDMETHODIMP IsGalleryMeta(BOOL bFlag);
  554. // *** IProvideMultipleClassInfo members ***
  555. STDMETHODIMP GetClassInfo( ITypeInfo** ppTI ) { return CAutomationStub::GetClassInfo(ppTI); }
  556. STDMETHODIMP GetGUID( DWORD dwGuidKind, GUID* pGUID );
  557. STDMETHODIMP GetMultiTypeInfoCount( ULONG *pcti );
  558. STDMETHODIMP GetInfoOfIndex( ULONG iti, DWORD dwFlags, ITypeInfo **pptiCoClass, DWORD *pdwTIFlags, ULONG *pcdispidReserved,IID *piidPrimary,IID *piidSource );
  559. // *** IServiceProvider members ***
  560. STDMETHODIMP QueryService(REFGUID guidService, REFIID iid, LPVOID * ppv);
  561. #ifdef NO_MARSHALLING
  562. // *** IWindowStatus members ***
  563. STDMETHOD(IsWindowActivated)();
  564. #endif
  565. enum Bogus { BOOL_NOTSET = 2 };
  566. // Options which apply to a newly created window
  567. class WindowOpenOptions
  568. {
  569. public:
  570. BOOL fToolbar; // whether to show the navigation toolbar
  571. BOOL fLocation; // " " location bar <NYI>
  572. BOOL fDirectories; // " " quick links <NYI>
  573. BOOL fStatus; // " " status bar
  574. BOOL fMenubar; // " " menu bar <NYI>
  575. BOOL fScrollbars; // " " scroll bars
  576. BOOL fResizable; // whether the new window should be resizable
  577. BOOL fFullScreen; // whether the window should be in full-screen (kiosk) mode
  578. BOOL fChannelMode; // whether the window should be in Channel mode.
  579. BOOL fTitlebar; // whether to show the title bar of the window
  580. int iWidth; // width of the new window
  581. int iHeight; // height of the new window
  582. int iLeft; // left x-coordinate of the new window
  583. int iTop; // top y-coordinate of the new window
  584. WindowOpenOptions() { ReInitialize(); }
  585. void ReInitialize()
  586. {
  587. fMenubar = TRUE;
  588. fToolbar = TRUE;
  589. fStatus = TRUE;
  590. fScrollbars = TRUE;
  591. fResizable = TRUE;
  592. fDirectories = TRUE;
  593. fFullScreen = BOOL_NOTSET; // whether to use full-screen (kiosk) mode
  594. fChannelMode = BOOL_NOTSET;
  595. fLocation = BOOL_NOTSET;
  596. fTitlebar = TRUE;
  597. iWidth = -1;
  598. iHeight = -1;
  599. iLeft = -1;
  600. iTop = -1;
  601. }
  602. };
  603. HRESULT _GetWindowDelegate(IHTMLWindow2 **ppomwDelegate);
  604. HRESULT _GetWindowDelegate(IHTMLWindow3 **ppomwDelegate);
  605. protected:
  606. // *** CAutomationStub members ***
  607. virtual HRESULT _InternalQueryInterface(REFIID riid, void ** const ppvObj);
  608. virtual HRESULT _GetIDispatchExDelegate( IDispatchEx ** const delegate );
  609. WindowOpenOptions _OpenOptions;
  610. // *** Window Open Helper Methods ***
  611. BSTR _GenerateUniqueWindowName( );
  612. HRESULT _ApplyOpenOptions( IWebBrowser2 *pie );
  613. HRESULT _ParseOptionString( BSTR bstrOptionString, ITargetNotify2 * ptgnNotify2 = NULL);
  614. private:
  615. static unsigned long s_uniqueIndex;
  616. BOOL _fCallbackOK;
  617. IHTMLWindow2 *_pOpenedWindow;
  618. VARIANT _varOpener;
  619. BOOL _fIsChild;
  620. // Connection point stuff.
  621. class CWindowEventSink : public IDispatch
  622. {
  623. public:
  624. CWindowEventSink() { }
  625. ~CWindowEventSink() { }
  626. // *** IUnknown members ***
  627. STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  628. STDMETHODIMP_(ULONG) AddRef(void);
  629. STDMETHODIMP_(ULONG) Release(void);
  630. // *** IDispatch members ***
  631. STDMETHODIMP GetTypeInfoCount(UINT *pi) { return E_NOTIMPL; }
  632. STDMETHODIMP GetTypeInfo(UINT it, LCID lcid, ITypeInfo **pptypeinfo) { return E_NOTIMPL; }
  633. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { return E_NOTIMPL; }
  634. STDMETHODIMP Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *dispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr );
  635. };
  636. friend CWindowEventSink;
  637. // Event Data
  638. CWindowEventSink _wesDelegate;
  639. BOOL _fOnloadFired;
  640. CConnectionPoint _cpWindowEvents;
  641. IConnectionPoint *_pCP;
  642. DWORD _dwCPCookie;
  643. // Event Methods
  644. BOOL IsDelegateComplete( );
  645. HRESULT SinkDelegate( );
  646. HRESULT UnsinkDelegate( );
  647. HRESULT FireOnLoad( );
  648. HRESULT FireOnUnload( );
  649. // IntelliForms data and methods
  650. void *_pIntelliForms;
  651. HRESULT AttachIntelliForms( );
  652. HRESULT ReleaseIntelliForms( );
  653. HRESULT DestroyIntelliForms( );
  654. BOOL _fIntelliFormsAskUser;
  655. BOOL _fDelegateWindowOM;
  656. public:
  657. HRESULT IntelliFormsAskUser(LPCWSTR pwszValue);
  658. void *IntelliForms() { return _pIntelliForms; }
  659. void SetDelegationPolicy(BOOL fFlag) { _fDelegateWindowOM = fFlag; }
  660. }; // COmWindow
  661. protected:
  662. friend class COmWindow;
  663. COmWindow _omwin;
  664. class COmLocation : public IHTMLLocation, public CAutomationStub, public IObjectIdentity, public IServiceProvider
  665. {
  666. public:
  667. COmLocation( );
  668. HRESULT Init( );
  669. virtual ~COmLocation();
  670. // *** IUnknown members ***
  671. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj) { return CAutomationStub::QueryInterface(riid, ppvObj); }
  672. virtual STDMETHODIMP_(ULONG) AddRef(void) { return CAutomationStub::AddRef( ); }
  673. virtual STDMETHODIMP_(ULONG) Release(void) { return CAutomationStub::Release( ); }
  674. // *** IDispatch members ***
  675. virtual STDMETHODIMP GetTypeInfoCount(UINT *pi) { return CAutomationStub::GetTypeInfoCount(pi); }
  676. virtual STDMETHODIMP GetTypeInfo(UINT it, LCID lcid, ITypeInfo **pptypeinfo) { return CAutomationStub::GetTypeInfo(it,lcid,pptypeinfo); }
  677. virtual STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { return CAutomationStub::GetIDsOfNames(riid,rgszNames,cNames,lcid,rgDispId); }
  678. virtual STDMETHODIMP Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *dispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr )
  679. { return CAutomationStub::Invoke(dispid,riid,lcid,wFlags,dispparams,pvarResult,pexcepinfo,puArgErr ); }
  680. // *** IDispatchEx members ***
  681. STDMETHODIMP GetDispID(BSTR bstrName, DWORD grfdex, DISPID *pid)
  682. { return CAutomationStub::GetDispID(bstrName, grfdex, pid); }
  683. STDMETHODIMP InvokeEx(DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
  684. { return CAutomationStub::InvokeEx(id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); }
  685. STDMETHODIMP DeleteMemberByName(BSTR bstr, DWORD grfdex)
  686. { return CAutomationStub::DeleteMemberByName(bstr, grfdex); }
  687. STDMETHODIMP DeleteMemberByDispID(DISPID id)
  688. { return CAutomationStub::DeleteMemberByDispID(id); }
  689. STDMETHODIMP GetMemberProperties(DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
  690. { return CAutomationStub::GetMemberProperties(id, grfdexFetch, pgrfdex); }
  691. STDMETHODIMP GetMemberName(DISPID id, BSTR *pbstrName)
  692. { return CAutomationStub::GetMemberName(id, pbstrName); }
  693. STDMETHODIMP GetNextDispID(DWORD grfdex, DISPID id, DISPID *pid)
  694. { return CAutomationStub::GetNextDispID(grfdex, id, pid); }
  695. STDMETHODIMP GetNameSpaceParent(IUnknown **ppunk)
  696. { return CAutomationStub::GetNameSpaceParent(ppunk); }
  697. // *** IObjectIdentity members ***
  698. STDMETHODIMP IsEqualObject(IUnknown * pUnk);
  699. // *** IServiceProvider members ***
  700. STDMETHODIMP QueryService(REFGUID guidService, REFIID iid, LPVOID * ppv);
  701. // properties
  702. STDMETHODIMP get_href(BSTR* pbstr);
  703. STDMETHODIMP put_href(BSTR bstr);
  704. STDMETHODIMP get_protocol(BSTR* pbstr);
  705. STDMETHODIMP put_protocol(BSTR bstr);
  706. STDMETHODIMP get_hostname(BSTR* pbstr);
  707. STDMETHODIMP put_hostname(BSTR bstr);
  708. STDMETHODIMP get_host(BSTR* pbstr);
  709. STDMETHODIMP put_host(BSTR bstr);
  710. STDMETHODIMP get_pathname(BSTR* pbstr);
  711. STDMETHODIMP put_pathname(BSTR bstr);
  712. STDMETHODIMP get_search(BSTR* pbstr);
  713. STDMETHODIMP put_search(BSTR bstr);
  714. STDMETHODIMP get_hash(BSTR* pbstr);
  715. STDMETHODIMP put_hash(BSTR bstr);
  716. STDMETHODIMP get_port(BSTR* pbstr);
  717. STDMETHODIMP put_port(BSTR bstr) ;
  718. STDMETHODIMP PrivateGet_href(BSTR* pbstr, BOOL *fdontputinhistory);
  719. // methods
  720. STDMETHODIMP reload(VARIANT_BOOL fFlag) ;
  721. STDMETHODIMP replace(BSTR bstr) ;
  722. STDMETHODIMP assign(BSTR bstr) ;
  723. STDMETHODIMP toString(BSTR *pbstr) ;
  724. // Helper function for COmWin
  725. // Takes a relative URL and returns the absolute URL using this
  726. // location as the base
  727. BSTR ComputeAbsoluteUrl( BSTR bstrUrlRelative );
  728. void RetryNavigate();
  729. protected:
  730. // *** CAutomationStub members ***
  731. virtual HRESULT _InternalQueryInterface(REFIID riid, void ** const ppvObj);
  732. virtual HRESULT _GetIDispatchExDelegate( IDispatchEx ** const delegate );
  733. // Helper function for the property access functions
  734. // Makes sure that the URL has been parsed and returns a copy
  735. // of the requested field as a BSTR.
  736. HRESULT GetField(BSTR* bstrField, BSTR* pbstr);
  737. HRESULT FreeStuff( );
  738. HRESULT CheckUrl( );
  739. // Helper function for the property setting functions
  740. // Makes sure that the URL has been parsed
  741. // Sets the field to its new value
  742. // recomposes the URL, IF fRecomposeUrl is true
  743. // If part of a window, tells the window to go to the new URL
  744. //
  745. //
  746. // @todo JavaScript has some funky behavior on field setting--
  747. // for example, the protocol field can be set to an entire URL.
  748. // We need to make sure this functionality is duplicated
  749. STDMETHODIMP SetField(BSTR* field, BSTR newval, BOOL fRecomposeUrl);
  750. STDMETHODIMP ComposeUrl();
  751. STDMETHODIMP DoNavigate();
  752. STDMETHODIMP ParseUrl();
  753. BSTR m_bstrFullUrl;
  754. BSTR m_bstrProtocol;
  755. BSTR m_bstrHostName;
  756. BSTR m_bstrPort;
  757. BSTR m_bstrPath;
  758. BSTR m_bstrSearch;
  759. BSTR m_bstrHash;
  760. BOOL m_fdontputinhistory:1;
  761. BOOL m_fPendingNavigate:1;
  762. BOOL m_fRetryingNavigate:1;
  763. }; // COmLocation
  764. friend class COmLocation;
  765. COmLocation _omloc;
  766. class CCommonCollection : public CAutomationStub
  767. {
  768. public:
  769. CCommonCollection();
  770. // *** IDispatchEx members ***
  771. STDMETHODIMP GetDispID(BSTR bstrName, DWORD grfdex, DISPID *pid);
  772. STDMETHODIMP InvokeEx(DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller);
  773. STDMETHODIMP DeleteMemberByName(BSTR bstr, DWORD grfdex)
  774. { return CAutomationStub::DeleteMemberByName(bstr, grfdex); }
  775. STDMETHODIMP DeleteMemberByDispID(DISPID id)
  776. { return CAutomationStub::DeleteMemberByDispID(id); }
  777. STDMETHODIMP GetMemberProperties(DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
  778. { return CAutomationStub::GetMemberProperties(id, grfdexFetch, pgrfdex); }
  779. STDMETHODIMP GetMemberName(DISPID id, BSTR *pbstrName)
  780. { return CAutomationStub::GetMemberName(id, pbstrName); }
  781. STDMETHODIMP GetNextDispID(DWORD grfdex, DISPID id, DISPID *pid)
  782. { return CAutomationStub::GetNextDispID(grfdex, id, pid); }
  783. STDMETHODIMP GetNameSpaceParent(IUnknown **ppunk)
  784. { return CAutomationStub::GetNameSpaceParent(ppunk); }
  785. STDMETHODIMP get_length(long* retval);
  786. protected:
  787. // *** CAutomationStub members ***
  788. virtual HRESULT _GetIDispatchExDelegate( IDispatchEx ** const delegate );
  789. };
  790. friend class CCommonCollection;
  791. #ifdef UNIX
  792. nested_cls_access:
  793. #endif
  794. class CMimeTypes : public IHTMLMimeTypesCollection, public CCommonCollection
  795. {
  796. public:
  797. HRESULT Init( );
  798. // *** IUnknown members ***
  799. STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj) { return CAutomationStub::QueryInterface(riid, ppvObj); }
  800. STDMETHODIMP_(ULONG) AddRef(void) { return CAutomationStub::AddRef( ); }
  801. STDMETHODIMP_(ULONG) Release(void) { return CAutomationStub::Release( ); }
  802. // *** IDispatch members ***
  803. STDMETHODIMP GetTypeInfoCount(UINT *pi) { return CAutomationStub::GetTypeInfoCount(pi); }
  804. STDMETHODIMP GetTypeInfo(UINT it, LCID lcid, ITypeInfo **pptypeinfo) { return CAutomationStub::GetTypeInfo(it,lcid,pptypeinfo); }
  805. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { return CAutomationStub::GetIDsOfNames(riid,rgszNames,cNames,lcid,rgDispId); }
  806. STDMETHODIMP Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *dispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr )
  807. { return CAutomationStub::Invoke(dispid,riid,lcid,wFlags,dispparams,pvarResult,pexcepinfo,puArgErr ); }
  808. // *** IHTMLMimeTypesCollection members ***
  809. STDMETHODIMP get_length(long* retval) {return CCommonCollection::get_length(retval);}
  810. protected:
  811. // *** CAutomationStub members ***
  812. virtual HRESULT _InternalQueryInterface( REFIID riid, void ** const ppvObj );
  813. };
  814. friend class CMimeTypes;
  815. CMimeTypes _mimeTypes;
  816. class CPlugins : public IHTMLPluginsCollection, public CCommonCollection
  817. {
  818. public:
  819. HRESULT Init( );
  820. // *** IUnknown members ***
  821. STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj) { return CAutomationStub::QueryInterface(riid, ppvObj); }
  822. STDMETHODIMP_(ULONG) AddRef(void) { return CAutomationStub::AddRef( ); }
  823. STDMETHODIMP_(ULONG) Release(void) { return CAutomationStub::Release( ); }
  824. // *** IDispatch members ***
  825. STDMETHODIMP GetTypeInfoCount(UINT *pi) { return CAutomationStub::GetTypeInfoCount(pi); }
  826. STDMETHODIMP GetTypeInfo(UINT it, LCID lcid, ITypeInfo **pptypeinfo) { return CAutomationStub::GetTypeInfo(it,lcid,pptypeinfo); }
  827. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { return CAutomationStub::GetIDsOfNames(riid,rgszNames,cNames,lcid,rgDispId); }
  828. STDMETHODIMP Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *dispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr )
  829. { return CAutomationStub::Invoke(dispid,riid,lcid,wFlags,dispparams,pvarResult,pexcepinfo,puArgErr ); }
  830. // *** IHTMLPluginsCollection members ***
  831. STDMETHODIMP get_length(long* retval) {return CCommonCollection::get_length(retval);}
  832. STDMETHODIMP refresh(VARIANT_BOOL fReload){ return S_OK;}
  833. protected:
  834. // *** CAutomationStub members ***
  835. virtual HRESULT _InternalQueryInterface( REFIID riid, void ** const ppvObj );
  836. };
  837. friend class CPlugins;
  838. CPlugins _plugins;
  839. /*******************/
  840. class COpsProfile :
  841. public IHTMLOpsProfile,
  842. public CAutomationStub,
  843. public IOpsProfileSimple
  844. {
  845. public:
  846. COpsProfile();
  847. ~COpsProfile();
  848. HRESULT Init();
  849. // *** IUnknown methods ***
  850. STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj) { return CAutomationStub::QueryInterface(riid, ppvObj); }
  851. STDMETHODIMP_(ULONG) AddRef(void) { return CAutomationStub::AddRef( ); }
  852. STDMETHODIMP_(ULONG) Release(void) { return CAutomationStub::Release( ); }
  853. // *** IDispatch members ***
  854. STDMETHODIMP GetTypeInfoCount(UINT *pi) { return CAutomationStub::GetTypeInfoCount(pi); }
  855. STDMETHODIMP GetTypeInfo(UINT it, LCID lcid, ITypeInfo **pptypeinfo) { return CAutomationStub::GetTypeInfo(it,lcid,pptypeinfo); }
  856. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { return CAutomationStub::GetIDsOfNames(riid,rgszNames,cNames,lcid,rgDispId); }
  857. STDMETHODIMP Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *dispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr )
  858. { return CAutomationStub::Invoke(dispid,riid,lcid,wFlags,dispparams,pvarResult,pexcepinfo,puArgErr ); }
  859. // Returns the named profile attribute in the second argument
  860. virtual STDMETHODIMP getAttribute(BSTR bstrAttribName, BSTR *bstrAttribValue);
  861. // Sets the named attirubute to the value given in the second argument
  862. virtual STDMETHODIMP setAttribute(BSTR bstrAttribName, BSTR bstrAttribValue, VARIANT vaPrefs, VARIANT_BOOL *pfSuccess);
  863. // Adds a request to the list
  864. virtual STDMETHODIMP addReadRequest(BSTR bstrName, VARIANT reserved, VARIANT_BOOL *pfSuccess);
  865. virtual STDMETHODIMP addRequest (BSTR bstrName, VARIANT reserved, VARIANT_BOOL *pfSuccess)
  866. { return addReadRequest(bstrName, reserved, pfSuccess); }
  867. // Clears the request list
  868. virtual STDMETHODIMP clearRequest();
  869. // Retrieves the items in the request list
  870. virtual STDMETHODIMP doRequest(VARIANT usage, VARIANT fname, VARIANT domain, VARIANT path, VARIANT expire, VARIANT reserved);
  871. virtual STDMETHODIMP doReadRequest(VARIANT usage, VARIANT fname, VARIANT domain, VARIANT path, VARIANT expire, VARIANT reserved)
  872. { return doRequest(usage, fname, domain, path, expire, reserved); }
  873. // Attempts to set the attributes in the change list
  874. virtual STDMETHODIMP commitChanges (VARIANT_BOOL *pfSuccess);
  875. virtual STDMETHODIMP doWriteRequest (VARIANT_BOOL *pfSuccess)
  876. { return commitChanges(pfSuccess); }
  877. // *** IOpsProfileSimple members ***
  878. STDMETHODIMP ReadProperties(long lNumProperties, const LPCWSTR szProperties[], LPWSTR szReturnValues[]);
  879. STDMETHODIMP WriteProperties(long lNumProperties, const LPCWSTR szProperties[], const LPCWSTR szValues[]);
  880. protected:
  881. // *** CAutomationStub members ***
  882. virtual HRESULT _InternalQueryInterface( REFIID riid, void ** const ppvObj );
  883. virtual HRESULT _GetIDispatchExDelegate(IDispatchEx ** const delegate);
  884. private:
  885. BOOL _ValidateElemName(LPCWSTR, INT *pIndex = NULL);
  886. #ifdef _USE_PSTORE_
  887. HRESULT _GetPStoreTypes(BSTR bstrField, GUID *pguidType, GUID *pguidSubtype, BSTR *bstrName);
  888. #endif // _USE_PSTORE_
  889. HRESULT _SetFieldValue(const OLECHAR *pszField, BSTR bstrValue);
  890. HRESULT _GetFieldValue(const OLECHAR *pszField, BSTR * pbstrValue);
  891. HRESULT _CreateStore();
  892. HRESULT _ReleaseStore();
  893. HRESULT _GetUsageCode(VARIANT vaUsage, LPTSTR bstrUsage, int cLen);
  894. BOOL _IsLocalMachine();
  895. BOOL _IsUsingSSL();
  896. static INT _GetCookieSettings();
  897. // Common helpers for both dialogs
  898. static BOOL _OPSDlg_OnClose(HWND hDlg);
  899. // Consent dialog functions.
  900. static INT_PTR _OPSConsent_DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam);
  901. static BOOL _OPSConsent_OnInitDlg(HWND hDlg);
  902. static BOOL _OPSConsent_ShowRequestedItems(HWND hDlg);
  903. static BOOL _OPSConsent_OnCommand(HWND hDlg, UINT id, UINT nCmd);
  904. static BOOL _OPSConsent_ViewCertificate(HWND hDlg);
  905. static BOOL _OPSConsent_EditProfile(HWND hDlg);
  906. // Update dialog functions.
  907. static INT_PTR _OPSUpdate_DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam);
  908. static BOOL _OPSUpdate_OnInitDlg(HWND hDlg);
  909. static BOOL _OPSUpdate_OnCommand(HWND hDlg, UINT id, UINT nCmd);
  910. static INT _GetAttrIndexFromName(LPCWSTR);
  911. static INT _GetResourceIdFromAttrName(WCHAR *);
  912. static HRESULT _StringFromBSTR(BSTR bstrSource, TCHAR *pszDest, DWORD dwDestSize);
  913. static HRESULT _StringFromVariant(VARIANT *vaSource, TCHAR *pszDest, DWORD dwDestSize);
  914. #ifdef _USE_PSTORE_
  915. PST_PROVIDERID m_provID;
  916. IPStore *m_pStore;
  917. #else
  918. BOOL m_bWABInit;
  919. HMODULE m_hInstWAB;
  920. LPADRBOOK m_lpAdrBook;
  921. LPWABOBJECT m_lpWABObject;
  922. HRESULT m_hrWAB;
  923. SBinary m_SBMe;
  924. #endif // _USE_PSTORE_
  925. unsigned m_iStoreRef;
  926. BSTR m_bstrLastURL;
  927. HDPA m_hdpaRequests;
  928. HDPA m_hdpaChanges;
  929. BOOL m_fEnabled;
  930. HKEY m_hP3Global;
  931. HKEY m_hP3Sites;
  932. public:
  933. enum { P3_QUERY, P3_DENY, P3_GRANT, P3_REQSSL };
  934. enum { P3_REJECT, P3_ACCEPT };
  935. enum { P3_NONE, P3_GLOBAL, P3_SITELEVEL };
  936. // Struct for user preferences
  937. struct P3UserPref {
  938. short int m_access;
  939. short int m_lastRequest;
  940. };
  941. // Struct for holding request information
  942. struct OPSRequestEntry {
  943. BSTR m_bstrName;
  944. BSTR m_bstrValue;
  945. BSTR m_bstrOldVal;
  946. BOOL m_fAnswer;
  947. BOOL m_fQuery;
  948. DWORD m_dwDecision;
  949. P3UserPref m_prefs;
  950. static int destWrapper(void *pEntry, void *pUnused);
  951. static int grantRequest(void *pEntry, void *pUnused);
  952. OPSRequestEntry();
  953. ~OPSRequestEntry();
  954. void grantRequest();
  955. void denyRequest();
  956. void clearValue();
  957. };
  958. struct AccessSettings {
  959. TCHAR m_rgchDomain[INTERNET_MAX_HOST_NAME_LENGTH];
  960. TCHAR m_rgchPath[MAX_PATH];
  961. FILETIME m_ftExpire;
  962. BOOL m_fExactDomain;
  963. BOOL m_fExactPath;
  964. BYTE m_rgbStdAllow[16];
  965. BYTE m_rgbStdDeny[16];
  966. };
  967. typedef AccessSettings *LPACS;
  968. struct OPSDlgInfo {
  969. HDPA m_hdpa;
  970. BSTR m_bstrFName;
  971. TCHAR m_rgchUsage[1024];
  972. TCHAR m_rgchURL[MAX_URL_STRING];
  973. BOOL m_fRemember;
  974. BOOL m_fAllBlank;
  975. AccessSettings *m_pacSettings;
  976. COpsProfile* m_pOpsProfile;
  977. OPSDlgInfo() : m_bstrFName(NULL), m_pOpsProfile(NULL) {}
  978. ~OPSDlgInfo() { SysFreeString(m_bstrFName); }
  979. };
  980. typedef struct OPSDlgInfo *LPOPSDLGINFO;
  981. VARIANT m_vUsage; // a-thkesa to solve Windows BUG:589837. store the usage as a member for the next use.
  982. BOOL _IsP3Enabled();
  983. HRESULT _GetUserPreference(BSTR bstrName, P3UserPref *pusrPref);
  984. HRESULT _PutUserPreference(BSTR bstrName, P3UserPref usrPref);
  985. HRESULT _ApplyPreferences(URL_COMPONENTS *pucComp, HDPA hdpaReqList);
  986. HRESULT _ApplyGlobalSettings(HDPA hdpaReqList);
  987. HRESULT _ApplySiteSettings(URL_COMPONENTS *pucComp, HDPA hdpaReqList);
  988. HRESULT _ApplyDomainSettings(URL_COMPONENTS *pucComp, HKEY hkey, HDPA hdpaReqList);
  989. BOOL _PathMatch(TCHAR *pszRoot, TCHAR *pszPath);
  990. BOOL _DomainMatch(TCHAR *pszHostName, TCHAR *pszDomain);
  991. BOOL _LegalPath(TCHAR *pszActual, TCHAR *pszReqPath);
  992. BOOL _LegalDomain(TCHAR *pszActual, TCHAR *pszReqDomain);
  993. BOOL _ReadBitVector(LPCBYTE ucBitVector, DWORD dwIndex);
  994. VOID _WriteBitVector(LPBYTE ucBitVector, DWORD dwIndex);
  995. HRESULT _GetSiteSettings(URL_COMPONENTS *pucComp, VARIANT vaDomain, VARIANT vaPath, VARIANT vaExpire, AccessSettings *pSettings);
  996. HRESULT _UpdateSiteSettings(AccessSettings *pSettings, HDPA hdpaReqList);
  997. BOOL _ApplySettings(AccessSettings *pac, URL_COMPONENTS *puc, HDPA hdpaReqList, DWORD *pdwLast);
  998. BOOL _ReadSettingsFromRegistry(HKEY hkey, AccessSettings *pac);
  999. BOOL _WriteSettingsToRegistry(HKEY hkey, AccessSettings *pac);
  1000. BOOL _DifferentURL();
  1001. static HRESULT _FormatSiteSettings(AccessSettings *pSettings, LPTSTR rgchOut, int cLimit);
  1002. static HRESULT _ClearAllSettings(HWND hwin = NULL);
  1003. friend HRESULT STDAPICALLTYPE ResetProfileSharing(HWND hwin);
  1004. }; // COPSProfile
  1005. friend class COpsProfile;
  1006. COpsProfile _profile;
  1007. /************/
  1008. #ifdef UNIX
  1009. protected:
  1010. #endif
  1011. class COmNavigator : public IOmNavigator, public CAutomationStub
  1012. {
  1013. public:
  1014. COmNavigator();
  1015. HRESULT Init(CMimeTypes *pMimeTypes, CPlugins *pPlugins, COpsProfile *pProfile);
  1016. virtual ~COmNavigator() { if(_UserAgent) SysFreeString(_UserAgent); }
  1017. // *** IUnknown members ***
  1018. STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj) { return CAutomationStub::QueryInterface(riid, ppvObj); }
  1019. STDMETHODIMP_(ULONG) AddRef(void) { return CAutomationStub::AddRef( ); }
  1020. STDMETHODIMP_(ULONG) Release(void) { return CAutomationStub::Release( ); }
  1021. // *** IDispatch members ***
  1022. STDMETHODIMP GetTypeInfoCount(UINT *pi) { return CAutomationStub::GetTypeInfoCount(pi); }
  1023. STDMETHODIMP GetTypeInfo(UINT it, LCID lcid, ITypeInfo **pptypeinfo) { return CAutomationStub::GetTypeInfo(it,lcid,pptypeinfo); }
  1024. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { return CAutomationStub::GetIDsOfNames(riid,rgszNames,cNames,lcid,rgDispId); }
  1025. STDMETHODIMP Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *dispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr );
  1026. // *** IDispatchEx members ***
  1027. STDMETHODIMP GetDispID(BSTR bstrName, DWORD grfdex, DISPID *pid)
  1028. { return CAutomationStub::GetDispID(bstrName, grfdex, pid); }
  1029. STDMETHODIMP InvokeEx(DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
  1030. { return CAutomationStub::InvokeEx(id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); }
  1031. STDMETHODIMP DeleteMemberByName(BSTR bstr, DWORD grfdex)
  1032. { return CAutomationStub::DeleteMemberByName(bstr, grfdex); }
  1033. STDMETHODIMP DeleteMemberByDispID(DISPID id)
  1034. { return CAutomationStub::DeleteMemberByDispID(id); }
  1035. STDMETHODIMP GetMemberProperties(DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
  1036. { return CAutomationStub::GetMemberProperties(id, grfdexFetch, pgrfdex); }
  1037. STDMETHODIMP GetMemberName(DISPID id, BSTR *pbstrName)
  1038. { return CAutomationStub::GetMemberName(id, pbstrName); }
  1039. STDMETHODIMP GetNextDispID(DWORD grfdex, DISPID id, DISPID *pid)
  1040. { return CAutomationStub::GetNextDispID(grfdex, id, pid); }
  1041. STDMETHODIMP GetNameSpaceParent(IUnknown **ppunk)
  1042. { return CAutomationStub::GetNameSpaceParent(ppunk); }
  1043. // *** IOmNavigator members ***
  1044. STDMETHODIMP get_appCodeName(BSTR* retval);
  1045. STDMETHODIMP get_appName(BSTR* retval);
  1046. STDMETHODIMP get_appVersion(BSTR* retval);
  1047. STDMETHODIMP get_userAgent(BSTR* retval);
  1048. STDMETHODIMP get_cookieEnabled(VARIANT_BOOL* retval);
  1049. STDMETHODIMP javaEnabled(VARIANT_BOOL* enabled);
  1050. STDMETHODIMP taintEnabled(VARIANT_BOOL* enabled);
  1051. STDMETHODIMP get_mimeTypes (IHTMLMimeTypesCollection**);
  1052. STDMETHODIMP get_plugins (IHTMLPluginsCollection**);
  1053. STDMETHODIMP get_opsProfile (IHTMLOpsProfile **ppOpsProfile);
  1054. STDMETHODIMP toString(BSTR * pbstr) ;
  1055. STDMETHODIMP get_cpuClass(BSTR * p);
  1056. STDMETHODIMP get_systemLanguage(BSTR * p);
  1057. STDMETHODIMP get_browserLanguage(BSTR * p);
  1058. STDMETHODIMP get_userLanguage(BSTR * p);
  1059. STDMETHODIMP get_platform(BSTR * p);
  1060. STDMETHODIMP get_appMinorVersion(BSTR * p);
  1061. STDMETHODIMP get_connectionSpeed(long * p);
  1062. STDMETHODIMP get_onLine(VARIANT_BOOL * p);
  1063. STDMETHODIMP get_userProfile (IHTMLOpsProfile **ppOpsProfile) { return get_opsProfile(ppOpsProfile); }
  1064. protected:
  1065. // *** CAutomationStub members ***
  1066. virtual HRESULT _InternalQueryInterface( REFIID riid, void ** const ppvObj );
  1067. virtual HRESULT _GetIDispatchExDelegate( IDispatchEx ** const delegate );
  1068. private:
  1069. HRESULT LoadUserAgent( );
  1070. BSTR _UserAgent;
  1071. BOOL _fLoaded;
  1072. CMimeTypes *_pMimeTypes;
  1073. CPlugins *_pPlugins;
  1074. COpsProfile *_pProfile;
  1075. }; // COmNavigator
  1076. friend class COmNavigator;
  1077. COmNavigator _omnav;
  1078. class COmHistory : public IOmHistory, public CAutomationStub
  1079. {
  1080. public:
  1081. COmHistory();
  1082. HRESULT Init( );
  1083. virtual ~COmHistory() {}
  1084. // *** IUnknown members ***
  1085. STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj) { return CAutomationStub::QueryInterface(riid, ppvObj); }
  1086. STDMETHODIMP_(ULONG) AddRef(void) { return CAutomationStub::AddRef( ); }
  1087. STDMETHODIMP_(ULONG) Release(void) { return CAutomationStub::Release( ); }
  1088. // *** IDispatch members ***
  1089. STDMETHODIMP GetTypeInfoCount(UINT *pi) { return CAutomationStub::GetTypeInfoCount(pi); }
  1090. STDMETHODIMP GetTypeInfo(UINT it, LCID lcid, ITypeInfo **pptypeinfo) { return CAutomationStub::GetTypeInfo(it,lcid,pptypeinfo); }
  1091. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { return CAutomationStub::GetIDsOfNames(riid,rgszNames,cNames,lcid,rgDispId); }
  1092. STDMETHODIMP Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *dispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr )
  1093. { return CAutomationStub::Invoke(dispid,riid,lcid,wFlags,dispparams,pvarResult,pexcepinfo,puArgErr ); }
  1094. // *** IDispatchEx members ***
  1095. STDMETHODIMP GetDispID(BSTR bstrName, DWORD grfdex, DISPID *pid)
  1096. { return CAutomationStub::GetDispID(bstrName, grfdex, pid); }
  1097. STDMETHODIMP InvokeEx(DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
  1098. { return CAutomationStub::InvokeEx(id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); }
  1099. STDMETHODIMP DeleteMemberByName(BSTR bstr, DWORD grfdex)
  1100. { return CAutomationStub::DeleteMemberByName(bstr, grfdex); }
  1101. STDMETHODIMP DeleteMemberByDispID(DISPID id)
  1102. { return CAutomationStub::DeleteMemberByDispID(id); }
  1103. STDMETHODIMP GetMemberProperties(DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
  1104. { return CAutomationStub::GetMemberProperties(id, grfdexFetch, pgrfdex); }
  1105. STDMETHODIMP GetMemberName(DISPID id, BSTR *pbstrName)
  1106. { return CAutomationStub::GetMemberName(id, pbstrName); }
  1107. STDMETHODIMP GetNextDispID(DWORD grfdex, DISPID id, DISPID *pid)
  1108. { return CAutomationStub::GetNextDispID(grfdex, id, pid); }
  1109. STDMETHODIMP GetNameSpaceParent(IUnknown **ppunk)
  1110. { return CAutomationStub::GetNameSpaceParent(ppunk); }
  1111. // *** IOmHistory members ***
  1112. STDMETHODIMP get_length(short* retval);
  1113. STDMETHODIMP back(VARIANT* pvargdistance);
  1114. STDMETHODIMP forward(VARIANT* pvargdistance);
  1115. STDMETHODIMP go(VARIANT* pvargdistance);
  1116. protected:
  1117. // *** CAutomationStub members ***
  1118. virtual HRESULT _InternalQueryInterface( REFIID riid, void ** const ppvObj );
  1119. virtual HRESULT _GetIDispatchExDelegate( IDispatchEx ** const delegate );
  1120. }; // COmHistory
  1121. friend class COmHistory;
  1122. COmHistory _omhist;
  1123. private:
  1124. static LONG s_cIEFrameAuto;
  1125. };
  1126. // Creates a new window, sets frame name (if appropriate)
  1127. HRESULT CreateTargetFrame(LPCOLESTR pszTargetName, LPUNKNOWN *ppunkTargetFrame);
  1128. HRESULT GetWindowFromUnknown( IUnknown *pUnk, IHTMLWindow2 ** const pWinOut );
  1129. HRESULT _TargetTopLevelWindows(LPTARGETFRAMEPRIV ptgfpThis, LPCOLESTR pszTargetName, DWORD dwFlags, LPUNKNOWN *ppunkTargetFrame);
  1130. #endif // _HLFRAME_H_