wined3d: Pass a wined3d_device_context to wined3d_cs_emit_blt_sub_resource().
[wine/zf.git] / dlls / ieframe / shellbrowser.c
blob375f9caa1b1529f62ed027b26f1647a3a7f979d4
1 /*
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
22 #include <assert.h>
24 #include "ieframe.h"
25 #include "exdispid.h"
26 #include "shlwapi.h"
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(ieframe);
32 static inline ShellBrowser *impl_from_IShellBrowser(IShellBrowser *iface)
34 return CONTAINING_RECORD(iface, ShellBrowser, IShellBrowser_iface);
37 static HRESULT WINAPI ShellBrowser_QueryInterface(IShellBrowser* iface, REFIID riid, void **ppv)
39 ShellBrowser *This = impl_from_IShellBrowser(iface);
41 if(IsEqualGUID(&IID_IUnknown, riid)) {
42 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
43 *ppv = &This->IShellBrowser_iface;
44 }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
45 TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
46 *ppv = &This->IShellBrowser_iface;
47 }else if(IsEqualGUID(&IID_IShellBrowser, riid)) {
48 TRACE("(%p)->(IID_IShellBrowser %p)\n", This, ppv);
49 *ppv = &This->IShellBrowser_iface;
50 }else if(IsEqualGUID(&IID_IBrowserService, riid)) {
51 TRACE("(%p)->(IID_IBrowserService %p)\n", This, ppv);
52 *ppv = &This->IBrowserService_iface;
53 }else if(IsEqualGUID(&IID_IDocObjectService, riid)) {
54 TRACE("(%p)->(IID_IDocObjectService %p)\n", This, ppv);
55 *ppv = &This->IDocObjectService_iface;
56 }else {
57 FIXME("%p %s %p\n", This, debugstr_guid(riid), ppv);
58 *ppv = NULL;
59 return E_NOINTERFACE;
62 IUnknown_AddRef((IUnknown*)*ppv);
63 return S_OK;
66 static ULONG WINAPI ShellBrowser_AddRef(
67 IShellBrowser* iface)
69 ShellBrowser *This = impl_from_IShellBrowser(iface);
70 LONG ref = InterlockedIncrement(&This->ref);
72 TRACE("(%p) ref=%d\n", This, ref);
74 return ref;
77 static ULONG WINAPI ShellBrowser_Release(IShellBrowser* iface)
79 ShellBrowser *This = impl_from_IShellBrowser(iface);
80 LONG ref = InterlockedDecrement(&This->ref);
82 TRACE("(%p) ref=%d\n", This, ref);
84 if(!ref) {
85 assert(!This->doc_host);
86 heap_free(This);
89 return ref;
92 static HRESULT WINAPI ShellBrowser_GetWindow(
93 IShellBrowser* iface,
94 HWND *phwnd)
96 ShellBrowser *This = impl_from_IShellBrowser(iface);
97 FIXME("%p %p\n", This, phwnd);
98 return E_NOTIMPL;
101 static HRESULT WINAPI ShellBrowser_ContextSensitiveHelp(
102 IShellBrowser* iface,
103 BOOL fEnterMode)
105 ShellBrowser *This = impl_from_IShellBrowser(iface);
106 FIXME("%p %d\n", This, fEnterMode);
107 return E_NOTIMPL;
110 static HRESULT WINAPI ShellBrowser_InsertMenusSB(
111 IShellBrowser* iface,
112 HMENU hmenuShared,
113 LPOLEMENUGROUPWIDTHS lpMenuWidths)
115 ShellBrowser *This = impl_from_IShellBrowser(iface);
116 FIXME("%p %p %p\n", This, hmenuShared, lpMenuWidths);
117 return E_NOTIMPL;
120 static HRESULT WINAPI ShellBrowser_SetMenuSB(
121 IShellBrowser* iface,
122 HMENU hmenuShared,
123 HOLEMENU holemenuReserved,
124 HWND hwndActiveObject)
126 ShellBrowser *This = impl_from_IShellBrowser(iface);
127 FIXME("%p %p %p %p\n", This, hmenuShared, holemenuReserved, hwndActiveObject);
128 return E_NOTIMPL;
131 static HRESULT WINAPI ShellBrowser_RemoveMenusSB(
132 IShellBrowser* iface,
133 HMENU hmenuShared)
135 ShellBrowser *This = impl_from_IShellBrowser(iface);
136 FIXME("%p %p\n", This, hmenuShared);
137 return E_NOTIMPL;
140 static HRESULT WINAPI ShellBrowser_SetStatusTextSB(
141 IShellBrowser* iface,
142 LPCOLESTR pszStatusText)
144 ShellBrowser *This = impl_from_IShellBrowser(iface);
145 FIXME("%p %s\n", This, debugstr_w(pszStatusText));
146 return E_NOTIMPL;
149 static HRESULT WINAPI ShellBrowser_EnableModelessSB(
150 IShellBrowser* iface,
151 BOOL fEnable)
153 ShellBrowser *This = impl_from_IShellBrowser(iface);
154 FIXME("%p %d\n", This, fEnable);
155 return E_NOTIMPL;
158 static HRESULT WINAPI ShellBrowser_TranslateAcceleratorSB(
159 IShellBrowser* iface,
160 MSG *pmsg,
161 WORD wID)
163 ShellBrowser *This = impl_from_IShellBrowser(iface);
164 FIXME("%p %p %d\n", This, pmsg, (int)wID);
165 return E_NOTIMPL;
168 static HRESULT WINAPI ShellBrowser_BrowseObject(
169 IShellBrowser* iface,
170 LPCITEMIDLIST pidl,
171 UINT wFlags)
173 ShellBrowser *This = impl_from_IShellBrowser(iface);
174 FIXME("%p %p %u\n", This, pidl, wFlags);
175 return E_NOTIMPL;
178 static HRESULT WINAPI ShellBrowser_GetViewStateStream(
179 IShellBrowser* iface,
180 DWORD grfMode,
181 IStream **ppStrm)
183 ShellBrowser *This = impl_from_IShellBrowser(iface);
184 FIXME("%p %x %p\n", This, grfMode, ppStrm);
185 return E_NOTIMPL;
188 static HRESULT WINAPI ShellBrowser_GetControlWindow(
189 IShellBrowser* iface,
190 UINT id,
191 HWND *phwnd)
193 ShellBrowser *This = impl_from_IShellBrowser(iface);
194 FIXME("%p %u %p\n", This, id, phwnd);
195 return E_NOTIMPL;
198 static HRESULT WINAPI ShellBrowser_SendControlMsg(
199 IShellBrowser* iface,
200 UINT id,
201 UINT uMsg,
202 WPARAM wParam,
203 LPARAM lParam,
204 LRESULT *pret)
206 ShellBrowser *This = impl_from_IShellBrowser(iface);
207 FIXME("%p %u %u %p\n", This, id, uMsg, pret);
208 return E_NOTIMPL;
211 static HRESULT WINAPI ShellBrowser_QueryActiveShellView(
212 IShellBrowser* iface,
213 IShellView **ppshv)
215 ShellBrowser *This = impl_from_IShellBrowser(iface);
216 FIXME("%p %p\n", This, ppshv);
217 return E_NOTIMPL;
220 static HRESULT WINAPI ShellBrowser_OnViewWindowActive(
221 IShellBrowser* iface,
222 IShellView *pshv)
224 ShellBrowser *This = impl_from_IShellBrowser(iface);
225 FIXME("%p %p\n", This, pshv);
226 return E_NOTIMPL;
229 static HRESULT WINAPI ShellBrowser_SetToolbarItems(
230 IShellBrowser* iface,
231 LPTBBUTTONSB lpButtons,
232 UINT nButtons,
233 UINT uFlags)
235 ShellBrowser *This = impl_from_IShellBrowser(iface);
236 FIXME("%p %p %u %u\n", This, lpButtons, nButtons, uFlags);
237 return E_NOTIMPL;
240 static const IShellBrowserVtbl ShellBrowserVtbl = {
241 ShellBrowser_QueryInterface,
242 ShellBrowser_AddRef,
243 ShellBrowser_Release,
244 ShellBrowser_GetWindow,
245 ShellBrowser_ContextSensitiveHelp,
246 ShellBrowser_InsertMenusSB,
247 ShellBrowser_SetMenuSB,
248 ShellBrowser_RemoveMenusSB,
249 ShellBrowser_SetStatusTextSB,
250 ShellBrowser_EnableModelessSB,
251 ShellBrowser_TranslateAcceleratorSB,
252 ShellBrowser_BrowseObject,
253 ShellBrowser_GetViewStateStream,
254 ShellBrowser_GetControlWindow,
255 ShellBrowser_SendControlMsg,
256 ShellBrowser_QueryActiveShellView,
257 ShellBrowser_OnViewWindowActive,
258 ShellBrowser_SetToolbarItems
261 static inline ShellBrowser *impl_from_IBrowserService(IBrowserService *iface)
263 return CONTAINING_RECORD(iface, ShellBrowser, IBrowserService_iface);
266 static HRESULT WINAPI BrowserService_QueryInterface(
267 IBrowserService* iface,
268 REFIID riid,
269 void **ppvObject)
271 ShellBrowser *This = impl_from_IBrowserService(iface);
272 return IShellBrowser_QueryInterface(&This->IShellBrowser_iface, riid, ppvObject);
275 static ULONG WINAPI BrowserService_AddRef(
276 IBrowserService *iface)
278 ShellBrowser *This = impl_from_IBrowserService(iface);
279 return IShellBrowser_AddRef(&This->IShellBrowser_iface);
282 static ULONG WINAPI BrowserService_Release(
283 IBrowserService* iface)
285 ShellBrowser *This = impl_from_IBrowserService(iface);
286 return IShellBrowser_Release(&This->IShellBrowser_iface);
289 static HRESULT WINAPI BrowserService_GetParentSite(
290 IBrowserService* iface,
291 IOleInPlaceSite **ppipsite)
293 ShellBrowser *This = impl_from_IBrowserService(iface);
294 FIXME("%p %p\n", This, ppipsite);
295 return E_NOTIMPL;
298 static HRESULT WINAPI BrowserService_SetTitle(
299 IBrowserService* iface,
300 IShellView *psv,
301 LPCWSTR pszName)
303 ShellBrowser *This = impl_from_IBrowserService(iface);
304 FIXME("%p %p %s\n", This, psv, debugstr_w(pszName));
305 return E_NOTIMPL;
308 static HRESULT WINAPI BrowserService_GetTitle(
309 IBrowserService* iface,
310 IShellView *psv,
311 LPWSTR pszName,
312 DWORD cchName)
314 ShellBrowser *This = impl_from_IBrowserService(iface);
315 FIXME("%p %p %p %d\n", This, psv, pszName, cchName);
316 return E_NOTIMPL;
319 static HRESULT WINAPI BrowserService_GetOleObject(
320 IBrowserService* iface,
321 IOleObject **ppobjv)
323 ShellBrowser *This = impl_from_IBrowserService(iface);
324 FIXME("%p %p\n", This, ppobjv);
325 return E_NOTIMPL;
328 static HRESULT WINAPI BrowserService_GetTravelLog(
329 IBrowserService* iface,
330 ITravelLog **pptl)
332 ShellBrowser *This = impl_from_IBrowserService(iface);
333 FIXME("%p %p\n", This, pptl);
334 return E_NOTIMPL;
337 static HRESULT WINAPI BrowserService_ShowControlWindow(
338 IBrowserService* iface,
339 UINT id,
340 BOOL fShow)
342 ShellBrowser *This = impl_from_IBrowserService(iface);
343 FIXME("%p %u %d\n", This, id, fShow);
344 return E_NOTIMPL;
347 static HRESULT WINAPI BrowserService_IsControlWindowShown(
348 IBrowserService* iface,
349 UINT id,
350 BOOL *pfShown)
352 ShellBrowser *This = impl_from_IBrowserService(iface);
353 FIXME("%p %u %p\n", This, id, pfShown);
354 return E_NOTIMPL;
357 static HRESULT WINAPI BrowserService_IEGetDisplayName(
358 IBrowserService* iface,
359 PCIDLIST_ABSOLUTE pidl,
360 LPWSTR pwszName,
361 UINT uFlags)
363 ShellBrowser *This = impl_from_IBrowserService(iface);
364 FIXME("%p %p %p %u\n", This, pidl, pwszName, uFlags);
365 return E_NOTIMPL;
368 static HRESULT WINAPI BrowserService_IEParseDisplayName(
369 IBrowserService* iface,
370 UINT uiCP,
371 LPCWSTR pwszPath,
372 PIDLIST_ABSOLUTE *ppidlOut)
374 ShellBrowser *This = impl_from_IBrowserService(iface);
375 FIXME("%p %u %s %p\n", This, uiCP, debugstr_w(pwszPath), ppidlOut);
376 return E_NOTIMPL;
379 static HRESULT WINAPI BrowserService_DisplayParseError(
380 IBrowserService* iface,
381 HRESULT hres,
382 LPCWSTR pwszPath)
384 ShellBrowser *This = impl_from_IBrowserService(iface);
385 FIXME("%p %x %s\n", This, hres, debugstr_w(pwszPath));
386 return E_NOTIMPL;
389 static HRESULT WINAPI BrowserService_NavigateToPidl(
390 IBrowserService* iface,
391 PCIDLIST_ABSOLUTE pidl,
392 DWORD grfHLNF)
394 ShellBrowser *This = impl_from_IBrowserService(iface);
395 FIXME("%p %p %d\n", This, pidl, grfHLNF);
396 return E_NOTIMPL;
399 static HRESULT WINAPI BrowserService_SetNavigateState(
400 IBrowserService* iface,
401 BNSTATE bnstate)
403 ShellBrowser *This = impl_from_IBrowserService(iface);
404 FIXME("%p %d\n", This, bnstate);
405 return E_NOTIMPL;
408 static HRESULT WINAPI BrowserService_GetNavigateState(
409 IBrowserService* iface,
410 BNSTATE *pbnstate)
412 ShellBrowser *This = impl_from_IBrowserService(iface);
413 FIXME("%p %p\n", This, pbnstate);
414 return E_NOTIMPL;
417 static HRESULT WINAPI BrowserService_NotifyRedirect(
418 IBrowserService* iface,
419 IShellView *psv,
420 PCIDLIST_ABSOLUTE pidl,
421 BOOL *pfDidBrowse)
423 ShellBrowser *This = impl_from_IBrowserService(iface);
424 FIXME("%p %p %p %p\n", This, psv, pidl, pfDidBrowse);
425 return E_NOTIMPL;
428 static HRESULT WINAPI BrowserService_UpdateWindowList(
429 IBrowserService* iface)
431 ShellBrowser *This = impl_from_IBrowserService(iface);
432 FIXME("%p\n", This);
433 return E_NOTIMPL;
436 static HRESULT WINAPI BrowserService_UpdateBackForwardState(
437 IBrowserService* iface)
439 ShellBrowser *This = impl_from_IBrowserService(iface);
440 FIXME("%p\n", This);
441 return E_NOTIMPL;
444 static HRESULT WINAPI BrowserService_SetFlags(
445 IBrowserService* iface,
446 DWORD dwFlags,
447 DWORD dwFlagMask)
449 ShellBrowser *This = impl_from_IBrowserService(iface);
450 FIXME("%p %x %x\n", This, dwFlags, dwFlagMask);
451 return E_NOTIMPL;
454 static HRESULT WINAPI BrowserService_GetFlags(
455 IBrowserService* iface,
456 DWORD *pdwFlags)
458 ShellBrowser *This = impl_from_IBrowserService(iface);
459 FIXME("%p %p\n", This, pdwFlags);
460 return E_NOTIMPL;
463 static HRESULT WINAPI BrowserService_CanNavigateNow(
464 IBrowserService* iface)
466 ShellBrowser *This = impl_from_IBrowserService(iface);
467 FIXME("%p\n", This);
468 return E_NOTIMPL;
471 static HRESULT WINAPI BrowserService_GetPidl(
472 IBrowserService* iface,
473 PIDLIST_ABSOLUTE *ppidl)
475 ShellBrowser *This = impl_from_IBrowserService(iface);
476 FIXME("%p %p\n", This, ppidl);
477 return E_NOTIMPL;
480 static HRESULT WINAPI BrowserService_SetReferrer(
481 IBrowserService* iface,
482 PCIDLIST_ABSOLUTE pidl)
484 ShellBrowser *This = impl_from_IBrowserService(iface);
485 FIXME("%p %p\n", This, pidl);
486 return E_NOTIMPL;
489 static DWORD WINAPI BrowserService_GetBrowserIndex(
490 IBrowserService* iface)
492 ShellBrowser *This = impl_from_IBrowserService(iface);
493 FIXME("%p\n", This);
494 return E_NOTIMPL;
497 static HRESULT WINAPI BrowserService_GetBrowserByIndex(
498 IBrowserService* iface,
499 DWORD dwID,
500 IUnknown **ppunk)
502 ShellBrowser *This = impl_from_IBrowserService(iface);
503 FIXME("%p %x %p\n", This, dwID, ppunk);
504 return E_NOTIMPL;
507 static HRESULT WINAPI BrowserService_GetHistoryObject(
508 IBrowserService* iface,
509 IOleObject **ppole,
510 IStream **pstm,
511 IBindCtx **ppbc)
513 ShellBrowser *This = impl_from_IBrowserService(iface);
514 FIXME("%p %p %p %p\n", This, ppole, pstm, ppbc);
515 return E_NOTIMPL;
518 static HRESULT WINAPI BrowserService_SetHistoryObject(
519 IBrowserService* iface,
520 IOleObject *pole,
521 BOOL fIsLocalAnchor)
523 ShellBrowser *This = impl_from_IBrowserService(iface);
524 FIXME("%p %p %d\n", This, pole, fIsLocalAnchor);
525 return E_NOTIMPL;
528 static HRESULT WINAPI BrowserService_CacheOLEServer(
529 IBrowserService* iface,
530 IOleObject *pole)
532 ShellBrowser *This = impl_from_IBrowserService(iface);
533 FIXME("%p %p\n", This, pole);
534 return E_NOTIMPL;
537 static HRESULT WINAPI BrowserService_GetSetCodePage(
538 IBrowserService* iface,
539 VARIANT *pvarIn,
540 VARIANT *pvarOut)
542 ShellBrowser *This = impl_from_IBrowserService(iface);
543 FIXME("%p %s %p\n", This, debugstr_variant(pvarIn), pvarOut);
544 return E_NOTIMPL;
547 static HRESULT WINAPI BrowserService_OnHttpEquiv(
548 IBrowserService* iface,
549 IShellView *psv,
550 BOOL fDone,
551 VARIANT *pvarargIn,
552 VARIANT *pvarargOut)
554 ShellBrowser *This = impl_from_IBrowserService(iface);
555 FIXME("%p %p %d %s %p\n", This, psv, fDone, debugstr_variant(pvarargIn), pvarargOut);
556 return E_NOTIMPL;
559 static HRESULT WINAPI BrowserService_GetPalette(
560 IBrowserService* iface,
561 HPALETTE *hpal)
563 ShellBrowser *This = impl_from_IBrowserService(iface);
564 FIXME("%p %p\n", This, hpal);
565 return E_NOTIMPL;
568 static HRESULT WINAPI BrowserService_RegisterWindow(
569 IBrowserService* iface,
570 BOOL fForceRegister,
571 int swc)
573 ShellBrowser *This = impl_from_IBrowserService(iface);
574 FIXME("%p %d %d\n", This, fForceRegister, swc);
575 return E_NOTIMPL;
578 static const IBrowserServiceVtbl BrowserServiceVtbl = {
579 BrowserService_QueryInterface,
580 BrowserService_AddRef,
581 BrowserService_Release,
582 BrowserService_GetParentSite,
583 BrowserService_SetTitle,
584 BrowserService_GetTitle,
585 BrowserService_GetOleObject,
586 BrowserService_GetTravelLog,
587 BrowserService_ShowControlWindow,
588 BrowserService_IsControlWindowShown,
589 BrowserService_IEGetDisplayName,
590 BrowserService_IEParseDisplayName,
591 BrowserService_DisplayParseError,
592 BrowserService_NavigateToPidl,
593 BrowserService_SetNavigateState,
594 BrowserService_GetNavigateState,
595 BrowserService_NotifyRedirect,
596 BrowserService_UpdateWindowList,
597 BrowserService_UpdateBackForwardState,
598 BrowserService_SetFlags,
599 BrowserService_GetFlags,
600 BrowserService_CanNavigateNow,
601 BrowserService_GetPidl,
602 BrowserService_SetReferrer,
603 BrowserService_GetBrowserIndex,
604 BrowserService_GetBrowserByIndex,
605 BrowserService_GetHistoryObject,
606 BrowserService_SetHistoryObject,
607 BrowserService_CacheOLEServer,
608 BrowserService_GetSetCodePage,
609 BrowserService_OnHttpEquiv,
610 BrowserService_GetPalette,
611 BrowserService_RegisterWindow
614 static inline ShellBrowser *impl_from_IDocObjectService(IDocObjectService *iface)
616 return CONTAINING_RECORD(iface, ShellBrowser, IDocObjectService_iface);
619 static HRESULT WINAPI DocObjectService_QueryInterface(
620 IDocObjectService* iface,
621 REFIID riid,
622 void **ppvObject)
624 ShellBrowser *This = impl_from_IDocObjectService(iface);
625 return IShellBrowser_QueryInterface(&This->IShellBrowser_iface, riid, ppvObject);
628 static ULONG WINAPI DocObjectService_AddRef(
629 IDocObjectService* iface)
631 ShellBrowser *This = impl_from_IDocObjectService(iface);
632 return IShellBrowser_AddRef(&This->IShellBrowser_iface);
635 static ULONG WINAPI DocObjectService_Release(
636 IDocObjectService* iface)
638 ShellBrowser *This = impl_from_IDocObjectService(iface);
639 return IShellBrowser_Release(&This->IShellBrowser_iface);
642 static HRESULT WINAPI DocObjectService_FireBeforeNavigate2(
643 IDocObjectService* iface,
644 IDispatch *pDispatch,
645 LPCWSTR lpszUrl,
646 DWORD dwFlags,
647 LPCWSTR lpszFrameName,
648 BYTE *pPostData,
649 DWORD cbPostData,
650 LPCWSTR lpszHeaders,
651 BOOL fPlayNavSound,
652 BOOL *pfCancel)
654 ShellBrowser *This = impl_from_IDocObjectService(iface);
655 VARIANT var_url, var_flags, var_frame_name, var_post_data, var_post_data2, var_headers;
656 VARIANTARG params[7];
657 DISPPARAMS dp = {params, NULL, 7, 0};
658 VARIANT_BOOL cancel = VARIANT_FALSE;
659 SAFEARRAY *post_data;
660 WCHAR file_path[MAX_PATH];
661 DWORD file_path_len = ARRAY_SIZE(file_path);
663 TRACE("%p %p %s %x %s %p %d %s %d %p\n", This, pDispatch, debugstr_w(lpszUrl),
664 dwFlags, debugstr_w(lpszFrameName), pPostData, cbPostData,
665 debugstr_w(lpszHeaders), fPlayNavSound, pfCancel);
667 if(cbPostData) {
668 post_data = SafeArrayCreateVector(VT_UI1, 0, cbPostData);
669 if(!post_data)
670 return E_OUTOFMEMORY;
671 memcpy(post_data->pvData, pPostData, cbPostData);
672 }else {
673 post_data = NULL;
676 V_VT(params) = VT_BOOL|VT_BYREF;
677 V_BOOLREF(params) = &cancel;
679 V_VT(params+1) = (VT_BYREF|VT_VARIANT);
680 V_VARIANTREF(params+1) = &var_headers;
681 V_VT(&var_headers) = VT_BSTR;
682 V_BSTR(&var_headers) = lpszHeaders ? SysAllocString(lpszHeaders) : NULL;
684 V_VT(params+2) = (VT_BYREF|VT_VARIANT);
685 V_VARIANTREF(params+2) = &var_post_data2;
686 V_VT(&var_post_data2) = (VT_BYREF|VT_VARIANT);
687 V_VARIANTREF(&var_post_data2) = &var_post_data;
689 if(post_data) {
690 V_VT(&var_post_data) = VT_UI1|VT_ARRAY;
691 V_ARRAY(&var_post_data) = post_data;
692 }else {
693 V_VT(&var_post_data) = VT_EMPTY;
696 V_VT(params+3) = (VT_BYREF|VT_VARIANT);
697 V_VARIANTREF(params+3) = &var_frame_name;
698 V_VT(&var_frame_name) = VT_BSTR;
699 V_BSTR(&var_frame_name) = lpszFrameName ? SysAllocString(lpszFrameName) : NULL;
701 V_VT(params+4) = (VT_BYREF|VT_VARIANT);
702 V_VARIANTREF(params+4) = &var_flags;
703 V_VT(&var_flags) = VT_I4;
704 V_I4(&var_flags) = 0;
706 V_VT(params+5) = (VT_BYREF|VT_VARIANT);
707 V_VARIANTREF(params+5) = &var_url;
708 V_VT(&var_url) = VT_BSTR;
709 if(PathCreateFromUrlW(lpszUrl, file_path, &file_path_len, 0) == S_OK)
710 V_BSTR(&var_url) = SysAllocString(file_path);
711 else
712 V_BSTR(&var_url) = SysAllocString(lpszUrl);
714 V_VT(params+6) = (VT_DISPATCH);
715 V_DISPATCH(params+6) = (IDispatch*)This->doc_host->wb;
717 /* Keep reference to This. It may be released in event handler. */
718 IShellBrowser_AddRef(&This->IShellBrowser_iface);
720 TRACE(">>>\n");
721 call_sink(This->doc_host->cps.wbe2, DISPID_BEFORENAVIGATE2, &dp);
722 TRACE("<<<\n");
724 IShellBrowser_Release(&This->IShellBrowser_iface);
726 SysFreeString(V_BSTR(&var_url));
727 SysFreeString(V_BSTR(&var_headers));
728 SysFreeString(V_BSTR(&var_frame_name));
729 SafeArrayDestroy(post_data);
731 *pfCancel = !!cancel;
732 return S_OK;
735 static HRESULT WINAPI DocObjectService_FireNavigateComplete2(
736 IDocObjectService* iface,
737 IHTMLWindow2 *pHTMLWindow2,
738 DWORD dwFlags)
740 ShellBrowser *This = impl_from_IDocObjectService(iface);
741 DocHost *doc_host = This->doc_host;
742 IHTMLPrivateWindow *priv_window;
743 VARIANTARG params[2];
744 DISPPARAMS dp = {params, NULL, 2, 0};
745 VARIANT url_var;
746 BSTR url;
747 HRESULT hres;
749 TRACE("%p %p %x\n", This, pHTMLWindow2, dwFlags);
751 update_navigation_commands(This->doc_host);
753 if(doc_host->travellog.loading_pos != -1) {
754 WARN("histupdate not notified\n");
755 doc_host->travellog.position = doc_host->travellog.loading_pos;
756 doc_host->travellog.loading_pos = -1;
759 hres = IHTMLWindow2_QueryInterface(pHTMLWindow2, &IID_IHTMLPrivateWindow, (void**)&priv_window);
760 if(FAILED(hres))
761 return hres;
763 hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &url);
764 IHTMLPrivateWindow_Release(priv_window);
765 if(FAILED(hres))
766 return hres;
768 TRACE("got URL %s\n", debugstr_w(url));
769 set_dochost_url(This->doc_host, url);
771 V_VT(params) = (VT_BYREF|VT_VARIANT);
772 V_VARIANTREF(params) = &url_var;
774 V_VT(params+1) = VT_DISPATCH;
775 V_DISPATCH(params+1) = (IDispatch*)doc_host->wb;
777 V_VT(&url_var) = VT_BSTR;
778 V_BSTR(&url_var) = url;
780 /* Keep reference to This. It may be released in event handler. */
781 IShellBrowser_AddRef(&This->IShellBrowser_iface);
783 TRACE(">>>\n");
784 call_sink(This->doc_host->cps.wbe2, DISPID_NAVIGATECOMPLETE2, &dp);
785 TRACE("<<<\n");
787 SysFreeString(url);
789 IShellBrowser_Release(&This->IShellBrowser_iface);
790 return S_OK;
793 static HRESULT WINAPI DocObjectService_FireDownloadBegin(
794 IDocObjectService* iface)
796 ShellBrowser *This = impl_from_IDocObjectService(iface);
797 FIXME("%p\n", This);
798 return E_NOTIMPL;
801 static HRESULT WINAPI DocObjectService_FireDownloadComplete(
802 IDocObjectService* iface)
804 ShellBrowser *This = impl_from_IDocObjectService(iface);
805 FIXME("%p\n", This);
806 return E_NOTIMPL;
809 static HRESULT WINAPI DocObjectService_FireDocumentComplete(
810 IDocObjectService* iface,
811 IHTMLWindow2 *pHTMLWindow,
812 DWORD dwFlags)
814 ShellBrowser *This = impl_from_IDocObjectService(iface);
815 IHTMLPrivateWindow *priv_window;
816 VARIANTARG params[2];
817 DISPPARAMS dp = {params, NULL, 2, 0};
818 VARIANT url_var;
819 BSTR url;
820 HRESULT hres;
822 TRACE("%p %p %x\n", This, pHTMLWindow, dwFlags);
824 hres = IHTMLWindow2_QueryInterface(pHTMLWindow, &IID_IHTMLPrivateWindow, (void**)&priv_window);
825 if(FAILED(hres))
826 return hres;
828 hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &url);
829 IHTMLPrivateWindow_Release(priv_window);
830 if(FAILED(hres))
831 return hres;
833 TRACE("got URL %s\n", debugstr_w(url));
835 V_VT(params) = (VT_BYREF|VT_VARIANT);
836 V_VARIANTREF(params) = &url_var;
838 V_VT(params+1) = VT_DISPATCH;
839 V_DISPATCH(params+1) = (IDispatch*)This->doc_host->wb;
841 V_VT(&url_var) = VT_BSTR;
842 V_BSTR(&url_var) = url;
844 /* Keep reference to This. It may be released in event handler. */
845 IShellBrowser_AddRef(&This->IShellBrowser_iface);
847 TRACE(">>>\n");
848 call_sink(This->doc_host->cps.wbe2, DISPID_DOCUMENTCOMPLETE, &dp);
849 TRACE("<<<\n");
851 SysFreeString(url);
853 IShellBrowser_Release(&This->IShellBrowser_iface);
854 return S_OK;
857 static HRESULT WINAPI DocObjectService_UpdateDesktopComponent(
858 IDocObjectService* iface,
859 IHTMLWindow2 *pHTMLWindow)
861 ShellBrowser *This = impl_from_IDocObjectService(iface);
862 FIXME("%p %p\n", This, pHTMLWindow);
863 return E_NOTIMPL;
866 static HRESULT WINAPI DocObjectService_GetPendingUrl(
867 IDocObjectService* iface,
868 BSTR *pbstrPendingUrl)
870 ShellBrowser *This = impl_from_IDocObjectService(iface);
871 FIXME("%p %p\n", This, pbstrPendingUrl);
872 return E_NOTIMPL;
875 static HRESULT WINAPI DocObjectService_ActiveElementChanged(
876 IDocObjectService* iface,
877 IHTMLElement *pHTMLElement)
879 ShellBrowser *This = impl_from_IDocObjectService(iface);
880 FIXME("%p %p\n", This, pHTMLElement);
881 return E_NOTIMPL;
884 static HRESULT WINAPI DocObjectService_GetUrlSearchComponent(
885 IDocObjectService* iface,
886 BSTR *pbstrSearch)
888 ShellBrowser *This = impl_from_IDocObjectService(iface);
889 FIXME("%p %p\n", This, pbstrSearch);
890 return E_NOTIMPL;
893 static HRESULT WINAPI DocObjectService_IsErrorUrl(
894 IDocObjectService* iface,
895 LPCWSTR lpszUrl,
896 BOOL *pfIsError)
898 ShellBrowser *This = impl_from_IDocObjectService(iface);
899 FIXME("%p %s %p\n", This, debugstr_w(lpszUrl), pfIsError);
901 *pfIsError = FALSE;
902 return S_OK;
905 static const IDocObjectServiceVtbl DocObjectServiceVtbl = {
906 DocObjectService_QueryInterface,
907 DocObjectService_AddRef,
908 DocObjectService_Release,
909 DocObjectService_FireBeforeNavigate2,
910 DocObjectService_FireNavigateComplete2,
911 DocObjectService_FireDownloadBegin,
912 DocObjectService_FireDownloadComplete,
913 DocObjectService_FireDocumentComplete,
914 DocObjectService_UpdateDesktopComponent,
915 DocObjectService_GetPendingUrl,
916 DocObjectService_ActiveElementChanged,
917 DocObjectService_GetUrlSearchComponent,
918 DocObjectService_IsErrorUrl
921 HRESULT create_browser_service(DocHost *doc_host, ShellBrowser **ret)
923 ShellBrowser *sb;
925 sb = heap_alloc(sizeof(ShellBrowser));
926 if(!sb)
927 return E_OUTOFMEMORY;
929 sb->IShellBrowser_iface.lpVtbl = &ShellBrowserVtbl;
930 sb->IBrowserService_iface.lpVtbl = &BrowserServiceVtbl;
931 sb->IDocObjectService_iface.lpVtbl = &DocObjectServiceVtbl;
933 sb->ref = 1;
934 sb->doc_host = doc_host;
936 *ret = sb;
937 return S_OK;
940 void detach_browser_service(ShellBrowser *sb)
942 sb->doc_host = NULL;
943 IShellBrowser_Release(&sb->IShellBrowser_iface);
946 static inline NewWindowManager *impl_from_INewWindowManager(INewWindowManager *iface)
948 return CONTAINING_RECORD(iface, NewWindowManager, INewWindowManager_iface);
951 static HRESULT WINAPI NewWindowManager_QueryInterface(INewWindowManager *iface, REFIID riid, void **ppv)
953 NewWindowManager *This = impl_from_INewWindowManager(iface);
955 if(IsEqualGUID(&IID_IUnknown, riid)) {
956 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
957 *ppv = &This->INewWindowManager_iface;
958 }else if(IsEqualGUID(&IID_INewWindowManager, riid)) {
959 TRACE("(%p)->(IID_INewWindowManager %p)\n", This, ppv);
960 *ppv = &This->INewWindowManager_iface;
961 }else {
962 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
963 *ppv = NULL;
964 return E_NOINTERFACE;
967 IUnknown_AddRef((IUnknown*)*ppv);
968 return S_OK;
971 static ULONG WINAPI NewWindowManager_AddRef(INewWindowManager *iface)
973 NewWindowManager *This = impl_from_INewWindowManager(iface);
975 TRACE("(%p)\n", This);
977 return IOleClientSite_AddRef(&This->doc_host->IOleClientSite_iface);
980 static ULONG WINAPI NewWindowManager_Release(INewWindowManager *iface)
982 NewWindowManager *This = impl_from_INewWindowManager(iface);
984 TRACE("(%p)\n", This);
986 return IOleClientSite_Release(&This->doc_host->IOleClientSite_iface);
989 static HRESULT WINAPI NewWindowManager_EvaluateNewWindow(INewWindowManager *iface, LPCWSTR pszUrl,
990 LPCWSTR pszName, LPCWSTR pszUrlContext, LPCWSTR pszFeatures, BOOL fReplace, DWORD dwFlags,
991 DWORD dwUserActionTime)
993 NewWindowManager *This = impl_from_INewWindowManager(iface);
994 FIXME("(%p)->(%s %s %s %s %x %x %d)\n", This, debugstr_w(pszUrl), debugstr_w(pszName), debugstr_w(pszUrlContext),
995 debugstr_w(pszFeatures), fReplace, dwFlags, dwUserActionTime);
996 return S_OK;
999 static const INewWindowManagerVtbl NewWindowManagerVtbl = {
1000 NewWindowManager_QueryInterface,
1001 NewWindowManager_AddRef,
1002 NewWindowManager_Release,
1003 NewWindowManager_EvaluateNewWindow
1006 void NewWindowManager_Init(DocHost *doc_host)
1008 doc_host->nwm.INewWindowManager_iface.lpVtbl = &NewWindowManagerVtbl;
1009 doc_host->nwm.doc_host = doc_host;