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.

1340 lines
64 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. // methods
  719. STDMETHODIMP reload(VARIANT_BOOL fFlag) ;
  720. STDMETHODIMP replace(BSTR bstr) ;
  721. STDMETHODIMP assign(BSTR bstr) ;
  722. STDMETHODIMP toString(BSTR *pbstr) ;
  723. // Helper function for COmWin
  724. // Takes a relative URL and returns the absolute URL using this
  725. // location as the base
  726. BSTR ComputeAbsoluteUrl( BSTR bstrUrlRelative );
  727. void RetryNavigate();
  728. protected:
  729. // *** CAutomationStub members ***
  730. virtual HRESULT _InternalQueryInterface(REFIID riid, void ** const ppvObj);
  731. virtual HRESULT _GetIDispatchExDelegate( IDispatchEx ** const delegate );
  732. // Helper function for the property access functions
  733. // Makes sure that the URL has been parsed and returns a copy
  734. // of the requested field as a BSTR.
  735. HRESULT GetField(BSTR* bstrField, BSTR* pbstr);
  736. HRESULT FreeStuff( );
  737. HRESULT CheckUrl( );
  738. // Helper function for the property setting functions
  739. // Makes sure that the URL has been parsed
  740. // Sets the field to its new value
  741. // recomposes the URL, IF fRecomposeUrl is true
  742. // If part of a window, tells the window to go to the new URL
  743. //
  744. //
  745. // @todo JavaScript has some funky behavior on field setting--
  746. // for example, the protocol field can be set to an entire URL.
  747. // We need to make sure this functionality is duplicated
  748. STDMETHODIMP SetField(BSTR* field, BSTR newval, BOOL fRecomposeUrl);
  749. STDMETHODIMP ComposeUrl();
  750. STDMETHODIMP DoNavigate();
  751. STDMETHODIMP ParseUrl();
  752. BSTR m_bstrFullUrl;
  753. BSTR m_bstrProtocol;
  754. BSTR m_bstrHostName;
  755. BSTR m_bstrPort;
  756. BSTR m_bstrPath;
  757. BSTR m_bstrSearch;
  758. BSTR m_bstrHash;
  759. BOOL m_fdontputinhistory:1;
  760. BOOL m_fPendingNavigate:1;
  761. BOOL m_fRetryingNavigate:1;
  762. }; // COmLocation
  763. friend class COmLocation;
  764. COmLocation _omloc;
  765. class CCommonCollection : public CAutomationStub
  766. {
  767. public:
  768. CCommonCollection();
  769. // *** IDispatchEx members ***
  770. STDMETHODIMP GetDispID(BSTR bstrName, DWORD grfdex, DISPID *pid);
  771. STDMETHODIMP InvokeEx(DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller);
  772. STDMETHODIMP DeleteMemberByName(BSTR bstr, DWORD grfdex)
  773. { return CAutomationStub::DeleteMemberByName(bstr, grfdex); }
  774. STDMETHODIMP DeleteMemberByDispID(DISPID id)
  775. { return CAutomationStub::DeleteMemberByDispID(id); }
  776. STDMETHODIMP GetMemberProperties(DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
  777. { return CAutomationStub::GetMemberProperties(id, grfdexFetch, pgrfdex); }
  778. STDMETHODIMP GetMemberName(DISPID id, BSTR *pbstrName)
  779. { return CAutomationStub::GetMemberName(id, pbstrName); }
  780. STDMETHODIMP GetNextDispID(DWORD grfdex, DISPID id, DISPID *pid)
  781. { return CAutomationStub::GetNextDispID(grfdex, id, pid); }
  782. STDMETHODIMP GetNameSpaceParent(IUnknown **ppunk)
  783. { return CAutomationStub::GetNameSpaceParent(ppunk); }
  784. STDMETHODIMP get_length(long* retval);
  785. protected:
  786. // *** CAutomationStub members ***
  787. virtual HRESULT _GetIDispatchExDelegate( IDispatchEx ** const delegate );
  788. };
  789. friend class CCommonCollection;
  790. #ifdef UNIX
  791. nested_cls_access:
  792. #endif
  793. class CMimeTypes : public IHTMLMimeTypesCollection, public CCommonCollection
  794. {
  795. public:
  796. HRESULT Init( );
  797. // *** IUnknown members ***
  798. STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj) { return CAutomationStub::QueryInterface(riid, ppvObj); }
  799. STDMETHODIMP_(ULONG) AddRef(void) { return CAutomationStub::AddRef( ); }
  800. STDMETHODIMP_(ULONG) Release(void) { return CAutomationStub::Release( ); }
  801. // *** IDispatch members ***
  802. STDMETHODIMP GetTypeInfoCount(UINT *pi) { return CAutomationStub::GetTypeInfoCount(pi); }
  803. STDMETHODIMP GetTypeInfo(UINT it, LCID lcid, ITypeInfo **pptypeinfo) { return CAutomationStub::GetTypeInfo(it,lcid,pptypeinfo); }
  804. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { return CAutomationStub::GetIDsOfNames(riid,rgszNames,cNames,lcid,rgDispId); }
  805. STDMETHODIMP Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *dispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr )
  806. { return CAutomationStub::Invoke(dispid,riid,lcid,wFlags,dispparams,pvarResult,pexcepinfo,puArgErr ); }
  807. // *** IHTMLMimeTypesCollection members ***
  808. STDMETHODIMP get_length(long* retval) {return CCommonCollection::get_length(retval);}
  809. protected:
  810. // *** CAutomationStub members ***
  811. virtual HRESULT _InternalQueryInterface( REFIID riid, void ** const ppvObj );
  812. };
  813. friend class CMimeTypes;
  814. CMimeTypes _mimeTypes;
  815. class CPlugins : public IHTMLPluginsCollection, public CCommonCollection
  816. {
  817. public:
  818. HRESULT Init( );
  819. // *** IUnknown members ***
  820. STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj) { return CAutomationStub::QueryInterface(riid, ppvObj); }
  821. STDMETHODIMP_(ULONG) AddRef(void) { return CAutomationStub::AddRef( ); }
  822. STDMETHODIMP_(ULONG) Release(void) { return CAutomationStub::Release( ); }
  823. // *** IDispatch members ***
  824. STDMETHODIMP GetTypeInfoCount(UINT *pi) { return CAutomationStub::GetTypeInfoCount(pi); }
  825. STDMETHODIMP GetTypeInfo(UINT it, LCID lcid, ITypeInfo **pptypeinfo) { return CAutomationStub::GetTypeInfo(it,lcid,pptypeinfo); }
  826. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { return CAutomationStub::GetIDsOfNames(riid,rgszNames,cNames,lcid,rgDispId); }
  827. STDMETHODIMP Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *dispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr )
  828. { return CAutomationStub::Invoke(dispid,riid,lcid,wFlags,dispparams,pvarResult,pexcepinfo,puArgErr ); }
  829. // *** IHTMLPluginsCollection members ***
  830. STDMETHODIMP get_length(long* retval) {return CCommonCollection::get_length(retval);}
  831. STDMETHODIMP refresh(VARIANT_BOOL fReload){ return S_OK;}
  832. protected:
  833. // *** CAutomationStub members ***
  834. virtual HRESULT _InternalQueryInterface( REFIID riid, void ** const ppvObj );
  835. };
  836. friend class CPlugins;
  837. CPlugins _plugins;
  838. /*******************/
  839. class COpsProfile :
  840. public IHTMLOpsProfile,
  841. public CAutomationStub,
  842. public IOpsProfileSimple
  843. {
  844. public:
  845. COpsProfile();
  846. ~COpsProfile();
  847. HRESULT Init();
  848. // *** IUnknown methods ***
  849. STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj) { return CAutomationStub::QueryInterface(riid, ppvObj); }
  850. STDMETHODIMP_(ULONG) AddRef(void) { return CAutomationStub::AddRef( ); }
  851. STDMETHODIMP_(ULONG) Release(void) { return CAutomationStub::Release( ); }
  852. // *** IDispatch members ***
  853. STDMETHODIMP GetTypeInfoCount(UINT *pi) { return CAutomationStub::GetTypeInfoCount(pi); }
  854. STDMETHODIMP GetTypeInfo(UINT it, LCID lcid, ITypeInfo **pptypeinfo) { return CAutomationStub::GetTypeInfo(it,lcid,pptypeinfo); }
  855. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { return CAutomationStub::GetIDsOfNames(riid,rgszNames,cNames,lcid,rgDispId); }
  856. STDMETHODIMP Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *dispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr )
  857. { return CAutomationStub::Invoke(dispid,riid,lcid,wFlags,dispparams,pvarResult,pexcepinfo,puArgErr ); }
  858. // Returns the named profile attribute in the second argument
  859. virtual STDMETHODIMP getAttribute(BSTR bstrAttribName, BSTR *bstrAttribValue);
  860. // Sets the named attirubute to the value given in the second argument
  861. virtual STDMETHODIMP setAttribute(BSTR bstrAttribName, BSTR bstrAttribValue, VARIANT vaPrefs, VARIANT_BOOL *pfSuccess);
  862. // Adds a request to the list
  863. virtual STDMETHODIMP addReadRequest(BSTR bstrName, VARIANT reserved, VARIANT_BOOL *pfSuccess);
  864. virtual STDMETHODIMP addRequest (BSTR bstrName, VARIANT reserved, VARIANT_BOOL *pfSuccess)
  865. { return addReadRequest(bstrName, reserved, pfSuccess); }
  866. // Clears the request list
  867. virtual STDMETHODIMP clearRequest();
  868. // Retrieves the items in the request list
  869. virtual STDMETHODIMP doRequest(VARIANT usage, VARIANT fname, VARIANT domain, VARIANT path, VARIANT expire, VARIANT reserved);
  870. virtual STDMETHODIMP doReadRequest(VARIANT usage, VARIANT fname, VARIANT domain, VARIANT path, VARIANT expire, VARIANT reserved)
  871. { return doRequest(usage, fname, domain, path, expire, reserved); }
  872. // Attempts to set the attributes in the change list
  873. virtual STDMETHODIMP commitChanges (VARIANT_BOOL *pfSuccess);
  874. virtual STDMETHODIMP doWriteRequest (VARIANT_BOOL *pfSuccess)
  875. { return commitChanges(pfSuccess); }
  876. // *** IOpsProfileSimple members ***
  877. STDMETHODIMP ReadProperties(long lNumProperties, const LPCWSTR szProperties[], LPWSTR szReturnValues[]);
  878. STDMETHODIMP WriteProperties(long lNumProperties, const LPCWSTR szProperties[], const LPCWSTR szValues[]);
  879. protected:
  880. // *** CAutomationStub members ***
  881. virtual HRESULT _InternalQueryInterface( REFIID riid, void ** const ppvObj );
  882. virtual HRESULT _GetIDispatchExDelegate(IDispatchEx ** const delegate);
  883. private:
  884. BOOL _ValidateElemName(LPCWSTR, INT *pIndex = NULL);
  885. #ifdef _USE_PSTORE_
  886. HRESULT _GetPStoreTypes(BSTR bstrField, GUID *pguidType, GUID *pguidSubtype, BSTR *bstrName);
  887. #endif // _USE_PSTORE_
  888. HRESULT _SetFieldValue(const OLECHAR *pszField, BSTR bstrValue);
  889. HRESULT _GetFieldValue(const OLECHAR *pszField, BSTR * pbstrValue);
  890. HRESULT _CreateStore();
  891. HRESULT _ReleaseStore();
  892. HRESULT _GetUsageCode(VARIANT vaUsage, LPTSTR bstrUsage, int cLen);
  893. BOOL _IsLocalMachine();
  894. BOOL _IsUsingSSL();
  895. static INT _GetCookieSettings();
  896. // Common helpers for both dialogs
  897. static BOOL _OPSDlg_OnClose(HWND hDlg);
  898. // Consent dialog functions.
  899. static INT_PTR _OPSConsent_DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam);
  900. static BOOL _OPSConsent_OnInitDlg(HWND hDlg);
  901. static BOOL _OPSConsent_ShowRequestedItems(HWND hDlg);
  902. static BOOL _OPSConsent_OnCommand(HWND hDlg, UINT id, UINT nCmd);
  903. static BOOL _OPSConsent_ViewCertificate(HWND hDlg);
  904. static BOOL _OPSConsent_EditProfile(HWND hDlg);
  905. // Update dialog functions.
  906. static INT_PTR _OPSUpdate_DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam);
  907. static BOOL _OPSUpdate_OnInitDlg(HWND hDlg);
  908. static BOOL _OPSUpdate_OnCommand(HWND hDlg, UINT id, UINT nCmd);
  909. static INT _GetAttrIndexFromName(LPCWSTR);
  910. static INT _GetResourceIdFromAttrName(WCHAR *);
  911. static HRESULT _StringFromBSTR(BSTR bstrSource, TCHAR *pszDest, DWORD cchDestSize);
  912. static HRESULT _StringFromVariant(VARIANT *vaSource, TCHAR *pszDest, DWORD cchDestSize);
  913. #ifdef _USE_PSTORE_
  914. PST_PROVIDERID m_provID;
  915. IPStore *m_pStore;
  916. #else
  917. BOOL m_bWABInit;
  918. HMODULE m_hInstWAB;
  919. LPADRBOOK m_lpAdrBook;
  920. LPWABOBJECT m_lpWABObject;
  921. HRESULT m_hrWAB;
  922. SBinary m_SBMe;
  923. #endif // _USE_PSTORE_
  924. unsigned m_iStoreRef;
  925. BSTR m_bstrLastURL;
  926. HDPA m_hdpaRequests;
  927. HDPA m_hdpaChanges;
  928. BOOL m_fEnabled;
  929. HKEY m_hP3Global;
  930. HKEY m_hP3Sites;
  931. public:
  932. enum { P3_QUERY, P3_DENY, P3_GRANT, P3_REQSSL };
  933. enum { P3_REJECT, P3_ACCEPT };
  934. enum { P3_NONE, P3_GLOBAL, P3_SITELEVEL };
  935. // Struct for user preferences
  936. struct P3UserPref {
  937. short int m_access;
  938. short int m_lastRequest;
  939. };
  940. // Struct for holding request information
  941. struct OPSRequestEntry {
  942. BSTR m_bstrName;
  943. BSTR m_bstrValue;
  944. BSTR m_bstrOldVal;
  945. BOOL m_fAnswer;
  946. BOOL m_fQuery;
  947. DWORD m_dwDecision;
  948. P3UserPref m_prefs;
  949. static int destWrapper(void *pEntry, void *pUnused);
  950. static int grantRequest(void *pEntry, void *pUnused);
  951. OPSRequestEntry();
  952. ~OPSRequestEntry();
  953. void grantRequest();
  954. void denyRequest();
  955. void clearValue();
  956. };
  957. struct AccessSettings {
  958. TCHAR m_rgchDomain[INTERNET_MAX_HOST_NAME_LENGTH];
  959. TCHAR m_rgchPath[MAX_PATH];
  960. FILETIME m_ftExpire;
  961. BOOL m_fExactDomain;
  962. BOOL m_fExactPath;
  963. BYTE m_rgbStdAllow[16];
  964. BYTE m_rgbStdDeny[16];
  965. };
  966. typedef AccessSettings *LPACS;
  967. struct OPSDlgInfo {
  968. HDPA m_hdpa;
  969. BSTR m_bstrFName;
  970. TCHAR m_rgchUsage[1024];
  971. TCHAR m_rgchURL[MAX_URL_STRING];
  972. BOOL m_fRemember;
  973. BOOL m_fAllBlank;
  974. AccessSettings *m_pacSettings;
  975. COpsProfile* m_pOpsProfile;
  976. OPSDlgInfo() : m_bstrFName(NULL), m_pOpsProfile(NULL) {}
  977. ~OPSDlgInfo() { SysFreeString(m_bstrFName); }
  978. };
  979. typedef struct OPSDlgInfo *LPOPSDLGINFO;
  980. VARIANT m_vUsage; // a-thkesa to solve Windows BUG:589837. store the usage as a member for the next use.
  981. BOOL _IsP3Enabled();
  982. HRESULT _GetUserPreference(BSTR bstrName, P3UserPref *pusrPref);
  983. HRESULT _PutUserPreference(BSTR bstrName, P3UserPref usrPref);
  984. HRESULT _ApplyPreferences(URL_COMPONENTS *pucComp, HDPA hdpaReqList);
  985. HRESULT _ApplyGlobalSettings(HDPA hdpaReqList);
  986. HRESULT _ApplySiteSettings(URL_COMPONENTS *pucComp, HDPA hdpaReqList);
  987. HRESULT _ApplyDomainSettings(URL_COMPONENTS *pucComp, HKEY hkey, HDPA hdpaReqList);
  988. BOOL _PathMatch(TCHAR *pszRoot, TCHAR *pszPath);
  989. BOOL _DomainMatch(TCHAR *pszHostName, TCHAR *pszDomain);
  990. BOOL _LegalPath(TCHAR *pszActual, TCHAR *pszReqPath);
  991. BOOL _LegalDomain(TCHAR *pszActual, TCHAR *pszReqDomain);
  992. BOOL _ReadBitVector(LPCBYTE ucBitVector, DWORD dwIndex);
  993. VOID _WriteBitVector(LPBYTE ucBitVector, DWORD dwIndex);
  994. HRESULT _GetSiteSettings(URL_COMPONENTS *pucComp, VARIANT vaDomain, VARIANT vaPath, VARIANT vaExpire, AccessSettings *pSettings);
  995. HRESULT _UpdateSiteSettings(AccessSettings *pSettings, HDPA hdpaReqList);
  996. BOOL _ApplySettings(AccessSettings *pac, URL_COMPONENTS *puc, HDPA hdpaReqList, DWORD *pdwLast);
  997. BOOL _ReadSettingsFromRegistry(HKEY hkey, AccessSettings *pac);
  998. BOOL _WriteSettingsToRegistry(HKEY hkey, AccessSettings *pac);
  999. BOOL _DifferentURL();
  1000. static HRESULT _FormatSiteSettings(AccessSettings *pSettings, LPTSTR rgchOut, int cLimit);
  1001. static HRESULT _ClearAllSettings(HWND hwin = NULL);
  1002. friend HRESULT STDAPICALLTYPE ResetProfileSharing(HWND hwin);
  1003. }; // COPSProfile
  1004. friend HRESULT STDAPICALLTYPE ResetProfileSharing(HWND hwin);
  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_