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
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(ieframe
);
32 const WCHAR
*error_url_frag(const WCHAR
*url
)
34 if(!wcsncmp(url
, L
"res://", ARRAY_SIZE(L
"res://")-1)) {
36 UINT len
= GetSystemDirectoryW(buf
, ARRAY_SIZE(buf
));
38 if(len
&& !wcsncmp(url
+ ARRAY_SIZE(L
"res://")-1, buf
, len
)) {
39 len
+= ARRAY_SIZE(L
"res://")-1;
40 if(!wcsncmp(url
+ len
, L
"\\shdoclc.dll/ERROR.HTM", ARRAY_SIZE(L
"\\shdoclc.dll/ERROR.HTM")-1)) {
41 len
+= ARRAY_SIZE(L
"\\shdoclc.dll/ERROR.HTM")-1;
42 url
= wcschr(url
+ len
, '#');
43 return url
? url
+ 1 : NULL
;
50 static inline ShellBrowser
*impl_from_IShellBrowser(IShellBrowser
*iface
)
52 return CONTAINING_RECORD(iface
, ShellBrowser
, IShellBrowser_iface
);
55 static HRESULT WINAPI
ShellBrowser_QueryInterface(IShellBrowser
* iface
, REFIID riid
, void **ppv
)
57 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
59 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
60 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
61 *ppv
= &This
->IShellBrowser_iface
;
62 }else if(IsEqualGUID(&IID_IOleWindow
, riid
)) {
63 TRACE("(%p)->(IID_IOleWindow %p)\n", This
, ppv
);
64 *ppv
= &This
->IShellBrowser_iface
;
65 }else if(IsEqualGUID(&IID_IShellBrowser
, riid
)) {
66 TRACE("(%p)->(IID_IShellBrowser %p)\n", This
, ppv
);
67 *ppv
= &This
->IShellBrowser_iface
;
68 }else if(IsEqualGUID(&IID_IBrowserService
, riid
)) {
69 TRACE("(%p)->(IID_IBrowserService %p)\n", This
, ppv
);
70 *ppv
= &This
->IBrowserService_iface
;
71 }else if(IsEqualGUID(&IID_IDocObjectService
, riid
)) {
72 TRACE("(%p)->(IID_IDocObjectService %p)\n", This
, ppv
);
73 *ppv
= &This
->IDocObjectService_iface
;
75 FIXME("%p %s %p\n", This
, debugstr_guid(riid
), ppv
);
80 IUnknown_AddRef((IUnknown
*)*ppv
);
84 static ULONG WINAPI
ShellBrowser_AddRef(
87 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
88 LONG ref
= InterlockedIncrement(&This
->ref
);
90 TRACE("(%p) ref=%ld\n", This
, ref
);
95 static ULONG WINAPI
ShellBrowser_Release(IShellBrowser
* iface
)
97 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
98 LONG ref
= InterlockedDecrement(&This
->ref
);
100 TRACE("(%p) ref=%ld\n", This
, ref
);
103 assert(!This
->doc_host
);
110 static HRESULT WINAPI
ShellBrowser_GetWindow(
111 IShellBrowser
* iface
,
114 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
115 FIXME("%p %p\n", This
, phwnd
);
119 static HRESULT WINAPI
ShellBrowser_ContextSensitiveHelp(
120 IShellBrowser
* iface
,
123 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
124 FIXME("%p %d\n", This
, fEnterMode
);
128 static HRESULT WINAPI
ShellBrowser_InsertMenusSB(
129 IShellBrowser
* iface
,
131 LPOLEMENUGROUPWIDTHS lpMenuWidths
)
133 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
134 FIXME("%p %p %p\n", This
, hmenuShared
, lpMenuWidths
);
138 static HRESULT WINAPI
ShellBrowser_SetMenuSB(
139 IShellBrowser
* iface
,
141 HOLEMENU holemenuReserved
,
142 HWND hwndActiveObject
)
144 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
145 FIXME("%p %p %p %p\n", This
, hmenuShared
, holemenuReserved
, hwndActiveObject
);
149 static HRESULT WINAPI
ShellBrowser_RemoveMenusSB(
150 IShellBrowser
* iface
,
153 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
154 FIXME("%p %p\n", This
, hmenuShared
);
158 static HRESULT WINAPI
ShellBrowser_SetStatusTextSB(
159 IShellBrowser
* iface
,
160 LPCOLESTR pszStatusText
)
162 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
163 FIXME("%p %s\n", This
, debugstr_w(pszStatusText
));
167 static HRESULT WINAPI
ShellBrowser_EnableModelessSB(
168 IShellBrowser
* iface
,
171 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
172 FIXME("%p %d\n", This
, fEnable
);
176 static HRESULT WINAPI
ShellBrowser_TranslateAcceleratorSB(
177 IShellBrowser
* iface
,
181 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
182 FIXME("%p %p %d\n", This
, pmsg
, (int)wID
);
186 static HRESULT WINAPI
ShellBrowser_BrowseObject(
187 IShellBrowser
* iface
,
191 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
192 FIXME("%p %p %u\n", This
, pidl
, wFlags
);
196 static HRESULT WINAPI
ShellBrowser_GetViewStateStream(
197 IShellBrowser
* iface
,
201 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
202 FIXME("%p %lx %p\n", This
, grfMode
, ppStrm
);
206 static HRESULT WINAPI
ShellBrowser_GetControlWindow(
207 IShellBrowser
* iface
,
211 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
212 FIXME("%p %u %p\n", This
, id
, phwnd
);
216 static HRESULT WINAPI
ShellBrowser_SendControlMsg(
217 IShellBrowser
* iface
,
224 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
225 FIXME("%p %u %u %p\n", This
, id
, uMsg
, pret
);
229 static HRESULT WINAPI
ShellBrowser_QueryActiveShellView(
230 IShellBrowser
* iface
,
233 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
234 FIXME("%p %p\n", This
, ppshv
);
238 static HRESULT WINAPI
ShellBrowser_OnViewWindowActive(
239 IShellBrowser
* iface
,
242 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
243 FIXME("%p %p\n", This
, pshv
);
247 static HRESULT WINAPI
ShellBrowser_SetToolbarItems(
248 IShellBrowser
* iface
,
249 LPTBBUTTONSB lpButtons
,
253 ShellBrowser
*This
= impl_from_IShellBrowser(iface
);
254 FIXME("%p %p %u %u\n", This
, lpButtons
, nButtons
, uFlags
);
258 static const IShellBrowserVtbl ShellBrowserVtbl
= {
259 ShellBrowser_QueryInterface
,
261 ShellBrowser_Release
,
262 ShellBrowser_GetWindow
,
263 ShellBrowser_ContextSensitiveHelp
,
264 ShellBrowser_InsertMenusSB
,
265 ShellBrowser_SetMenuSB
,
266 ShellBrowser_RemoveMenusSB
,
267 ShellBrowser_SetStatusTextSB
,
268 ShellBrowser_EnableModelessSB
,
269 ShellBrowser_TranslateAcceleratorSB
,
270 ShellBrowser_BrowseObject
,
271 ShellBrowser_GetViewStateStream
,
272 ShellBrowser_GetControlWindow
,
273 ShellBrowser_SendControlMsg
,
274 ShellBrowser_QueryActiveShellView
,
275 ShellBrowser_OnViewWindowActive
,
276 ShellBrowser_SetToolbarItems
279 static inline ShellBrowser
*impl_from_IBrowserService(IBrowserService
*iface
)
281 return CONTAINING_RECORD(iface
, ShellBrowser
, IBrowserService_iface
);
284 static HRESULT WINAPI
BrowserService_QueryInterface(
285 IBrowserService
* iface
,
289 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
290 return IShellBrowser_QueryInterface(&This
->IShellBrowser_iface
, riid
, ppvObject
);
293 static ULONG WINAPI
BrowserService_AddRef(
294 IBrowserService
*iface
)
296 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
297 return IShellBrowser_AddRef(&This
->IShellBrowser_iface
);
300 static ULONG WINAPI
BrowserService_Release(
301 IBrowserService
* iface
)
303 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
304 return IShellBrowser_Release(&This
->IShellBrowser_iface
);
307 static HRESULT WINAPI
BrowserService_GetParentSite(
308 IBrowserService
* iface
,
309 IOleInPlaceSite
**ppipsite
)
311 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
312 FIXME("%p %p\n", This
, ppipsite
);
316 static HRESULT WINAPI
BrowserService_SetTitle(
317 IBrowserService
* iface
,
321 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
322 FIXME("%p %p %s\n", This
, psv
, debugstr_w(pszName
));
326 static HRESULT WINAPI
BrowserService_GetTitle(
327 IBrowserService
* iface
,
332 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
333 FIXME("%p %p %p %ld\n", This
, psv
, pszName
, cchName
);
337 static HRESULT WINAPI
BrowserService_GetOleObject(
338 IBrowserService
* iface
,
341 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
342 FIXME("%p %p\n", This
, ppobjv
);
346 static HRESULT WINAPI
BrowserService_GetTravelLog(
347 IBrowserService
* iface
,
350 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
351 FIXME("%p %p\n", This
, pptl
);
355 static HRESULT WINAPI
BrowserService_ShowControlWindow(
356 IBrowserService
* iface
,
360 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
361 FIXME("%p %u %d\n", This
, id
, fShow
);
365 static HRESULT WINAPI
BrowserService_IsControlWindowShown(
366 IBrowserService
* iface
,
370 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
371 FIXME("%p %u %p\n", This
, id
, pfShown
);
375 static HRESULT WINAPI
BrowserService_IEGetDisplayName(
376 IBrowserService
* iface
,
377 PCIDLIST_ABSOLUTE pidl
,
381 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
382 FIXME("%p %p %p %u\n", This
, pidl
, pwszName
, uFlags
);
386 static HRESULT WINAPI
BrowserService_IEParseDisplayName(
387 IBrowserService
* iface
,
390 PIDLIST_ABSOLUTE
*ppidlOut
)
392 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
393 FIXME("%p %u %s %p\n", This
, uiCP
, debugstr_w(pwszPath
), ppidlOut
);
397 static HRESULT WINAPI
BrowserService_DisplayParseError(
398 IBrowserService
* iface
,
402 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
403 FIXME("%p %lx %s\n", This
, hres
, debugstr_w(pwszPath
));
407 static HRESULT WINAPI
BrowserService_NavigateToPidl(
408 IBrowserService
* iface
,
409 PCIDLIST_ABSOLUTE pidl
,
412 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
413 FIXME("%p %p %ld\n", This
, pidl
, grfHLNF
);
417 static HRESULT WINAPI
BrowserService_SetNavigateState(
418 IBrowserService
* iface
,
421 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
422 FIXME("%p %d\n", This
, bnstate
);
426 static HRESULT WINAPI
BrowserService_GetNavigateState(
427 IBrowserService
* iface
,
430 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
431 FIXME("%p %p\n", This
, pbnstate
);
435 static HRESULT WINAPI
BrowserService_NotifyRedirect(
436 IBrowserService
* iface
,
438 PCIDLIST_ABSOLUTE pidl
,
441 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
442 FIXME("%p %p %p %p\n", This
, psv
, pidl
, pfDidBrowse
);
446 static HRESULT WINAPI
BrowserService_UpdateWindowList(
447 IBrowserService
* iface
)
449 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
454 static HRESULT WINAPI
BrowserService_UpdateBackForwardState(
455 IBrowserService
* iface
)
457 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
462 static HRESULT WINAPI
BrowserService_SetFlags(
463 IBrowserService
* iface
,
467 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
468 FIXME("%p %lx %lx\n", This
, dwFlags
, dwFlagMask
);
472 static HRESULT WINAPI
BrowserService_GetFlags(
473 IBrowserService
* iface
,
476 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
477 FIXME("%p %p\n", This
, pdwFlags
);
481 static HRESULT WINAPI
BrowserService_CanNavigateNow(
482 IBrowserService
* iface
)
484 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
489 static HRESULT WINAPI
BrowserService_GetPidl(
490 IBrowserService
* iface
,
491 PIDLIST_ABSOLUTE
*ppidl
)
493 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
494 FIXME("%p %p\n", This
, ppidl
);
498 static HRESULT WINAPI
BrowserService_SetReferrer(
499 IBrowserService
* iface
,
500 PCIDLIST_ABSOLUTE pidl
)
502 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
503 FIXME("%p %p\n", This
, pidl
);
507 static DWORD WINAPI
BrowserService_GetBrowserIndex(
508 IBrowserService
* iface
)
510 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
515 static HRESULT WINAPI
BrowserService_GetBrowserByIndex(
516 IBrowserService
* iface
,
520 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
521 FIXME("%p %lx %p\n", This
, dwID
, ppunk
);
525 static HRESULT WINAPI
BrowserService_GetHistoryObject(
526 IBrowserService
* iface
,
531 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
532 FIXME("%p %p %p %p\n", This
, ppole
, pstm
, ppbc
);
536 static HRESULT WINAPI
BrowserService_SetHistoryObject(
537 IBrowserService
* iface
,
541 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
542 FIXME("%p %p %d\n", This
, pole
, fIsLocalAnchor
);
546 static HRESULT WINAPI
BrowserService_CacheOLEServer(
547 IBrowserService
* iface
,
550 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
551 FIXME("%p %p\n", This
, pole
);
555 static HRESULT WINAPI
BrowserService_GetSetCodePage(
556 IBrowserService
* iface
,
560 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
561 FIXME("%p %s %p\n", This
, debugstr_variant(pvarIn
), pvarOut
);
565 static HRESULT WINAPI
BrowserService_OnHttpEquiv(
566 IBrowserService
* iface
,
572 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
573 FIXME("%p %p %d %s %p\n", This
, psv
, fDone
, debugstr_variant(pvarargIn
), pvarargOut
);
577 static HRESULT WINAPI
BrowserService_GetPalette(
578 IBrowserService
* iface
,
581 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
582 FIXME("%p %p\n", This
, hpal
);
586 static HRESULT WINAPI
BrowserService_RegisterWindow(
587 IBrowserService
* iface
,
591 ShellBrowser
*This
= impl_from_IBrowserService(iface
);
592 FIXME("%p %d %d\n", This
, fForceRegister
, swc
);
596 static const IBrowserServiceVtbl BrowserServiceVtbl
= {
597 BrowserService_QueryInterface
,
598 BrowserService_AddRef
,
599 BrowserService_Release
,
600 BrowserService_GetParentSite
,
601 BrowserService_SetTitle
,
602 BrowserService_GetTitle
,
603 BrowserService_GetOleObject
,
604 BrowserService_GetTravelLog
,
605 BrowserService_ShowControlWindow
,
606 BrowserService_IsControlWindowShown
,
607 BrowserService_IEGetDisplayName
,
608 BrowserService_IEParseDisplayName
,
609 BrowserService_DisplayParseError
,
610 BrowserService_NavigateToPidl
,
611 BrowserService_SetNavigateState
,
612 BrowserService_GetNavigateState
,
613 BrowserService_NotifyRedirect
,
614 BrowserService_UpdateWindowList
,
615 BrowserService_UpdateBackForwardState
,
616 BrowserService_SetFlags
,
617 BrowserService_GetFlags
,
618 BrowserService_CanNavigateNow
,
619 BrowserService_GetPidl
,
620 BrowserService_SetReferrer
,
621 BrowserService_GetBrowserIndex
,
622 BrowserService_GetBrowserByIndex
,
623 BrowserService_GetHistoryObject
,
624 BrowserService_SetHistoryObject
,
625 BrowserService_CacheOLEServer
,
626 BrowserService_GetSetCodePage
,
627 BrowserService_OnHttpEquiv
,
628 BrowserService_GetPalette
,
629 BrowserService_RegisterWindow
632 static inline ShellBrowser
*impl_from_IDocObjectService(IDocObjectService
*iface
)
634 return CONTAINING_RECORD(iface
, ShellBrowser
, IDocObjectService_iface
);
637 static HRESULT WINAPI
DocObjectService_QueryInterface(
638 IDocObjectService
* iface
,
642 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
643 return IShellBrowser_QueryInterface(&This
->IShellBrowser_iface
, riid
, ppvObject
);
646 static ULONG WINAPI
DocObjectService_AddRef(
647 IDocObjectService
* iface
)
649 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
650 return IShellBrowser_AddRef(&This
->IShellBrowser_iface
);
653 static ULONG WINAPI
DocObjectService_Release(
654 IDocObjectService
* iface
)
656 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
657 return IShellBrowser_Release(&This
->IShellBrowser_iface
);
660 static HRESULT WINAPI
DocObjectService_FireBeforeNavigate2(
661 IDocObjectService
* iface
,
662 IDispatch
*pDispatch
,
665 LPCWSTR lpszFrameName
,
672 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
673 VARIANT var_url
, var_flags
, var_frame_name
, var_post_data
, var_post_data2
, var_headers
;
674 VARIANTARG params
[7];
675 DISPPARAMS dp
= {params
, NULL
, 7, 0};
676 VARIANT_BOOL cancel
= VARIANT_FALSE
;
677 SAFEARRAY
*post_data
;
678 WCHAR file_path
[MAX_PATH
];
679 DWORD file_path_len
= ARRAY_SIZE(file_path
);
681 TRACE("%p %p %s %lx %s %p %ld %s %d %p\n", This
, pDispatch
, debugstr_w(lpszUrl
),
682 dwFlags
, debugstr_w(lpszFrameName
), pPostData
, cbPostData
,
683 debugstr_w(lpszHeaders
), fPlayNavSound
, pfCancel
);
686 post_data
= SafeArrayCreateVector(VT_UI1
, 0, cbPostData
);
688 return E_OUTOFMEMORY
;
689 memcpy(post_data
->pvData
, pPostData
, cbPostData
);
694 V_VT(params
) = VT_BOOL
|VT_BYREF
;
695 V_BOOLREF(params
) = &cancel
;
697 V_VT(params
+1) = (VT_BYREF
|VT_VARIANT
);
698 V_VARIANTREF(params
+1) = &var_headers
;
699 V_VT(&var_headers
) = VT_BSTR
;
700 V_BSTR(&var_headers
) = lpszHeaders
? SysAllocString(lpszHeaders
) : NULL
;
702 V_VT(params
+2) = (VT_BYREF
|VT_VARIANT
);
703 V_VARIANTREF(params
+2) = &var_post_data2
;
704 V_VT(&var_post_data2
) = (VT_BYREF
|VT_VARIANT
);
705 V_VARIANTREF(&var_post_data2
) = &var_post_data
;
708 V_VT(&var_post_data
) = VT_UI1
|VT_ARRAY
;
709 V_ARRAY(&var_post_data
) = post_data
;
711 V_VT(&var_post_data
) = VT_EMPTY
;
714 V_VT(params
+3) = (VT_BYREF
|VT_VARIANT
);
715 V_VARIANTREF(params
+3) = &var_frame_name
;
716 V_VT(&var_frame_name
) = VT_BSTR
;
717 V_BSTR(&var_frame_name
) = lpszFrameName
? SysAllocString(lpszFrameName
) : NULL
;
719 V_VT(params
+4) = (VT_BYREF
|VT_VARIANT
);
720 V_VARIANTREF(params
+4) = &var_flags
;
721 V_VT(&var_flags
) = VT_I4
;
722 V_I4(&var_flags
) = 0;
724 V_VT(params
+5) = (VT_BYREF
|VT_VARIANT
);
725 V_VARIANTREF(params
+5) = &var_url
;
726 V_VT(&var_url
) = VT_BSTR
;
727 if(PathCreateFromUrlW(lpszUrl
, file_path
, &file_path_len
, 0) == S_OK
)
728 V_BSTR(&var_url
) = SysAllocString(file_path
);
730 V_BSTR(&var_url
) = SysAllocString(lpszUrl
);
732 V_VT(params
+6) = (VT_DISPATCH
);
733 V_DISPATCH(params
+6) = (IDispatch
*)This
->doc_host
->wb
;
735 /* Keep reference to This. It may be released in event handler. */
736 IShellBrowser_AddRef(&This
->IShellBrowser_iface
);
739 call_sink(This
->doc_host
->cps
.wbe2
, DISPID_BEFORENAVIGATE2
, &dp
);
742 IShellBrowser_Release(&This
->IShellBrowser_iface
);
744 SysFreeString(V_BSTR(&var_url
));
745 SysFreeString(V_BSTR(&var_headers
));
746 SysFreeString(V_BSTR(&var_frame_name
));
747 SafeArrayDestroy(post_data
);
749 *pfCancel
= !!cancel
;
753 static HRESULT WINAPI
DocObjectService_FireNavigateComplete2(
754 IDocObjectService
* iface
,
755 IHTMLWindow2
*pHTMLWindow2
,
758 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
759 DocHost
*doc_host
= This
->doc_host
;
760 IHTMLPrivateWindow
*priv_window
;
761 const WCHAR
*orig_url
;
762 VARIANTARG params
[2];
763 DISPPARAMS dp
= {params
, NULL
, 2, 0};
768 TRACE("%p %p %lx\n", This
, pHTMLWindow2
, dwFlags
);
770 update_navigation_commands(This
->doc_host
);
772 if(doc_host
->travellog
.loading_pos
!= -1) {
773 WARN("histupdate not notified\n");
774 doc_host
->travellog
.position
= doc_host
->travellog
.loading_pos
;
775 doc_host
->travellog
.loading_pos
= -1;
778 hres
= IHTMLWindow2_QueryInterface(pHTMLWindow2
, &IID_IHTMLPrivateWindow
, (void**)&priv_window
);
782 hres
= IHTMLPrivateWindow_GetAddressBarUrl(priv_window
, &url
);
783 IHTMLPrivateWindow_Release(priv_window
);
787 TRACE("got URL %s\n", debugstr_w(url
));
788 set_dochost_url(This
->doc_host
, url
);
790 orig_url
= error_url_frag(url
);
792 BSTR tmp
= SysAllocString(orig_url
);
797 V_VT(params
) = (VT_BYREF
|VT_VARIANT
);
798 V_VARIANTREF(params
) = &url_var
;
800 V_VT(params
+1) = VT_DISPATCH
;
801 V_DISPATCH(params
+1) = (IDispatch
*)doc_host
->wb
;
803 V_VT(&url_var
) = VT_BSTR
;
804 V_BSTR(&url_var
) = url
;
806 /* Keep reference to This. It may be released in event handler. */
807 IShellBrowser_AddRef(&This
->IShellBrowser_iface
);
810 call_sink(This
->doc_host
->cps
.wbe2
, DISPID_NAVIGATECOMPLETE2
, &dp
);
815 IShellBrowser_Release(&This
->IShellBrowser_iface
);
819 static HRESULT WINAPI
DocObjectService_FireDownloadBegin(
820 IDocObjectService
* iface
)
822 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
827 static HRESULT WINAPI
DocObjectService_FireDownloadComplete(
828 IDocObjectService
* iface
)
830 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
835 static HRESULT WINAPI
DocObjectService_FireDocumentComplete(
836 IDocObjectService
* iface
,
837 IHTMLWindow2
*pHTMLWindow
,
840 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
841 IHTMLPrivateWindow
*priv_window
;
842 const WCHAR
*orig_url
;
843 VARIANTARG params
[2];
844 DISPPARAMS dp
= {params
, NULL
, 2, 0};
849 TRACE("%p %p %lx\n", This
, pHTMLWindow
, dwFlags
);
851 hres
= IHTMLWindow2_QueryInterface(pHTMLWindow
, &IID_IHTMLPrivateWindow
, (void**)&priv_window
);
855 hres
= IHTMLPrivateWindow_GetAddressBarUrl(priv_window
, &url
);
856 IHTMLPrivateWindow_Release(priv_window
);
860 TRACE("got URL %s\n", debugstr_w(url
));
862 orig_url
= error_url_frag(url
);
864 BSTR tmp
= SysAllocString(orig_url
);
869 V_VT(params
) = (VT_BYREF
|VT_VARIANT
);
870 V_VARIANTREF(params
) = &url_var
;
872 V_VT(params
+1) = VT_DISPATCH
;
873 V_DISPATCH(params
+1) = (IDispatch
*)This
->doc_host
->wb
;
875 V_VT(&url_var
) = VT_BSTR
;
876 V_BSTR(&url_var
) = url
;
878 /* Keep reference to This. It may be released in event handler. */
879 IShellBrowser_AddRef(&This
->IShellBrowser_iface
);
882 call_sink(This
->doc_host
->cps
.wbe2
, DISPID_DOCUMENTCOMPLETE
, &dp
);
887 IShellBrowser_Release(&This
->IShellBrowser_iface
);
891 static HRESULT WINAPI
DocObjectService_UpdateDesktopComponent(
892 IDocObjectService
* iface
,
893 IHTMLWindow2
*pHTMLWindow
)
895 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
896 FIXME("%p %p\n", This
, pHTMLWindow
);
900 static HRESULT WINAPI
DocObjectService_GetPendingUrl(
901 IDocObjectService
* iface
,
902 BSTR
*pbstrPendingUrl
)
904 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
905 FIXME("%p %p\n", This
, pbstrPendingUrl
);
909 static HRESULT WINAPI
DocObjectService_ActiveElementChanged(
910 IDocObjectService
* iface
,
911 IHTMLElement
*pHTMLElement
)
913 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
914 FIXME("%p %p\n", This
, pHTMLElement
);
918 static HRESULT WINAPI
DocObjectService_GetUrlSearchComponent(
919 IDocObjectService
* iface
,
922 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
923 FIXME("%p %p\n", This
, pbstrSearch
);
927 static HRESULT WINAPI
DocObjectService_IsErrorUrl(
928 IDocObjectService
* iface
,
932 ShellBrowser
*This
= impl_from_IDocObjectService(iface
);
934 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(lpszUrl
), pfIsError
);
936 *pfIsError
= !!error_url_frag(lpszUrl
);
940 static const IDocObjectServiceVtbl DocObjectServiceVtbl
= {
941 DocObjectService_QueryInterface
,
942 DocObjectService_AddRef
,
943 DocObjectService_Release
,
944 DocObjectService_FireBeforeNavigate2
,
945 DocObjectService_FireNavigateComplete2
,
946 DocObjectService_FireDownloadBegin
,
947 DocObjectService_FireDownloadComplete
,
948 DocObjectService_FireDocumentComplete
,
949 DocObjectService_UpdateDesktopComponent
,
950 DocObjectService_GetPendingUrl
,
951 DocObjectService_ActiveElementChanged
,
952 DocObjectService_GetUrlSearchComponent
,
953 DocObjectService_IsErrorUrl
956 HRESULT
create_browser_service(DocHost
*doc_host
, ShellBrowser
**ret
)
960 sb
= malloc(sizeof(ShellBrowser
));
962 return E_OUTOFMEMORY
;
964 sb
->IShellBrowser_iface
.lpVtbl
= &ShellBrowserVtbl
;
965 sb
->IBrowserService_iface
.lpVtbl
= &BrowserServiceVtbl
;
966 sb
->IDocObjectService_iface
.lpVtbl
= &DocObjectServiceVtbl
;
969 sb
->doc_host
= doc_host
;
975 void detach_browser_service(ShellBrowser
*sb
)
978 IShellBrowser_Release(&sb
->IShellBrowser_iface
);
981 static inline NewWindowManager
*impl_from_INewWindowManager(INewWindowManager
*iface
)
983 return CONTAINING_RECORD(iface
, NewWindowManager
, INewWindowManager_iface
);
986 static HRESULT WINAPI
NewWindowManager_QueryInterface(INewWindowManager
*iface
, REFIID riid
, void **ppv
)
988 NewWindowManager
*This
= impl_from_INewWindowManager(iface
);
990 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
991 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
992 *ppv
= &This
->INewWindowManager_iface
;
993 }else if(IsEqualGUID(&IID_INewWindowManager
, riid
)) {
994 TRACE("(%p)->(IID_INewWindowManager %p)\n", This
, ppv
);
995 *ppv
= &This
->INewWindowManager_iface
;
997 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
999 return E_NOINTERFACE
;
1002 IUnknown_AddRef((IUnknown
*)*ppv
);
1006 static ULONG WINAPI
NewWindowManager_AddRef(INewWindowManager
*iface
)
1008 NewWindowManager
*This
= impl_from_INewWindowManager(iface
);
1010 TRACE("(%p)\n", This
);
1012 return IOleClientSite_AddRef(&This
->doc_host
->IOleClientSite_iface
);
1015 static ULONG WINAPI
NewWindowManager_Release(INewWindowManager
*iface
)
1017 NewWindowManager
*This
= impl_from_INewWindowManager(iface
);
1019 TRACE("(%p)\n", This
);
1021 return IOleClientSite_Release(&This
->doc_host
->IOleClientSite_iface
);
1024 static HRESULT WINAPI
NewWindowManager_EvaluateNewWindow(INewWindowManager
*iface
, LPCWSTR pszUrl
,
1025 LPCWSTR pszName
, LPCWSTR pszUrlContext
, LPCWSTR pszFeatures
, BOOL fReplace
, DWORD dwFlags
,
1026 DWORD dwUserActionTime
)
1028 NewWindowManager
*This
= impl_from_INewWindowManager(iface
);
1029 FIXME("(%p)->(%s %s %s %s %x %lx %ld)\n", This
, debugstr_w(pszUrl
), debugstr_w(pszName
), debugstr_w(pszUrlContext
),
1030 debugstr_w(pszFeatures
), fReplace
, dwFlags
, dwUserActionTime
);
1034 static const INewWindowManagerVtbl NewWindowManagerVtbl
= {
1035 NewWindowManager_QueryInterface
,
1036 NewWindowManager_AddRef
,
1037 NewWindowManager_Release
,
1038 NewWindowManager_EvaluateNewWindow
1041 void NewWindowManager_Init(DocHost
*doc_host
)
1043 doc_host
->nwm
.INewWindowManager_iface
.lpVtbl
= &NewWindowManagerVtbl
;
1044 doc_host
->nwm
.doc_host
= doc_host
;