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.

708 lines
31 KiB

  1. #ifndef _BASESB2_H
  2. #define _BASESB2_H
  3. #include "iface.h"
  4. #include "track.h"
  5. #include "fldset.h"
  6. #include <vervec.h>
  7. #include <iethread.h>
  8. #include <profsvc.h>
  9. #include "browsext.h"
  10. #include "airesize.h"
  11. // this is used to identify the top frame browsers dwBrowserIndex
  12. #define BID_TOPFRAMEBROWSER ((DWORD)-1)
  13. void IECleanUpAutomationObject(void);
  14. #define CBASEBROWSER CBaseBrowser2
  15. class CBaseBrowser2 : public CAggregatedUnknown
  16. , public IShellBrowser
  17. , public IBrowserService3
  18. , public IServiceProvider
  19. , public IOleCommandTarget
  20. , public IOleContainer
  21. , public IOleInPlaceUIWindow
  22. , public IAdviseSink
  23. , public IDropTarget
  24. , public IInputObjectSite
  25. , public IDocNavigate
  26. , public IPersistHistory
  27. , public IInternetSecurityMgrSite
  28. , public IVersionHost
  29. , public IProfferServiceImpl
  30. , public ITravelLogClient
  31. , public ITravelLogClient2
  32. , public ITridentService2
  33. , public IShellBrowserService
  34. , public IInitViewLinkedWebOC
  35. , public INotifyAppStart
  36. {
  37. public:
  38. // IUnknown
  39. STDMETHODIMP QueryInterface(REFIID riid, void ** ppvObj) {return CAggregatedUnknown::QueryInterface(riid, ppvObj);};
  40. STDMETHODIMP_(ULONG) AddRef(void) { return CAggregatedUnknown::AddRef();};
  41. STDMETHODIMP_(ULONG) Release(void) { return CAggregatedUnknown::Release();};
  42. // IOleWindow
  43. STDMETHODIMP GetWindow(HWND * lphwnd);
  44. STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
  45. // IShellBrowser (same as IOleInPlaceFrame)
  46. STDMETHODIMP InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths);
  47. STDMETHODIMP SetMenuSB(HMENU hmenuShared, HOLEMENU holemenu, HWND hwnd);
  48. STDMETHODIMP RemoveMenusSB(HMENU hmenuShared);
  49. STDMETHODIMP SetStatusTextSB(LPCOLESTR lpszStatusText);
  50. STDMETHODIMP EnableModelessSB(BOOL fEnable);
  51. STDMETHODIMP TranslateAcceleratorSB(LPMSG lpmsg, WORD wID);
  52. STDMETHODIMP BrowseObject(LPCITEMIDLIST pidl, UINT wFlags);
  53. STDMETHODIMP GetViewStateStream(DWORD grfMode, LPSTREAM *ppStrm) {return E_NOTIMPL; };
  54. STDMETHODIMP GetControlWindow(UINT id, HWND * lphwnd);
  55. STDMETHODIMP SendControlMsg(UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret);
  56. STDMETHODIMP QueryActiveShellView(struct IShellView ** ppshv);
  57. STDMETHODIMP OnViewWindowActive(struct IShellView * ppshv);
  58. STDMETHODIMP SetToolbarItems(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags);
  59. // IOleInPlaceUIWindow (also IOleWindow)
  60. STDMETHODIMP GetBorder(LPRECT lprectBorder);
  61. STDMETHODIMP RequestBorderSpace(LPCBORDERWIDTHS pborderwidths);
  62. STDMETHODIMP SetBorderSpace(LPCBORDERWIDTHS pborderwidths);
  63. STDMETHODIMP SetActiveObject(IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName);
  64. // IOleCommandTarget
  65. STDMETHODIMP QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD rgCmds[], OLECMDTEXT *pcmdtext);
  66. STDMETHODIMP Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut);
  67. // IOleContainer
  68. STDMETHODIMP ParseDisplayName(IBindCtx *pbc, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut);
  69. STDMETHODIMP EnumObjects(DWORD grfFlags, IEnumUnknown **ppenum);
  70. STDMETHODIMP LockContainer( BOOL fLock);
  71. // IBrowserService
  72. STDMETHODIMP GetParentSite(struct IOleInPlaceSite** ppipsite);
  73. STDMETHODIMP SetTitle(IShellView *psv, LPCWSTR pszName);
  74. STDMETHODIMP GetTitle(IShellView *psv, LPWSTR pszName, DWORD cchName);
  75. STDMETHODIMP GetOleObject(struct IOleObject** ppobjv);
  76. STDMETHODIMP GetTravelLog(ITravelLog **pptl);
  77. STDMETHODIMP ShowControlWindow(UINT id, BOOL fShow);
  78. STDMETHODIMP IsControlWindowShown(UINT id, BOOL *pfShown);
  79. STDMETHODIMP IEGetDisplayName(LPCITEMIDLIST pidl, LPWSTR pwszName, UINT uFlags);
  80. STDMETHODIMP IEParseDisplayName(UINT uiCP, LPCWSTR pwszPath, LPITEMIDLIST * ppidlOut);
  81. STDMETHODIMP DisplayParseError(HRESULT hres, LPCWSTR pwszPath);
  82. STDMETHODIMP NavigateToPidl(LPCITEMIDLIST pidl, DWORD grfHLNF);
  83. STDMETHODIMP SetNavigateState(BNSTATE bnstate);
  84. STDMETHODIMP GetNavigateState(BNSTATE *pbnstate);
  85. STDMETHODIMP UpdateWindowList(void);
  86. STDMETHODIMP UpdateBackForwardState(void);
  87. STDMETHODIMP NotifyRedirect(IShellView* psv, LPCITEMIDLIST pidl, BOOL *pfDidBrowse);
  88. STDMETHODIMP SetFlags(DWORD dwFlags, DWORD dwFlagMask);
  89. STDMETHODIMP GetFlags(DWORD *pdwFlags);
  90. STDMETHODIMP CanNavigateNow(void);
  91. STDMETHODIMP GetPidl(LPITEMIDLIST *ppidl);
  92. STDMETHODIMP SetReferrer(LPITEMIDLIST pidl);
  93. STDMETHODIMP_(DWORD) GetBrowserIndex(void);
  94. STDMETHODIMP GetBrowserByIndex(DWORD dwID, IUnknown **ppunk);
  95. STDMETHODIMP GetHistoryObject(IOleObject **ppole, IStream **ppstm, IBindCtx **ppbc);
  96. STDMETHODIMP SetHistoryObject(IOleObject *pole, BOOL fIsLocalAnchor);
  97. STDMETHODIMP CacheOLEServer(IOleObject *pole);
  98. STDMETHODIMP GetSetCodePage(VARIANT* pvarIn, VARIANT* pvarOut);
  99. STDMETHODIMP OnHttpEquiv(IShellView* psv, BOOL fDone, VARIANT *pvarargIn, VARIANT *pvarargOut);
  100. STDMETHODIMP GetPalette( HPALETTE * hpal );
  101. STDMETHODIMP RegisterWindow(BOOL fUnregister, int swc) {return E_NOTIMPL;}
  102. STDMETHODIMP_(LRESULT) WndProcBS(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  103. STDMETHODIMP OnSize(WPARAM wParam);
  104. STDMETHODIMP OnCreate(LPCREATESTRUCT pcs);
  105. STDMETHODIMP_(LRESULT) OnCommand(WPARAM wParam, LPARAM lParam);
  106. STDMETHODIMP OnDestroy();
  107. STDMETHODIMP ReleaseShellView();
  108. STDMETHODIMP ActivatePendingView();
  109. STDMETHODIMP_(LRESULT) OnNotify(NMHDR * pnm);
  110. STDMETHODIMP OnSetFocus();
  111. STDMETHODIMP OnFrameWindowActivateBS(BOOL fActive);
  112. STDMETHODIMP SetTopBrowser();
  113. STDMETHODIMP UpdateSecureLockIcon(int eSecureLock);
  114. STDMETHODIMP Offline(int iCmd);
  115. STDMETHODIMP SetActivateState(UINT uActivate) { _bbd._uActivateState = uActivate; return S_OK;};
  116. STDMETHODIMP AllowViewResize(BOOL f) { HRESULT hres = _fDontResizeView ? S_FALSE : S_OK; _fDontResizeView = !BOOLIFY(f); return hres;};
  117. STDMETHODIMP InitializeDownloadManager();
  118. STDMETHODIMP InitializeTransitionSite();
  119. STDMETHODIMP CreateViewWindow(IShellView* psvNew, IShellView* psvOld, LPRECT prcView, HWND* phwnd);
  120. STDMETHODIMP GetFolderSetData(struct tagFolderSetData*) { ASSERT(0); return E_NOTIMPL;};
  121. STDMETHODIMP CreateBrowserPropSheetExt(REFIID, void **) { ASSERT(0); return E_NOTIMPL;};
  122. STDMETHODIMP GetBaseBrowserData( LPCBASEBROWSERDATA* ppbd ) { *ppbd = &_bbd; return S_OK; };
  123. STDMETHODIMP_(LPBASEBROWSERDATA) PutBaseBrowserData() { return &_bbd; };
  124. STDMETHODIMP SetAsDefFolderSettings() { TraceMsg(TF_ERROR, "CBaseBrowser2::SetAsDefFolderSettings called, returned E_NOTIMPL"); return E_NOTIMPL;};
  125. STDMETHODIMP GetViewRect(RECT* prc);
  126. STDMETHODIMP GetViewWindow(HWND * phwndView);
  127. STDMETHODIMP InitializeTravelLog(ITravelLog* ptl, DWORD dw);
  128. STDMETHODIMP _Initialize(HWND hwnd, IUnknown *pauto);
  129. // ITravelLogClient
  130. STDMETHODIMP FindWindowByIndex(DWORD dwID, IUnknown ** ppunk);
  131. STDMETHODIMP GetWindowData(LPWINDOWDATA pWinData);
  132. STDMETHODIMP LoadHistoryPosition(LPOLESTR pszUrlLocation, DWORD dwCookie);
  133. // ITridentService
  134. STDMETHODIMP FireBeforeNavigate2(IDispatch * pDispatch,
  135. LPCTSTR lpszUrl,
  136. DWORD dwFlags,
  137. LPCTSTR lpszFrameName,
  138. LPBYTE pPostData,
  139. DWORD cbPostData,
  140. LPCTSTR lpszHeaders,
  141. BOOL fPlayNavSound,
  142. BOOL * pfCancel);
  143. STDMETHODIMP FireNavigateComplete2(IHTMLWindow2 * pHTMLWindow2,
  144. DWORD dwFlags);
  145. STDMETHODIMP FireDownloadBegin();
  146. STDMETHODIMP FireDownloadComplete();
  147. STDMETHODIMP FireDocumentComplete(IHTMLWindow2 * pHTMLWindow2,
  148. DWORD dwFlags);
  149. STDMETHODIMP UpdateDesktopComponent(IHTMLWindow2 * pHTMLWindow);
  150. STDMETHODIMP GetPendingUrl(BSTR * pbstrPendingUrl);
  151. STDMETHODIMP ActiveElementChanged(IHTMLElement * pHTMLElement);
  152. STDMETHODIMP GetUrlSearchComponent(BSTR * pbstrSearch);
  153. STDMETHODIMP IsErrorUrl(LPCTSTR lpszUrl, BOOL *pfIsError);
  154. STDMETHOD(FireNavigateError)(IHTMLWindow2 * pHTMLWindow2,
  155. DWORD dwStatusCode,
  156. BOOL * pfCancel)
  157. {
  158. ASSERT(0);
  159. return E_NOTIMPL;
  160. }
  161. // ITridentService2
  162. //
  163. STDMETHODIMP AttachMyPics(void *pDoc2, void **ppMyPics);
  164. STDMETHODIMP_(BOOL) ReleaseMyPics(void *pMyPics);
  165. STDMETHODIMP InitAutoImageResize();
  166. STDMETHODIMP UnInitAutoImageResize();
  167. STDMETHODIMP IsGalleryMeta(BOOL bFlag, void *pMyPics);
  168. STDMETHODIMP EmailPicture(BSTR bstrURL);
  169. STDMETHODIMP FireNavigateError(IHTMLWindow2 * pHTMLWindow2,
  170. BSTR bstrURL,
  171. BSTR bstrTargetFrameName,
  172. DWORD dwStatusCode,
  173. BOOL * pfCancel);
  174. STDMETHODIMP FirePrintTemplateEvent(IHTMLWindow2 * pHTMLWindow2, DISPID dispidPrintEvent);
  175. STDMETHODIMP FireUpdatePageStatus(IHTMLWindow2 * pHTMLWindow2, DWORD nPage, BOOL fDone);
  176. STDMETHODIMP FirePrivacyImpactedStateChange(BOOL bPrivacyImpacted);
  177. STDMETHODIMP_(UINT) _get_itbLastFocus() { ASSERT(0); return ITB_VIEW; };
  178. STDMETHODIMP _put_itbLastFocus(UINT itbLastFocus) { return E_NOTIMPL; };
  179. // IShellBrowserService
  180. //
  181. STDMETHODIMP GetPropertyBag(DWORD dwFlags, REFIID riid, void** ppv) {ASSERT(0); return E_NOTIMPL;}
  182. // see _UIActivateView, below
  183. // BEGIN REVIEW: review names and need of each.
  184. //
  185. // this first set could be basebrowser only members. no one overrides
  186. STDMETHODIMP _CancelPendingNavigationAsync() ;
  187. STDMETHODIMP _CancelPendingView() ;
  188. STDMETHODIMP _MaySaveChanges() ;
  189. STDMETHODIMP _PauseOrResumeView( BOOL fPaused) ;
  190. STDMETHODIMP _DisableModeless() ;
  191. // rethink these... are all of these necessary?
  192. STDMETHODIMP _NavigateToPidl( LPCITEMIDLIST pidl, DWORD grfHLNF, DWORD dwFlags);
  193. STDMETHODIMP _TryShell2Rename( IShellView* psv, LPCITEMIDLIST pidlNew);
  194. STDMETHODIMP _SwitchActivationNow( );
  195. // this belongs with the toolbar set.
  196. STDMETHODIMP _ExecChildren(IUnknown *punkBar, BOOL fBroadcast,
  197. const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt,
  198. VARIANTARG *pvarargIn, VARIANTARG *pvarargOut);
  199. STDMETHODIMP _SendChildren(HWND hwndBar, BOOL fBroadcast,
  200. UINT uMsg, WPARAM wParam, LPARAM lParam);
  201. STDMETHODIMP _GetViewBorderRect(RECT* prc);
  202. STDMETHODIMP _UpdateViewRectSize();
  203. STDMETHODIMP _ResizeNextBorder(UINT itb);
  204. STDMETHODIMP _ResizeView();
  205. // Notes: Only CDesktopBrowser may sublcass this.
  206. STDMETHODIMP _GetEffectiveClientArea(LPRECT lprectBorder, HMONITOR hmon);
  207. //END REVIEW:
  208. // CDesktopBrowser accesses CCommonBrowser implementations of these:
  209. STDMETHODIMP_(IStream*) v_GetViewStream(LPCITEMIDLIST pidl, DWORD grfMode, LPCWSTR pwszName) { ASSERT(FALSE); return NULL; }
  210. STDMETHODIMP_(LRESULT) ForwardViewMsg(UINT uMsg, WPARAM wParam, LPARAM lParam) { ASSERT(FALSE); return 0; }
  211. STDMETHODIMP SetAcceleratorMenu(HACCEL hacc) { ASSERT(FALSE); return E_NOTIMPL; }
  212. STDMETHODIMP_(int) _GetToolbarCount(THIS) { ASSERT(FALSE); return 0; }
  213. STDMETHODIMP_(LPTOOLBARITEM) _GetToolbarItem(THIS_ int itb) { ASSERT(FALSE); return NULL; }
  214. STDMETHODIMP _SaveToolbars(IStream* pstm) { ASSERT(FALSE); return E_NOTIMPL; }
  215. STDMETHODIMP _LoadToolbars(IStream* pstm) { ASSERT(FALSE); return E_NOTIMPL; }
  216. STDMETHODIMP _CloseAndReleaseToolbars(BOOL fClose) { ASSERT(FALSE); return E_NOTIMPL; }
  217. STDMETHODIMP v_MayGetNextToolbarFocus(LPMSG lpMsg, UINT itbNext, int citb, LPTOOLBARITEM * pptbi, HWND * phwnd) { ASSERT(FALSE); return E_NOTIMPL; };
  218. STDMETHODIMP _ResizeNextBorderHelper(UINT itb, BOOL bUseHmonitor) { ASSERT(FALSE); return E_NOTIMPL; }
  219. STDMETHODIMP_(UINT) _FindTBar(IUnknown* punkSrc) { ASSERT(FALSE); return (UINT)-1; };
  220. STDMETHODIMP _SetFocus(LPTOOLBARITEM ptbi, HWND hwnd, LPMSG lpMsg) { ASSERT(FALSE); return E_NOTIMPL; }
  221. STDMETHODIMP v_MayTranslateAccelerator(MSG* pmsg) { ASSERT(FALSE); return E_NOTIMPL; }
  222. STDMETHODIMP _GetBorderDWHelper(IUnknown* punkSrc, LPRECT lprectBorder, BOOL bUseHmonitor) { ASSERT(FALSE); return E_NOTIMPL; }
  223. // CShellBrowser overrides this.
  224. STDMETHODIMP v_CheckZoneCrossing(LPCITEMIDLIST pidl) {return S_OK;};
  225. // IServiceProvider
  226. STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void ** ppvObj);
  227. // IAdviseSink
  228. STDMETHODIMP_(void) OnDataChange(FORMATETC *, STGMEDIUM *);
  229. STDMETHODIMP_(void) OnViewChange(DWORD dwAspect, LONG lindex);
  230. STDMETHODIMP_(void) OnRename(IMoniker *);
  231. STDMETHODIMP_(void) OnSave();
  232. STDMETHODIMP_(void) OnClose();
  233. // IDropTarget ***
  234. STDMETHODIMP DragEnter(IDataObject *pdtobj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  235. STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  236. STDMETHODIMP DragLeave(void);
  237. STDMETHODIMP Drop(IDataObject *pdtobj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  238. // IInputObjectSite
  239. STDMETHODIMP OnFocusChangeIS(IUnknown* punkSrc, BOOL fSetFocus);
  240. // IDocNavigate
  241. STDMETHODIMP OnReadyStateChange(IShellView* psvSource, DWORD dwReadyState);
  242. STDMETHODIMP get_ReadyState(DWORD * pdwReadyState);
  243. // IPersist
  244. STDMETHODIMP GetClassID(CLSID *pclsid);
  245. // IPersistHistory
  246. STDMETHODIMP LoadHistory(IStream *pStream, IBindCtx *pbc);
  247. STDMETHODIMP SaveHistory(IStream *pStream);
  248. STDMETHODIMP SetPositionCookie(DWORD dwPositionCookie);
  249. STDMETHODIMP GetPositionCookie(DWORD *pdwPositioncookie);
  250. // IInternetSecurityMgrSite
  251. // STDMETHODIMP GetWindow(HWND * lphwnd) { return IOleWindow::GetWindow(lphwnd); }
  252. STDMETHODIMP EnableModeless(BOOL fEnable) { return EnableModelessSB(fEnable); }
  253. // IVersionHost
  254. STDMETHODIMP QueryUseLocalVersionVector( BOOL *fUseLocal);
  255. STDMETHODIMP QueryVersionVector( IVersionVector *pVersion);
  256. // ITravelLogClient2
  257. STDMETHODIMP GetDummyWindowData(LPWSTR pszUrl, LPWSTR pszTitle, LPWINDOWDATA pWinData);
  258. // This is the QueryInterface the aggregator implements
  259. virtual HRESULT v_InternalQueryInterface(REFIID riid, void ** ppvObj);
  260. // IInitViewLinkedWebOC methods
  261. STDMETHODIMP SetViewLinkedWebOC(BOOL bValue)
  262. {
  263. _fIsViewLinkedWebOC = bValue;
  264. return S_OK;
  265. };
  266. STDMETHODIMP IsViewLinkedWebOC(BOOL* pbValue)
  267. {
  268. ASSERT(pbValue);
  269. *pbValue = _fIsViewLinkedWebOC;
  270. return S_OK;
  271. };
  272. STDMETHODIMP SetViewLinkedWebOCFrame(IDispatch * pDisp)
  273. {
  274. HRESULT hr = E_FAIL;
  275. ASSERT(pDisp);
  276. ATOMICRELEASE(_pDispViewLinkedWebOCFrame);
  277. hr = IUnknown_QueryService(pDisp,
  278. SID_SWebBrowserApp,
  279. IID_PPV_ARG(IWebBrowser2, &_pDispViewLinkedWebOCFrame));
  280. if (FAILED(hr))
  281. {
  282. _fIsViewLinkedWebOC = FALSE;
  283. }
  284. return hr;
  285. };
  286. STDMETHODIMP GetViewLinkedWebOCFrame(IDispatch** ppDisp)
  287. {
  288. ASSERT(_fIsViewLinkedWebOC);
  289. ASSERT(_pDispViewLinkedWebOCFrame);
  290. ASSERT(ppDisp);
  291. *ppDisp = _pDispViewLinkedWebOCFrame;
  292. _pDispViewLinkedWebOCFrame->AddRef();
  293. return S_OK;
  294. };
  295. STDMETHODIMP SetFrameName(BSTR bstrFrameName);
  296. // INotifyAppStart
  297. STDMETHODIMP AppStarting(void);
  298. STDMETHODIMP AppStarted(void);
  299. static BSTR GetHTMLWindowUrl(IHTMLWindow2 * pHTMLWindow);
  300. static LPITEMIDLIST PidlFromUrl(BSTR bstrUrl);
  301. protected:
  302. // "protected" so derived classes can construct/destruct us too
  303. CBaseBrowser2(IUnknown* punkAgg);
  304. virtual ~CBaseBrowser2();
  305. friend HRESULT CBaseBrowser2_CreateInstance(IUnknown* pUnkOuter, IUnknown** ppunk, LPCOBJECTINFO poi);
  306. friend HRESULT CBaseBrowser2_Validate(HWND hwnd, void ** ppsb);
  307. // topmost CBaseBrowser2 in a frameset (IE3/AOL/CIS/VB)
  308. virtual void _OnNavigateComplete(LPCITEMIDLIST pidl, DWORD grfHLNF);
  309. virtual HRESULT _CheckZoneCrossing(LPCITEMIDLIST pidl);
  310. virtual STDMETHODIMP _PositionViewWindow(HWND hwnd, LPRECT prc);
  311. void _PositionViewWindowHelper(HWND hwnd, LPRECT prc);
  312. virtual LRESULT _DefWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  313. virtual void _ViewChange(DWORD dwAspect, LONG lindex);
  314. virtual void _UpdateBackForwardState();
  315. virtual BOOL v_OnSetCursor(LPARAM lParam);
  316. virtual STDMETHODIMP v_ShowHideChildWindows(BOOL fChildOnly);
  317. virtual void v_PropagateMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL fSend);
  318. virtual HRESULT _ShowBlankPage(LPCTSTR pszAboutUrl, LPCITEMIDLIST pidlIntended);
  319. // ViewStateStream related
  320. HRESULT _CheckInCacheIfOffline(LPCITEMIDLIST pidl, BOOL fIsAPost);
  321. void _CreateShortcutOnDesktop(IUnknown *pUnk, BOOL fUI);
  322. void _AddToFavorites(LPCITEMIDLIST pidl, LPCTSTR pszTitle, BOOL fDisplayUI);
  323. // to avoid having to pass hwnd on every message to WndProc, set it once
  324. void _SetWindow(HWND hwnd) { _bbd._hwnd = hwnd; }
  325. void _DoOptions(VARIANT* pvar);
  326. LRESULT _OnGoto(void);
  327. void _NavigateToPidlAsync(LPITEMIDLIST pidl, DWORD dwSBSP, BOOL fDontCallCancel = FALSE);
  328. BOOL _CanNavigate(void);
  329. // inline so that lego will get the right opt.
  330. void _PreActivatePendingViewAsync(void)
  331. {
  332. _StopAsyncOperation();
  333. };
  334. BOOL _ActivatePendingViewAsync(void);
  335. void _FreeQueuedPidl(LPITEMIDLIST* ppidl);
  336. void _StopAsyncOperation(void);
  337. void _MayUnblockAsyncOperation();
  338. BOOL _PostAsyncOperation(UINT uAction);
  339. LRESULT _SendAsyncOperation(UINT uAction);
  340. void _SendAsyncNavigationMsg(VARIANTARG *pvarargIn);
  341. HRESULT _OnCoCreateDocument(VARIANTARG *pvarargOut);
  342. void _NotifyCommandStateChange();
  343. BOOL _IsViewMSHTML(IShellView * psv);
  344. BOOL _ActivateView(BSTR bstrUrl,
  345. LPITEMIDLIST pidl,
  346. DWORD dwFlags,
  347. BOOL fIsErrorUrl);
  348. HRESULT _GetWebBrowserForEvt(IDispatch * pDispatch,
  349. IWebBrowser2 ** ppWebBrowser);
  350. void _Exec_psbMixedZone();
  351. #ifdef TEST_AMBIENTS
  352. BOOL _LocalOffline(int iCmd);
  353. BOOL _LocalSilent(int iCmd);
  354. #endif // TEST_AMBIENTS
  355. #define NAVTYPE_ShellNavigate 0x01
  356. #define NAVTYPE_PageIsChanging 0x02
  357. #define NAVTYPE_SiteIsChanging 0x04
  358. void _EnableStop(BOOL fEnable);
  359. LRESULT _OnInitMenuPopup(HMENU hmenuPopup, int nIndex, BOOL fSystemMenu);
  360. HRESULT _updateNavigationUI();
  361. HRESULT _setDescendentNavigate(VARIANTARG *pvarargIn);
  362. void _UpdateBrowserState(LPCITEMIDLIST pidl);
  363. void _UpdateDocHostState(LPITEMIDLIST pidl, BOOL fIsErrorUrl) const;
  364. HRESULT _FireBeforeNavigateEvent(LPCITEMIDLIST pidl, BOOL* pfUseCache);
  365. LPITEMIDLIST _GetPidlForDisplay(BSTR bstrUrl, BOOL * pfIsErrorUrl = NULL);
  366. HRESULT _OpenNewFrame(LPITEMIDLIST pidlNew, UINT wFlags);
  367. STDMETHODIMP _UIActivateView(UINT uState);
  368. HRESULT _CancelPendingNavigation(BOOL fDontReleaseState = FALSE);
  369. void _StopCurrentView(void);
  370. void _MayTrackClickStream(LPITEMIDLIST pidlThis); // (peihwal)
  371. STDMETHODIMP _OnFocusChange(UINT itb);
  372. void _RegisterAsDropTarget();
  373. void _UnregisterAsDropTarget();
  374. HRESULT _InitDocHost(IWebBrowser2 * pWebBrowser);
  375. enum BrowserPaletteType
  376. {
  377. BPT_DeferPaletteSupport = 0, // we don't think we own the palette
  378. BPT_UnknownDisplay, // need to decide if we need a palette
  379. BPT_DisplayViewChanged, // BPT_UnknownDisplay handling notify
  380. BPT_UnknownPalette, // need to decide what palette to use
  381. BPT_PaletteViewChanged, // BPT_UnknownPalette handling notify
  382. BPT_Normal, // handle WM_QUERYNEWPALETTE ourselves
  383. BPT_ShellView, // forward WM_QUERYNEWPALETTE to view
  384. BPT_NotPalettized // not a palettized display, do nothing
  385. };
  386. void _ColorsDirty(BrowserPaletteType bptNew);
  387. void _DisplayChanged(WPARAM wParam, LPARAM lParam);
  388. HRESULT _UpdateBrowserPaletteInPlace(LOGPALETTE *plp);
  389. void _RealizeBrowserPalette(BOOL fBackground);
  390. virtual void _PaletteChanged(WPARAM wParam, LPARAM lParam);
  391. BOOL _QueryNewPalette();
  392. /// BEGIN-CHC- Security fix for viewing non shdocvw ishellviews
  393. void _CheckDisableViewWindow();
  394. BOOL _SubclassDefview();
  395. static LRESULT DefViewWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  396. WNDPROC _pfnDefView;
  397. /// END-CHC- Security fix for viewing non shdocvw ishellviews
  398. void _DLMDestroy(void);
  399. void _DLMUpdate(MSOCMD* prgCmd);
  400. void _DLMRegister(IUnknown* punk);
  401. void CreateNewSyncShellView( void );
  402. void _UpdateTravelLog(BOOL fForceUpdate = FALSE);
  403. virtual BOOL _HeyMoe_IsWiseGuy(void) {return FALSE;}
  404. IBrowserService2* _pbsOuter;
  405. IBrowserService3* _pbsOuter3;
  406. IShellBrowser* _psbOuter;
  407. IServiceProvider* _pspOuter;
  408. IDockingWindowSite* _pdwsOuter;
  409. // The following are intercepted by CCommonBrowser, but we don't call 'em
  410. //IOleCommandTarget* _pctOuter;
  411. //IInputObjectSite* _piosOuter;
  412. BASEBROWSERDATA _bbd;
  413. IUnknown *_pauto;
  414. BrowserPaletteType _bptBrowser;
  415. HPALETTE _hpalBrowser;
  416. IViewObject *_pvo; // view object implementation on the shell view
  417. UINT _cRefUIActivateSV;
  418. DWORD _dwBrowserIndex;
  419. DWORD _dwReadyState;
  420. DWORD _dwReadyStateCur;
  421. LPWSTR _pszTitleCur;
  422. IDropTarget * _pdtView; // Pointer to _bbd._psv's IDropTarget interface
  423. IOleObject * _poleHistory;
  424. IStream * _pstmHistory;
  425. IBindCtx * _pbcHistory;
  426. IHTMLDocument2 * _pHTMLDocument;
  427. IPersistHistory * _pphHistory;
  428. IOleInPlaceActiveObject *_pact; // for UIWindow
  429. IClassFactory* _pcfHTML; // cached/locked class factory
  430. DWORD _dwReadyStatePending;
  431. LPWSTR _pszTitlePending;
  432. DWORD _grfHLNFPending;
  433. HDPA _hdpaDLM; // downloading object (for DLM)
  434. BOOL _cp; // current codepage
  435. //
  436. // NOTES: Currently, we support only one pending navigation.
  437. // If we want to support queued navigation, we need to turn
  438. // following two variables into a queue. (SatoNa)
  439. //
  440. DWORD _uActionQueued; // queued action
  441. LPITEMIDLIST _pidlQueued; // pidl to go asynchronously
  442. DWORD _dwSBSPQueued; // grfHLNF to go asynchronously
  443. UINT _cRefCannotNavigate; // Increment when we can navigate
  444. RECT _rcBorderDoc; // for UIWindow
  445. DWORD _dwStartingAppTick;
  446. BITBOOL _fDontResizeView : 1; // Don't resize _hwndView
  447. BITBOOL _fNavigate:1; // are we navigating?
  448. BITBOOL _fDescendentNavigate:1; // are our descendents navigating?
  449. BITBOOL _fDownloadSet:1; // did we invoke download animation ?
  450. BITBOOL _fNoDragDrop:1; // TRUE iff we want to register for drops
  451. BITBOOL _fRegisteredDragDrop:1; // TRUE iff we have registered for drops
  452. BITBOOL _fNavigatedToBlank: 1; // Has called _ShowBlankPage once.
  453. BITBOOL _fAsyncNavigate:1; // Ignore sync-hack-bug-fix
  454. BITBOOL _fPausedByParent :1; // Interaction paused by parent
  455. BITBOOL _fDontAddTravelEntry:1;
  456. BITBOOL _fIsLocalAnchor:1;
  457. BITBOOL _fGeneratedPage:1; // trident told us that the page is generated.
  458. BITBOOL _fOwnsPalette:1; // does the browser own the palette ? (did we get QueryNewPalette ..)
  459. BITBOOL _fUsesPaletteCommands : 1; // if we are using a separate communication with trident for palette commands
  460. BITBOOL _fCreateViewWindowPending:1;
  461. BITBOOL _fReleasingShellView:1;
  462. BITBOOL _fDeferredUIDeactivate:1;
  463. BITBOOL _fDeferredSelfDestruction:1;
  464. BITBOOL _fActive:1; // remember if the frame is active or not (WM_ACTIVATE)
  465. BITBOOL _fUIActivateOnActive:1; // TRUE iff we have a bending uiactivate
  466. BITBOOL _fInQueryStatus:1;
  467. BITBOOL _fCheckedDesktopComponentName:1;
  468. BITBOOL _fInDestroy:1; // being destroyed
  469. BITBOOL _fDontUpdateTravelLog:1;
  470. BITBOOL _fHtmlNavCanceled:1;
  471. BITBOOL _fDontShowNavCancelPage:1;
  472. BITBOOL _fHadBeforeNavigate :1;
  473. BITBOOL _fHadNavigateComplete :1;
  474. enum DOCFLAGS
  475. {
  476. DOCFLAG_DOCCANNAVIGATE = 0x00000001, // The document knows how to navigate
  477. DOCFLAG_NAVIGATEFROMDOC = 0x00000002, // Document called Navigate
  478. DOCFLAG_SETNAVIGATABLECODEPAGE = 0x00000004, // GetBindInfo should call NavigatableCodepage
  479. };
  480. DWORD _dwDocFlags;
  481. // for IDropTarget
  482. DWORD _dwDropEffect;
  483. #ifdef DEBUG
  484. BOOL _fProcessed_WM_CLOSE; // TRUE iff WM_CLOSE processed
  485. BOOL _fMightBeShuttingDown; // TRUE if we might be shutting down (recieved a WM_QUERYENDSESSION || (WM_ENDSESSION w/ wParam == TRUE))
  486. #endif
  487. // friend CIEFrameAuto;
  488. interface IShellHTMLWindowSupport *_phtmlWS;
  489. IUrlHistoryStg *_pIUrlHistoryStg; // pointer to url history storage object
  490. ITravelLogStg *_pITravelLogStg; // exposed travel log object
  491. ITargetFrame2 *_ptfrm;
  492. // Cached History IShellFolder
  493. IUnknown *_punkSFHistory;
  494. // what SSL icon to show
  495. int _eSecureLockIconPending;
  496. // Support for OLECMDID_HTTPEQUIV (Client Pull, PICS, etc)
  497. #ifdef NEVER
  498. HRESULT _HandleHttpEquiv (VARIANT *pvarargIn, VARIANT *pvarargOut, BOOL fDone);
  499. HRESULT _KillRefreshTimer( void );
  500. VOID _OnRefreshTimer(void);
  501. void _StartRefreshTimer(void);
  502. // equiv handlers we know about
  503. friend HRESULT _HandleRefresh (HWND hwnd, WCHAR *pwz, WCHAR *pwzColon, CBaseBrowser2 *pbb, BOOL fDone, LPARAM lParam);
  504. #endif
  505. friend HRESULT _HandlePICS (HWND hwnd, WCHAR *pwz, WCHAR *pwzColon, CBaseBrowser2 *pbb, BOOL fDone, LPARAM lParam);
  506. #ifdef NEVER
  507. friend VOID CALLBACK _RefreshTimerProc (HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
  508. // Client Pull values
  509. WCHAR *_pwzRefreshURL;
  510. int _iRefreshTimeout;
  511. BOOL _iRefreshTimeoutSet:1;
  512. INT_PTR _iRefreshTimerID;
  513. #endif
  514. #ifdef MESSAGEFILTER
  515. // COM Message filter used to help dispatch TIMER messages during OLE operations.
  516. LPMESSAGEFILTER _lpMF;
  517. #endif
  518. CUrlTrackingStg * _ptracking;
  519. CAutoImageResize *_pAIResize;
  520. // _fTopBrowser vs. _fNoTopLevelBrowser:
  521. // _fTopBrowser: True means we are the top most browser, or a top most browser does not exist and we are acting like the top most browser.
  522. // In the latter case, the immediate childern of our host will also act like top most browsers.
  523. // _fNoTopLevelBrowser: This means that the top most item isn't one of our shell browsers, so it's immediate browser child
  524. // will act like a top most browser.
  525. //
  526. // In normal cases, a shell browser (CShellBrowser, CDesktopBrowser, ...) is a top most browser
  527. // with TRUE==_fTopBrowser and FALSE==_fNoTopLevelBrowser. It can have subframes that will have
  528. // FALSE==_fTopBrowser and FALSE==_fNoTopLevelBrowser.
  529. //
  530. // The only time _fNoTopLevelBrowser is TRUE is if some other object (like Athena) hosts MSHTML directly
  531. // which will prevent some shell browser from being top most. Since the HTML can have several frames,
  532. // each will have TRUE==_fTopBrowser, so _fNoTopLevelBrowser will be set to TRUE to distinguish this case.
  533. BOOL _fTopBrowser :1; // Should only be set via the _SetTopBrowser method
  534. BOOL _fNoTopLevelBrowser :1; // TRUE iff the toplevel is a non-shell browser (Athena). Shell browsers include CDesktopBrowser, CShellBrowser, ...
  535. BOOL _fHaveOldStatusText :1;
  536. WCHAR _szwOldStatusText[MAX_PATH];
  537. FOLDERSETDATABASE _fldBase; // cache viewset results in here (used when navigating)
  538. // Manages extended toolbar buttons and tools menu extensions for IE
  539. IToolbarExt* _pToolbarExt;
  540. LPITEMIDLIST _pidlBeforeNavigateEvent; // pidl refered to in BeforeNavigate2 event
  541. // ViewLinkedWebOC variables
  542. BOOL _fIsViewLinkedWebOC; // TRUE if an instance of the WebOC is a ViewLinked
  543. IWebBrowser2* _pDispViewLinkedWebOCFrame; // The pDisp of the Frame of a ViewLinkedWebOC.
  544. BOOL _fHadFirstBeforeNavigate; // TRUE if we have already skipped over the first ViewLinkedWebOC's
  545. // BeforeNavigateEvent.
  546. TCHAR _szViewLinkedWebOCFrameName[INTERNET_MAX_URL_LENGTH+1];
  547. public:
  548. // handling for plugUI shutdown
  549. // need the hwnd for the lang change modal property sheet
  550. static HDPA s_hdpaOptionsHwnd;
  551. static void _SyncDPA();
  552. static int CALLBACK _OptionsPropSheetCallback(HWND hwndDlg, UINT uMsg, LPARAM lParam);
  553. private:
  554. HRESULT _AddFolderOptionsSheets(DWORD dwReserved, LPFNADDPROPSHEETPAGE pfnAddPropSheetPage, LPPROPSHEETHEADER ppsh);
  555. HRESULT _AddInternetOptionsSheets(DWORD dwReserved, LPFNADDPROPSHEETPAGE pfnAddPropSheetPage, LPPROPSHEETHEADER ppsh);
  556. HRESULT _ReplaceWithGoHome(LPCITEMIDLIST * ppidl, LPITEMIDLIST * ppidlFree);
  557. // this is private! it should only be called by _NavigateToPidl
  558. HRESULT _CreateNewShellViewPidl(LPCITEMIDLIST pidl, DWORD grfHLNF, DWORD fSBSP);
  559. HRESULT _CreateNewShellView(IShellFolder* psf, LPCITEMIDLIST pidl, DWORD grfHLNF);
  560. HRESULT _DismissFindDialog();
  561. // Privacy state
  562. HRESULT _UpdatePrivacyIcon(BOOL fSetNewState, BOOL fNewState);
  563. };
  564. HRESULT _DisplayParseError(HWND hwnd, HRESULT hres, LPCWSTR pwszPath);
  565. #endif // _BASESB2_H