2 * Implementation of IShellBrowser interface
4 * Copyright 2011 Piotr Caban for CodeWeavers
5 * Copyright 2012 Jacek Caban for CodeWeavers
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(ieframe
);
31 static inline ShellBrowser
*impl_from_IShellBrowser(IShellBrowser
*iface
)
33 return CONTAINING_RECORD(iface
, ShellBrowser
, IShellBrowser_iface
);
36 static HRESULT WINAPI
ShellBrowser_QueryInterface(IShellBrowser
* iface
, REFIID riid
, void **ppv
)
38 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
40 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
41 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
42 *ppv
= &This
->IShellBrowser_iface
;
43 }else if(IsEqualGUID(&IID_IOleWindow
, riid
)) {
44 TRACE("(%p)->(IID_IOleWindow %p)\n", This
, ppv
);
45 *ppv
= &This
->IShellBrowser_iface
;
46 }else if(IsEqualGUID(&IID_IShellBrowser
, riid
)) {
47 TRACE("(%p)->(IID_IShellBrowser %p)\n", This
, ppv
);
48 *ppv
= &This
->IShellBrowser_iface
;
49 }else if(IsEqualGUID(&IID_IBrowserService
, riid
)) {
50 TRACE("(%p)->(IID_IBrowserService %p)\n", This
, ppv
);
51 *ppv
= &This
->IBrowserService_iface
;
52 }else if(IsEqualGUID(&IID_IDocObjectService
, riid
)) {
53 TRACE("(%p)->(IID_IDocObjectService %p)\n", This
, ppv
);
54 *ppv
= &This
->IDocObjectService_iface
;
56 FIXME("%p %s %p\n", This
, debugstr_guid(riid
), ppv
);
61 IUnknown_AddRef((IUnknown
*)*ppv
);
65 static ULONG WINAPI
ShellBrowser_AddRef(
68 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
69 LONG ref
= InterlockedIncrement(&This
->ref
);
71 TRACE("(%p) ref=%d\n", This
, ref
);
76 static ULONG WINAPI
ShellBrowser_Release(IShellBrowser
* iface
)
78 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
79 LONG ref
= InterlockedDecrement(&This
->ref
);
81 TRACE("(%p) ref=%d\n", This
, ref
);
84 assert(!This
->doc_host
);
91 static HRESULT WINAPI
ShellBrowser_GetWindow(
95 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
96 FIXME("%p %p\n", This
, phwnd
);
100 static HRESULT WINAPI
ShellBrowser_ContextSensitiveHelp(
101 IShellBrowser
* iface
,
104 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
105 FIXME("%p %d\n", This
, fEnterMode
);
109 static HRESULT WINAPI
ShellBrowser_InsertMenusSB(
110 IShellBrowser
* iface
,
112 LPOLEMENUGROUPWIDTHS lpMenuWidths
)
114 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
115 FIXME("%p %p %p\n", This
, hmenuShared
, lpMenuWidths
);
119 static HRESULT WINAPI
ShellBrowser_SetMenuSB(
120 IShellBrowser
* iface
,
122 HOLEMENU holemenuReserved
,
123 HWND hwndActiveObject
)
125 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
126 FIXME("%p %p %p %p\n", This
, hmenuShared
, holemenuReserved
, hwndActiveObject
);
130 static HRESULT WINAPI
ShellBrowser_RemoveMenusSB(
131 IShellBrowser
* iface
,
134 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
135 FIXME("%p %p\n", This
, hmenuShared
);
139 static HRESULT WINAPI
ShellBrowser_SetStatusTextSB(
140 IShellBrowser
* iface
,
141 LPCOLESTR pszStatusText
)
143 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
144 FIXME("%p %s\n", This
, debugstr_w(pszStatusText
));
148 static HRESULT WINAPI
ShellBrowser_EnableModelessSB(
149 IShellBrowser
* iface
,
152 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
153 FIXME("%p %d\n", This
, fEnable
);
157 static HRESULT WINAPI
ShellBrowser_TranslateAcceleratorSB(
158 IShellBrowser
* iface
,
162 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
163 FIXME("%p %p %d\n", This
, pmsg
, (int)wID
);
167 static HRESULT WINAPI
ShellBrowser_BrowseObject(
168 IShellBrowser
* iface
,
172 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
173 FIXME("%p %p %u\n", This
, pidl
, wFlags
);
177 static HRESULT WINAPI
ShellBrowser_GetViewStateStream(
178 IShellBrowser
* iface
,
182 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
183 FIXME("%p %x %p\n", This
, grfMode
, ppStrm
);
187 static HRESULT WINAPI
ShellBrowser_GetControlWindow(
188 IShellBrowser
* iface
,
192 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
193 FIXME("%p %u %p\n", This
, id
, phwnd
);
197 static HRESULT WINAPI
ShellBrowser_SendControlMsg(
198 IShellBrowser
* iface
,
205 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
206 FIXME("%p %u %u %p\n", This
, id
, uMsg
, pret
);
210 static HRESULT WINAPI
ShellBrowser_QueryActiveShellView(
211 IShellBrowser
* iface
,
214 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
215 FIXME("%p %p\n", This
, ppshv
);
219 static HRESULT WINAPI
ShellBrowser_OnViewWindowActive(
220 IShellBrowser
* iface
,
223 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
224 FIXME("%p %p\n", This
, pshv
);
228 static HRESULT WINAPI
ShellBrowser_SetToolbarItems(
229 IShellBrowser
* iface
,
230 LPTBBUTTONSB lpButtons
,
234 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
235 FIXME("%p %p %u %u\n", This
, lpButtons
, nButtons
, uFlags
);
239 static const IShellBrowserVtbl ShellBrowserVtbl
= {
240 ShellBrowser_QueryInterface
,
242 ShellBrowser_Release
,
243 ShellBrowser_GetWindow
,
244 ShellBrowser_ContextSensitiveHelp
,
245 ShellBrowser_InsertMenusSB
,
246 ShellBrowser_SetMenuSB
,
247 ShellBrowser_RemoveMenusSB
,
248 ShellBrowser_SetStatusTextSB
,
249 ShellBrowser_EnableModelessSB
,
250 ShellBrowser_TranslateAcceleratorSB
,
251 ShellBrowser_BrowseObject
,
252 ShellBrowser_GetViewStateStream
,
253 ShellBrowser_GetControlWindow
,
254 ShellBrowser_SendControlMsg
,
255 ShellBrowser_QueryActiveShellView
,
256 ShellBrowser_OnViewWindowActive
,
257 ShellBrowser_SetToolbarItems
260 static inline ShellBrowser
*impl_from_IBrowserService(IBrowserService
*iface
)
262 return CONTAINING_RECORD(iface
, ShellBrowser
, IBrowserService_iface
);
265 static HRESULT WINAPI
BrowserService_QueryInterface(
266 IBrowserService
* iface
,
270 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
271 return IShellBrowser_QueryInterface(&This
->IShellBrowser_iface
, riid
, ppvObject
);
274 static ULONG WINAPI
BrowserService_AddRef(
275 IBrowserService
*iface
)
277 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
278 return IShellBrowser_AddRef(&This
->IShellBrowser_iface
);
281 static ULONG WINAPI
BrowserService_Release(
282 IBrowserService
* iface
)
284 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
285 return IShellBrowser_Release(&This
->IShellBrowser_iface
);
288 static HRESULT WINAPI
BrowserService_GetParentSite(
289 IBrowserService
* iface
,
290 IOleInPlaceSite
**ppipsite
)
292 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
293 FIXME("%p %p\n", This
, ppipsite
);
297 static HRESULT WINAPI
BrowserService_SetTitle(
298 IBrowserService
* iface
,
302 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
303 FIXME("%p %p %s\n", This
, psv
, debugstr_w(pszName
));
307 static HRESULT WINAPI
BrowserService_GetTitle(
308 IBrowserService
* iface
,
313 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
314 FIXME("%p %p %p %d\n", This
, psv
, pszName
, cchName
);
318 static HRESULT WINAPI
BrowserService_GetOleObject(
319 IBrowserService
* iface
,
322 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
323 FIXME("%p %p\n", This
, ppobjv
);
327 static HRESULT WINAPI
BrowserService_GetTravelLog(
328 IBrowserService
* iface
,
331 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
332 FIXME("%p %p\n", This
, pptl
);
336 static HRESULT WINAPI
BrowserService_ShowControlWindow(
337 IBrowserService
* iface
,
341 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
342 FIXME("%p %u %d\n", This
, id
, fShow
);
346 static HRESULT WINAPI
BrowserService_IsControlWindowShown(
347 IBrowserService
* iface
,
351 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
352 FIXME("%p %u %p\n", This
, id
, pfShown
);
356 static HRESULT WINAPI
BrowserService_IEGetDisplayName(
357 IBrowserService
* iface
,
358 PCIDLIST_ABSOLUTE pidl
,
362 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
363 FIXME("%p %p %p %u\n", This
, pidl
, pwszName
, uFlags
);
367 static HRESULT WINAPI
BrowserService_IEParseDisplayName(
368 IBrowserService
* iface
,
371 PIDLIST_ABSOLUTE
*ppidlOut
)
373 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
374 FIXME("%p %u %s %p\n", This
, uiCP
, debugstr_w(pwszPath
), ppidlOut
);
378 static HRESULT WINAPI
BrowserService_DisplayParseError(
379 IBrowserService
* iface
,
383 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
384 FIXME("%p %x %s\n", This
, hres
, debugstr_w(pwszPath
));
388 static HRESULT WINAPI
BrowserService_NavigateToPidl(
389 IBrowserService
* iface
,
390 PCIDLIST_ABSOLUTE pidl
,
393 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
394 FIXME("%p %p %d\n", This
, pidl
, grfHLNF
);
398 static HRESULT WINAPI
BrowserService_SetNavigateState(
399 IBrowserService
* iface
,
402 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
403 FIXME("%p %d\n", This
, bnstate
);
407 static HRESULT WINAPI
BrowserService_GetNavigateState(
408 IBrowserService
* iface
,
411 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
412 FIXME("%p %p\n", This
, pbnstate
);
416 static HRESULT WINAPI
BrowserService_NotifyRedirect(
417 IBrowserService
* iface
,
419 PCIDLIST_ABSOLUTE pidl
,
422 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
423 FIXME("%p %p %p %p\n", This
, psv
, pidl
, pfDidBrowse
);
427 static HRESULT WINAPI
BrowserService_UpdateWindowList(
428 IBrowserService
* iface
)
430 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
435 static HRESULT WINAPI
BrowserService_UpdateBackForwardState(
436 IBrowserService
* iface
)
438 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
443 static HRESULT WINAPI
BrowserService_SetFlags(
444 IBrowserService
* iface
,
448 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
449 FIXME("%p %x %x\n", This
, dwFlags
, dwFlagMask
);
453 static HRESULT WINAPI
BrowserService_GetFlags(
454 IBrowserService
* iface
,
457 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
458 FIXME("%p %p\n", This
, pdwFlags
);
462 static HRESULT WINAPI
BrowserService_CanNavigateNow(
463 IBrowserService
* iface
)
465 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
470 static HRESULT WINAPI
BrowserService_GetPidl(
471 IBrowserService
* iface
,
472 PIDLIST_ABSOLUTE
*ppidl
)
474 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
475 FIXME("%p %p\n", This
, ppidl
);
479 static HRESULT WINAPI
BrowserService_SetReferrer(
480 IBrowserService
* iface
,
481 PCIDLIST_ABSOLUTE pidl
)
483 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
484 FIXME("%p %p\n", This
, pidl
);
488 static DWORD WINAPI
BrowserService_GetBrowserIndex(
489 IBrowserService
* iface
)
491 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
496 static HRESULT WINAPI
BrowserService_GetBrowserByIndex(
497 IBrowserService
* iface
,
501 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
502 FIXME("%p %x %p\n", This
, dwID
, ppunk
);
506 static HRESULT WINAPI
BrowserService_GetHistoryObject(
507 IBrowserService
* iface
,
512 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
513 FIXME("%p %p %p %p\n", This
, ppole
, pstm
, ppbc
);
517 static HRESULT WINAPI
BrowserService_SetHistoryObject(
518 IBrowserService
* iface
,
522 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
523 FIXME("%p %p %d\n", This
, pole
, fIsLocalAnchor
);
527 static HRESULT WINAPI
BrowserService_CacheOLEServer(
528 IBrowserService
* iface
,
531 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
532 FIXME("%p %p\n", This
, pole
);
536 static HRESULT WINAPI
BrowserService_GetSetCodePage(
537 IBrowserService
* iface
,
541 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
542 FIXME("%p %s %p\n", This
, debugstr_variant(pvarIn
), pvarOut
);
546 static HRESULT WINAPI
BrowserService_OnHttpEquiv(
547 IBrowserService
* iface
,
553 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
554 FIXME("%p %p %d %s %p\n", This
, psv
, fDone
, debugstr_variant(pvarargIn
), pvarargOut
);
558 static HRESULT WINAPI
BrowserService_GetPalette(
559 IBrowserService
* iface
,
562 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
563 FIXME("%p %p\n", This
, hpal
);
567 static HRESULT WINAPI
BrowserService_RegisterWindow(
568 IBrowserService
* iface
,
572 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
573 FIXME("%p %d %d\n", This
, fForceRegister
, swc
);
577 static const IBrowserServiceVtbl BrowserServiceVtbl
= {
578 BrowserService_QueryInterface
,
579 BrowserService_AddRef
,
580 BrowserService_Release
,
581 BrowserService_GetParentSite
,
582 BrowserService_SetTitle
,
583 BrowserService_GetTitle
,
584 BrowserService_GetOleObject
,
585 BrowserService_GetTravelLog
,
586 BrowserService_ShowControlWindow
,
587 BrowserService_IsControlWindowShown
,
588 BrowserService_IEGetDisplayName
,
589 BrowserService_IEParseDisplayName
,
590 BrowserService_DisplayParseError
,
591 BrowserService_NavigateToPidl
,
592 BrowserService_SetNavigateState
,
593 BrowserService_GetNavigateState
,
594 BrowserService_NotifyRedirect
,
595 BrowserService_UpdateWindowList
,
596 BrowserService_UpdateBackForwardState
,
597 BrowserService_SetFlags
,
598 BrowserService_GetFlags
,
599 BrowserService_CanNavigateNow
,
600 BrowserService_GetPidl
,
601 BrowserService_SetReferrer
,
602 BrowserService_GetBrowserIndex
,
603 BrowserService_GetBrowserByIndex
,
604 BrowserService_GetHistoryObject
,
605 BrowserService_SetHistoryObject
,
606 BrowserService_CacheOLEServer
,
607 BrowserService_GetSetCodePage
,
608 BrowserService_OnHttpEquiv
,
609 BrowserService_GetPalette
,
610 BrowserService_RegisterWindow
613 static inline ShellBrowser
*impl_from_IDocObjectService(IDocObjectService
*iface
)
615 return CONTAINING_RECORD(iface
, ShellBrowser
, IDocObjectService_iface
);
618 static HRESULT WINAPI
DocObjectService_QueryInterface(
619 IDocObjectService
* iface
,
623 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
624 return IShellBrowser_QueryInterface(&This
->IShellBrowser_iface
, riid
, ppvObject
);
627 static ULONG WINAPI
DocObjectService_AddRef(
628 IDocObjectService
* iface
)
630 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
631 return IShellBrowser_AddRef(&This
->IShellBrowser_iface
);
634 static ULONG WINAPI
DocObjectService_Release(
635 IDocObjectService
* iface
)
637 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
638 return IShellBrowser_Release(&This
->IShellBrowser_iface
);
641 static HRESULT WINAPI
DocObjectService_FireBeforeNavigate2(
642 IDocObjectService
* iface
,
643 IDispatch
*pDispatch
,
646 LPCWSTR lpszFrameName
,
653 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
654 VARIANT var_url
, var_flags
, var_frame_name
, var_post_data
, var_post_data2
, var_headers
;
655 VARIANTARG params
[7];
656 DISPPARAMS dp
= {params
, NULL
, 7, 0};
657 VARIANT_BOOL cancel
= VARIANT_FALSE
;
658 SAFEARRAY
*post_data
;
660 TRACE("%p %p %s %x %s %p %d %s %d %p\n", This
, pDispatch
, debugstr_w(lpszUrl
),
661 dwFlags
, debugstr_w(lpszFrameName
), pPostData
, cbPostData
,
662 debugstr_w(lpszHeaders
), fPlayNavSound
, pfCancel
);
665 post_data
= SafeArrayCreateVector(VT_UI1
, 0, cbPostData
);
667 return E_OUTOFMEMORY
;
668 memcpy(post_data
->pvData
, pPostData
, cbPostData
);
673 V_VT(params
) = VT_BOOL
|VT_BYREF
;
674 V_BOOLREF(params
) = &cancel
;
676 V_VT(params
+1) = (VT_BYREF
|VT_VARIANT
);
677 V_VARIANTREF(params
+1) = &var_headers
;
678 V_VT(&var_headers
) = VT_BSTR
;
679 V_BSTR(&var_headers
) = lpszHeaders
? SysAllocString(lpszHeaders
) : NULL
;
681 V_VT(params
+2) = (VT_BYREF
|VT_VARIANT
);
682 V_VARIANTREF(params
+2) = &var_post_data2
;
683 V_VT(&var_post_data2
) = (VT_BYREF
|VT_VARIANT
);
684 V_VARIANTREF(&var_post_data2
) = &var_post_data
;
687 V_VT(&var_post_data
) = VT_UI1
|VT_ARRAY
;
688 V_ARRAY(&var_post_data
) = post_data
;
690 V_VT(&var_post_data
) = VT_EMPTY
;
693 V_VT(params
+3) = (VT_BYREF
|VT_VARIANT
);
694 V_VARIANTREF(params
+3) = &var_frame_name
;
695 V_VT(&var_frame_name
) = VT_BSTR
;
696 V_BSTR(&var_frame_name
) = lpszFrameName
? SysAllocString(lpszFrameName
) : NULL
;
698 V_VT(params
+4) = (VT_BYREF
|VT_VARIANT
);
699 V_VARIANTREF(params
+4) = &var_flags
;
700 V_VT(&var_flags
) = VT_I4
;
701 V_I4(&var_flags
) = 0;
703 V_VT(params
+5) = (VT_BYREF
|VT_VARIANT
);
704 V_VARIANTREF(params
+5) = &var_url
;
705 V_VT(&var_url
) = VT_BSTR
;
706 V_BSTR(&var_url
) = SysAllocString(lpszUrl
);
708 V_VT(params
+6) = (VT_DISPATCH
);
709 V_DISPATCH(params
+6) = (IDispatch
*)This
->doc_host
->wb
;
711 /* Keep reference to This. It may be released in event handler. */
712 IShellBrowser_AddRef(&This
->IShellBrowser_iface
);
715 call_sink(This
->doc_host
->cps
.wbe2
, DISPID_BEFORENAVIGATE2
, &dp
);
718 IShellBrowser_Release(&This
->IShellBrowser_iface
);
720 SysFreeString(V_BSTR(&var_url
));
721 SysFreeString(V_BSTR(&var_headers
));
722 SysFreeString(V_BSTR(&var_frame_name
));
723 SafeArrayDestroy(post_data
);
725 *pfCancel
= !!cancel
;
729 static HRESULT WINAPI
DocObjectService_FireNavigateComplete2(
730 IDocObjectService
* iface
,
731 IHTMLWindow2
*pHTMLWindow2
,
734 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
735 DocHost
*doc_host
= This
->doc_host
;
736 IHTMLPrivateWindow
*priv_window
;
737 VARIANTARG params
[2];
738 DISPPARAMS dp
= {params
, NULL
, 2, 0};
743 TRACE("%p %p %x\n", This
, pHTMLWindow2
, dwFlags
);
745 if(doc_host
->travellog
.loading_pos
!= -1) {
746 WARN("histupdate not notified\n");
747 doc_host
->travellog
.position
= doc_host
->travellog
.loading_pos
;
748 doc_host
->travellog
.loading_pos
= -1;
751 hres
= IHTMLWindow2_QueryInterface(pHTMLWindow2
, &IID_IHTMLPrivateWindow
, (void**)&priv_window
);
755 hres
= IHTMLPrivateWindow_GetAddressBarUrl(priv_window
, &url
);
756 IHTMLPrivateWindow_Release(priv_window
);
760 TRACE("got URL %s\n", debugstr_w(url
));
761 set_dochost_url(This
->doc_host
, url
);
763 V_VT(params
) = (VT_BYREF
|VT_VARIANT
);
764 V_VARIANTREF(params
) = &url_var
;
766 V_VT(params
+1) = VT_DISPATCH
;
767 V_DISPATCH(params
+1) = (IDispatch
*)doc_host
->wb
;
769 V_VT(&url_var
) = VT_BSTR
;
770 V_BSTR(&url_var
) = url
;
772 /* Keep reference to This. It may be released in event handler. */
773 IShellBrowser_AddRef(&This
->IShellBrowser_iface
);
776 call_sink(This
->doc_host
->cps
.wbe2
, DISPID_NAVIGATECOMPLETE2
, &dp
);
781 This
->doc_host
->busy
= VARIANT_FALSE
;
782 IShellBrowser_Release(&This
->IShellBrowser_iface
);
786 static HRESULT WINAPI
DocObjectService_FireDownloadBegin(
787 IDocObjectService
* iface
)
789 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
794 static HRESULT WINAPI
DocObjectService_FireDownloadComplete(
795 IDocObjectService
* iface
)
797 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
802 static HRESULT WINAPI
DocObjectService_FireDocumentComplete(
803 IDocObjectService
* iface
,
804 IHTMLWindow2
*pHTMLWindow
,
807 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
808 IHTMLPrivateWindow
*priv_window
;
809 VARIANTARG params
[2];
810 DISPPARAMS dp
= {params
, NULL
, 2, 0};
815 TRACE("%p %p %x\n", This
, pHTMLWindow
, dwFlags
);
817 hres
= IHTMLWindow2_QueryInterface(pHTMLWindow
, &IID_IHTMLPrivateWindow
, (void**)&priv_window
);
821 hres
= IHTMLPrivateWindow_GetAddressBarUrl(priv_window
, &url
);
822 IHTMLPrivateWindow_Release(priv_window
);
826 TRACE("got URL %s\n", debugstr_w(url
));
828 V_VT(params
) = (VT_BYREF
|VT_VARIANT
);
829 V_VARIANTREF(params
) = &url_var
;
831 V_VT(params
+1) = VT_DISPATCH
;
832 V_DISPATCH(params
+1) = (IDispatch
*)This
->doc_host
->wb
;
834 V_VT(&url_var
) = VT_BSTR
;
835 V_BSTR(&url_var
) = url
;
837 /* Keep reference to This. It may be released in event handler. */
838 IShellBrowser_AddRef(&This
->IShellBrowser_iface
);
841 call_sink(This
->doc_host
->cps
.wbe2
, DISPID_DOCUMENTCOMPLETE
, &dp
);
846 This
->doc_host
->busy
= VARIANT_FALSE
;
848 IShellBrowser_Release(&This
->IShellBrowser_iface
);
852 static HRESULT WINAPI
DocObjectService_UpdateDesktopComponent(
853 IDocObjectService
* iface
,
854 IHTMLWindow2
*pHTMLWindow
)
856 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
857 FIXME("%p %p\n", This
, pHTMLWindow
);
861 static HRESULT WINAPI
DocObjectService_GetPendingUrl(
862 IDocObjectService
* iface
,
863 BSTR
*pbstrPendingUrl
)
865 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
866 FIXME("%p %p\n", This
, pbstrPendingUrl
);
870 static HRESULT WINAPI
DocObjectService_ActiveElementChanged(
871 IDocObjectService
* iface
,
872 IHTMLElement
*pHTMLElement
)
874 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
875 FIXME("%p %p\n", This
, pHTMLElement
);
879 static HRESULT WINAPI
DocObjectService_GetUrlSearchComponent(
880 IDocObjectService
* iface
,
883 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
884 FIXME("%p %p\n", This
, pbstrSearch
);
888 static HRESULT WINAPI
DocObjectService_IsErrorUrl(
889 IDocObjectService
* iface
,
893 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
894 FIXME("%p %s %p\n", This
, debugstr_w(lpszUrl
), pfIsError
);
900 static const IDocObjectServiceVtbl DocObjectServiceVtbl
= {
901 DocObjectService_QueryInterface
,
902 DocObjectService_AddRef
,
903 DocObjectService_Release
,
904 DocObjectService_FireBeforeNavigate2
,
905 DocObjectService_FireNavigateComplete2
,
906 DocObjectService_FireDownloadBegin
,
907 DocObjectService_FireDownloadComplete
,
908 DocObjectService_FireDocumentComplete
,
909 DocObjectService_UpdateDesktopComponent
,
910 DocObjectService_GetPendingUrl
,
911 DocObjectService_ActiveElementChanged
,
912 DocObjectService_GetUrlSearchComponent
,
913 DocObjectService_IsErrorUrl
916 HRESULT
create_browser_service(DocHost
*doc_host
, ShellBrowser
**ret
)
920 sb
= heap_alloc(sizeof(ShellBrowser
));
922 return E_OUTOFMEMORY
;
924 sb
->IShellBrowser_iface
.lpVtbl
= &ShellBrowserVtbl
;
925 sb
->IBrowserService_iface
.lpVtbl
= &BrowserServiceVtbl
;
926 sb
->IDocObjectService_iface
.lpVtbl
= &DocObjectServiceVtbl
;
929 sb
->doc_host
= doc_host
;
935 void detach_browser_service(ShellBrowser
*sb
)
938 IShellBrowser_Release(&sb
->IShellBrowser_iface
);
941 static inline NewWindowManager
*impl_from_INewWindowManager(INewWindowManager
*iface
)
943 return CONTAINING_RECORD(iface
, NewWindowManager
, INewWindowManager_iface
);
946 static HRESULT WINAPI
NewWindowManager_QueryInterface(INewWindowManager
*iface
, REFIID riid
, void **ppv
)
948 NewWindowManager
*This
= impl_from_INewWindowManager(iface
);
950 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
951 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
952 *ppv
= &This
->INewWindowManager_iface
;
953 }else if(IsEqualGUID(&IID_INewWindowManager
, riid
)) {
954 TRACE("(%p)->(IID_INewWindowManager %p)\n", This
, ppv
);
955 *ppv
= &This
->INewWindowManager_iface
;
957 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
959 return E_NOINTERFACE
;
962 IUnknown_AddRef((IUnknown
*)*ppv
);
966 static ULONG WINAPI
NewWindowManager_AddRef(INewWindowManager
*iface
)
968 NewWindowManager
*This
= impl_from_INewWindowManager(iface
);
970 TRACE("(%p)\n", This
);
972 return IOleClientSite_AddRef(&This
->doc_host
->IOleClientSite_iface
);
975 static ULONG WINAPI
NewWindowManager_Release(INewWindowManager
*iface
)
977 NewWindowManager
*This
= impl_from_INewWindowManager(iface
);
979 TRACE("(%p)\n", This
);
981 return IOleClientSite_Release(&This
->doc_host
->IOleClientSite_iface
);
984 static HRESULT WINAPI
NewWindowManager_EvaluateNewWindow(INewWindowManager
*iface
, LPCWSTR pszUrl
,
985 LPCWSTR pszName
, LPCWSTR pszUrlContext
, LPCWSTR pszFeatures
, BOOL fReplace
, DWORD dwFlags
,
986 DWORD dwUserActionTime
)
988 NewWindowManager
*This
= impl_from_INewWindowManager(iface
);
989 FIXME("(%p)->(%s %s %s %s %x %x %d)\n", This
, debugstr_w(pszUrl
), debugstr_w(pszName
), debugstr_w(pszUrlContext
),
990 debugstr_w(pszFeatures
), fReplace
, dwFlags
, dwUserActionTime
);
994 static const INewWindowManagerVtbl NewWindowManagerVtbl
= {
995 NewWindowManager_QueryInterface
,
996 NewWindowManager_AddRef
,
997 NewWindowManager_Release
,
998 NewWindowManager_EvaluateNewWindow
1001 void NewWindowManager_Init(DocHost
*doc_host
)
1003 doc_host
->nwm
.INewWindowManager_iface
.lpVtbl
= &NewWindowManagerVtbl
;
1004 doc_host
->nwm
.doc_host
= doc_host
;