2 * Copyright 2006-2007 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #define NONAMELESSUNION
20 #define NONAMELESSSTRUCT
22 #include "wine/debug.h"
23 #include "wine/unicode.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
33 static const WCHAR emptyW[] = {0};
36 const IBindStatusCallbackVtbl *lpBindStatusCallbackVtbl;
37 const IHttpNegotiateVtbl *lpHttpNegotiateVtbl;
48 #define BINDSC(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
49 #define HTTPNEG(x) ((IHttpNegotiate*) &(x)->lpHttpNegotiateVtbl)
51 static void dump_BINDINFO(BINDINFO *bi)
53 static const char * const BINDINFOF_str[] = {
55 "BINDINFOF_URLENCODESTGMEDDATA",
56 "BINDINFOF_URLENCODEDEXTRAINFO"
59 static const char * const BINDVERB_str[] = {
79 bi->cbSize, debugstr_w(bi->szExtraInfo),
80 bi->stgmedData.tymed, bi->stgmedData.u.hGlobal, bi->stgmedData.pUnkForRelease,
81 bi->grfBindInfoF > BINDINFOF_URLENCODEDEXTRAINFO
82 ? "unknown" : BINDINFOF_str[bi->grfBindInfoF],
83 bi->dwBindVerb > BINDVERB_CUSTOM
84 ? "unknown" : BINDVERB_str[bi->dwBindVerb],
85 debugstr_w(bi->szCustomVerb),
86 bi->cbstgmedData, bi->dwOptions, bi->dwOptionsFlags, bi->dwCodePage,
87 bi->securityAttributes.nLength,
88 bi->securityAttributes.lpSecurityDescriptor,
89 bi->securityAttributes.bInheritHandle,
90 debugstr_guid(&bi->iid),
91 bi->pUnk, bi->dwReserved
95 static void set_status_text(BindStatusCallback *This, LPCWSTR str)
97 if(!This->doc_host || !This->doc_host->frame)
100 IOleInPlaceFrame_SetStatusText(This->doc_host->frame, str);
103 #define BINDSC_THIS(iface) DEFINE_THIS(BindStatusCallback, BindStatusCallback, iface)
105 static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallback *iface,
106 REFIID riid, void **ppv)
108 BindStatusCallback *This = BINDSC_THIS(iface);
112 if(IsEqualGUID(&IID_IUnknown, riid)) {
113 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
115 }else if(IsEqualGUID(&IID_IBindStatusCallback, riid)) {
116 TRACE("(%p)->(IID_IBindStatusCallback %p)\n", This, ppv);
118 }else if(IsEqualGUID(&IID_IHttpNegotiate, riid)) {
119 TRACE("(%p)->(IID_IHttpNegotiate %p)\n", This, ppv);
120 *ppv = HTTPNEG(This);
124 IBindStatusCallback_AddRef(BINDSC(This));
128 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
129 return E_NOINTERFACE;
132 static ULONG WINAPI BindStatusCallback_AddRef(IBindStatusCallback *iface)
134 BindStatusCallback *This = BINDSC_THIS(iface);
135 LONG ref = InterlockedIncrement(&This->ref);
137 TRACE("(%p) ref=%d\n", This, ref);
142 static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface)
144 BindStatusCallback *This = BINDSC_THIS(iface);
145 LONG ref = InterlockedDecrement(&This->ref);
147 TRACE("(%p) ref=%d\n", This, ref);
151 IOleClientSite_Release(CLIENTSITE(This->doc_host));
153 GlobalFree(This->post_data);
154 heap_free(This->headers);
161 static HRESULT WINAPI BindStatusCallback_OnStartBinding(IBindStatusCallback *iface,
162 DWORD dwReserved, IBinding *pbind)
164 BindStatusCallback *This = BINDSC_THIS(iface);
166 TRACE("(%p)->(%d %p)\n", This, dwReserved, pbind);
171 static HRESULT WINAPI BindStatusCallback_GetPriority(IBindStatusCallback *iface,
174 BindStatusCallback *This = BINDSC_THIS(iface);
175 FIXME("(%p)->(%p)\n", This, pnPriority);
179 static HRESULT WINAPI BindStatusCallback_OnLowResource(IBindStatusCallback *iface,
182 BindStatusCallback *This = BINDSC_THIS(iface);
183 FIXME("(%p)->(%d)\n", This, reserved);
187 static HRESULT WINAPI BindStatusCallback_OnProgress(IBindStatusCallback *iface,
188 ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
190 BindStatusCallback *This = BINDSC_THIS(iface);
192 TRACE("(%p)->(%d %d %d %s)\n", This, ulProgress, ulProgressMax, ulStatusCode,
193 debugstr_w(szStatusText));
195 switch(ulStatusCode) {
196 case BINDSTATUS_BEGINDOWNLOADDATA:
197 set_status_text(This, szStatusText); /* FIXME: "Start downloading from site: %s" */
199 case BINDSTATUS_ENDDOWNLOADDATA:
200 set_status_text(This, szStatusText); /* FIXME: "Downloading from site: %s" */
202 case BINDSTATUS_CLASSIDAVAILABLE:
203 case BINDSTATUS_MIMETYPEAVAILABLE:
204 case BINDSTATUS_BEGINSYNCOPERATION:
205 case BINDSTATUS_ENDSYNCOPERATION:
208 FIXME("status code %u\n", ulStatusCode);
214 static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *iface,
215 HRESULT hresult, LPCWSTR szError)
217 BindStatusCallback *This = BINDSC_THIS(iface);
219 TRACE("(%p)->(%08x %s)\n", This, hresult, debugstr_w(szError));
221 set_status_text(This, emptyW);
224 IOleClientSite_Release(CLIENTSITE(This->doc_host));
225 This->doc_host = NULL;
231 static HRESULT WINAPI BindStatusCallback_GetBindInfo(IBindStatusCallback *iface,
232 DWORD *grfBINDF, BINDINFO *pbindinfo)
234 BindStatusCallback *This = BINDSC_THIS(iface);
236 TRACE("(%p)->(%p %p)\n", This, grfBINDF, pbindinfo);
238 *grfBINDF = BINDF_ASYNCHRONOUS;
240 if(This->post_data) {
241 pbindinfo->dwBindVerb = BINDVERB_POST;
243 pbindinfo->stgmedData.tymed = TYMED_HGLOBAL;
244 pbindinfo->stgmedData.u.hGlobal = This->post_data;
245 pbindinfo->cbstgmedData = This->post_data_len;
246 pbindinfo->stgmedData.pUnkForRelease = (IUnknown*)BINDSC(This);
247 IBindStatusCallback_AddRef(BINDSC(This));
253 static HRESULT WINAPI BindStatusCallback_OnDataAvailable(IBindStatusCallback *iface,
254 DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
256 BindStatusCallback *This = BINDSC_THIS(iface);
257 FIXME("(%p)->(%08x %d %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed);
261 static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallback *iface,
262 REFIID riid, IUnknown *punk)
264 BindStatusCallback *This = BINDSC_THIS(iface);
268 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), punk);
270 IUnknown_AddRef(punk);
271 This->doc_host->document = punk;
273 hres = IUnknown_QueryInterface(punk, &IID_IOleObject, (void**)&oleobj);
274 if(SUCCEEDED(hres)) {
277 hres = IOleObject_GetUserClassID(oleobj, &clsid);
279 TRACE("Got clsid %s\n",
280 IsEqualGUID(&clsid, &CLSID_HTMLDocument) ? "CLSID_HTMLDocument" : debugstr_guid(&clsid));
282 hres = IOleObject_SetClientSite(oleobj, CLIENTSITE(This->doc_host));
284 FIXME("SetClientSite failed: %08x\n", hres);
286 /* FIXME: Call SetAdvise */
287 /* FIXME: Call Invoke(DISPID_READYSTATE) */
289 FIXME("Could not get IOleObject iface: %08x\n", hres);
292 PostMessageW(This->doc_host->hwnd, WB_WM_NAVIGATE2, 0, 0);
299 static const IBindStatusCallbackVtbl BindStatusCallbackVtbl = {
300 BindStatusCallback_QueryInterface,
301 BindStatusCallback_AddRef,
302 BindStatusCallback_Release,
303 BindStatusCallback_OnStartBinding,
304 BindStatusCallback_GetPriority,
305 BindStatusCallback_OnLowResource,
306 BindStatusCallback_OnProgress,
307 BindStatusCallback_OnStopBinding,
308 BindStatusCallback_GetBindInfo,
309 BindStatusCallback_OnDataAvailable,
310 BindStatusCallback_OnObjectAvailable
313 #define HTTPNEG_THIS(iface) DEFINE_THIS(BindStatusCallback, HttpNegotiate, iface)
315 static HRESULT WINAPI HttpNegotiate_QueryInterface(IHttpNegotiate *iface,
316 REFIID riid, void **ppv)
318 BindStatusCallback *This = HTTPNEG_THIS(iface);
319 return IBindStatusCallback_QueryInterface(BINDSC(This), riid, ppv);
322 static ULONG WINAPI HttpNegotiate_AddRef(IHttpNegotiate *iface)
324 BindStatusCallback *This = HTTPNEG_THIS(iface);
325 return IBindStatusCallback_AddRef(BINDSC(This));
328 static ULONG WINAPI HttpNegotiate_Release(IHttpNegotiate *iface)
330 BindStatusCallback *This = HTTPNEG_THIS(iface);
331 return IBindStatusCallback_Release(BINDSC(This));
334 static HRESULT WINAPI HttpNegotiate_BeginningTransaction(IHttpNegotiate *iface,
335 LPCWSTR szURL, LPCWSTR szHeaders, DWORD dwReserved, LPWSTR *pszAdditionalHeaders)
337 BindStatusCallback *This = HTTPNEG_THIS(iface);
339 FIXME("(%p)->(%s %s %d %p)\n", This, debugstr_w(szURL), debugstr_w(szHeaders),
340 dwReserved, pszAdditionalHeaders);
343 int size = (strlenW(This->headers)+1)*sizeof(WCHAR);
344 *pszAdditionalHeaders = CoTaskMemAlloc(size);
345 memcpy(*pszAdditionalHeaders, This->headers, size);
351 static HRESULT WINAPI HttpNegotiate_OnResponse(IHttpNegotiate *iface,
352 DWORD dwResponseCode, LPCWSTR szResponseHeaders, LPCWSTR szRequestHeaders,
353 LPWSTR *pszAdditionalRequestHeaders)
355 BindStatusCallback *This = HTTPNEG_THIS(iface);
356 FIXME("(%p)->(%d %s %s %p)\n", This, dwResponseCode, debugstr_w(szResponseHeaders),
357 debugstr_w(szRequestHeaders), pszAdditionalRequestHeaders);
363 static const IHttpNegotiateVtbl HttpNegotiateVtbl = {
364 HttpNegotiate_QueryInterface,
365 HttpNegotiate_AddRef,
366 HttpNegotiate_Release,
367 HttpNegotiate_BeginningTransaction,
368 HttpNegotiate_OnResponse
371 static IBindStatusCallback *create_callback(DocHost *doc_host, PBYTE post_data,
372 ULONG post_data_len, LPWSTR headers)
374 BindStatusCallback *ret = heap_alloc(sizeof(BindStatusCallback));
376 ret->lpBindStatusCallbackVtbl = &BindStatusCallbackVtbl;
377 ret->lpHttpNegotiateVtbl = &HttpNegotiateVtbl;
380 ret->post_data = NULL;
381 ret->post_data_len = post_data_len;
384 ret->doc_host = doc_host;
385 IOleClientSite_AddRef(CLIENTSITE(doc_host));
388 ret->post_data = GlobalAlloc(0, post_data_len);
389 memcpy(ret->post_data, post_data, post_data_len);
393 int size = (strlenW(headers)+1)*sizeof(WCHAR);
394 ret->headers = heap_alloc(size);
395 memcpy(ret->headers, headers, size);
401 static void on_before_navigate2(DocHost *This, LPCWSTR url, const BYTE *post_data,
402 ULONG post_data_len, LPWSTR headers, VARIANT_BOOL *cancel)
404 VARIANT var_url, var_flags, var_frame_name, var_post_data, var_post_data2, var_headers;
405 DISPPARAMS dispparams;
406 VARIANTARG params[7];
408 dispparams.cArgs = 7;
409 dispparams.cNamedArgs = 0;
410 dispparams.rgdispidNamedArgs = NULL;
411 dispparams.rgvarg = params;
413 V_VT(params) = VT_BOOL|VT_BYREF;
414 V_BOOLREF(params) = cancel;
416 V_VT(params+1) = (VT_BYREF|VT_VARIANT);
417 V_VARIANTREF(params+1) = &var_headers;
418 V_VT(&var_headers) = VT_BSTR;
419 V_BSTR(&var_headers) = headers;
421 V_VT(params+2) = (VT_BYREF|VT_VARIANT);
422 V_VARIANTREF(params+2) = &var_post_data2;
423 V_VT(&var_post_data2) = (VT_BYREF|VT_VARIANT);
424 V_VARIANTREF(&var_post_data2) = &var_post_data;
425 VariantInit(&var_post_data);
428 SAFEARRAYBOUND bound = {post_data_len, 0};
431 V_VT(&var_post_data) = VT_UI1|VT_ARRAY;
432 V_ARRAY(&var_post_data) = SafeArrayCreate(VT_UI1, 1, &bound);
434 SafeArrayAccessData(V_ARRAY(&var_post_data), &data);
435 memcpy(data, post_data, post_data_len);
436 SafeArrayUnaccessData(V_ARRAY(&var_post_data));
439 V_VT(params+3) = (VT_BYREF|VT_VARIANT);
440 V_VARIANTREF(params+3) = &var_frame_name;
441 V_VT(&var_frame_name) = VT_BSTR;
442 V_BSTR(&var_frame_name) = NULL;
444 V_VT(params+4) = (VT_BYREF|VT_VARIANT);
445 V_VARIANTREF(params+4) = &var_flags;
446 V_VT(&var_flags) = VT_I4;
447 V_I4(&var_flags) = 0;
449 V_VT(params+5) = (VT_BYREF|VT_VARIANT);
450 V_VARIANTREF(params+5) = &var_url;
451 V_VT(&var_url) = VT_BSTR;
452 V_BSTR(&var_url) = SysAllocString(url);
454 V_VT(params+6) = (VT_DISPATCH);
455 V_DISPATCH(params+6) = This->disp;
457 call_sink(This->cps.wbe2, DISPID_BEFORENAVIGATE2, &dispparams);
459 SysFreeString(V_BSTR(&var_url));
461 SafeArrayDestroy(V_ARRAY(&var_post_data));
464 static BOOL try_application_url(LPCWSTR url)
466 SHELLEXECUTEINFOW exec_info;
472 static const WCHAR wszURLProtocol[] = {'U','R','L',' ','P','r','o','t','o','c','o','l',0};
474 hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, app, sizeof(app)/sizeof(WCHAR), NULL, 0);
478 res = RegOpenKeyW(HKEY_CLASSES_ROOT, app, &hkey);
479 if(res != ERROR_SUCCESS)
482 res = RegQueryValueExW(hkey, wszURLProtocol, NULL, &type, NULL, NULL);
484 if(res != ERROR_SUCCESS || type != REG_SZ)
487 TRACE("openning application %s\n", debugstr_w(app));
489 memset(&exec_info, 0, sizeof(exec_info));
490 exec_info.cbSize = sizeof(exec_info);
491 exec_info.lpFile = url;
492 exec_info.nShow = SW_SHOW;
494 return ShellExecuteExW(&exec_info);
497 static HRESULT http_load_hack(DocHost *This, IMoniker *mon, IBindStatusCallback *callback, IBindCtx *bindctx)
499 IPersistMoniker *persist;
505 * We should use URLMoniker's BindToObject instead creating HTMLDocument here.
506 * This should be fixed when mshtml.dll and urlmon.dll will be good enough.
509 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL,
510 CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
511 &IID_IUnknown, (void**)&doc);
514 ERR("Could not create HTMLDocument: %08x\n", hres);
518 hres = IUnknown_QueryInterface(doc, &IID_IPersistMoniker, (void**)&persist);
520 IUnknown_Release(doc);
524 hres = IPersistMoniker_Load(persist, FALSE, mon, bindctx, 0);
525 IPersistMoniker_Release(persist);
528 hres = IBindStatusCallback_OnObjectAvailable(callback, &IID_IUnknown, doc);
530 WARN("Load failed: %08x\n", hres);
532 IUnknown_Release(doc);
534 return IBindStatusCallback_OnStopBinding(callback, hres, NULL);
537 static HRESULT bind_to_object(DocHost *This, IMoniker *mon, LPCWSTR url, IBindCtx *bindctx,
538 IBindStatusCallback *callback)
544 static const WCHAR httpW[] = {'h','t','t','p',0};
545 static const WCHAR httpsW[] = {'h','t','t','p','s',0};
546 static const WCHAR ftpW[]= {'f','t','p',0};
548 IBindCtx_RegisterObjectParam(bindctx, (LPOLESTR)SZ_HTML_CLIENTSITE_OBJECTPARAM,
549 (IUnknown*)CLIENTSITE(This));
552 IOleInPlaceFrame_EnableModeless(This->frame, FALSE);
554 hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, schema, sizeof(schema)/sizeof(schema[0]),
556 if(SUCCEEDED(hres) &&
557 (!strcmpW(schema, httpW) || !strcmpW(schema, httpsW) || !strcmpW(schema, ftpW))) {
558 hres = http_load_hack(This, mon, callback, bindctx);
560 IUnknown *unk = NULL;
562 hres = IMoniker_BindToObject(mon, bindctx, NULL, &IID_IUnknown, (void**)&unk);
563 if(SUCCEEDED(hres)) {
566 IUnknown_Release(unk);
568 FIXME("BindToObject failed: %08x\n", hres);
573 IOleInPlaceFrame_EnableModeless(This->frame, TRUE);
578 static HRESULT navigate_mon(DocHost *This, IMoniker *mon, PBYTE post_data, ULONG post_data_len,
581 IBindStatusCallback *callback;
583 VARIANT_BOOL cancel = VARIANT_FALSE;
587 IMoniker_GetDisplayName(mon, NULL, NULL, &url);
588 TRACE("navigating to %s\n", debugstr_w(url));
590 on_before_navigate2(This, url, post_data, post_data_len, headers, &cancel);
592 FIXME("Navigation canceled\n");
598 deactivate_document(This);
599 CoTaskMemFree(This->url);
602 callback = create_callback(This, post_data, post_data_len, (LPWSTR)headers);
603 CreateAsyncBindCtx(0, callback, 0, &bindctx);
605 hres = bind_to_object(This, mon, This->url, bindctx, callback);
607 IBindStatusCallback_Release(callback);
608 IBindCtx_Release(bindctx);
613 HRESULT navigate_url(DocHost *This, LPCWSTR url, const VARIANT *Flags,
614 const VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
617 PBYTE post_data = NULL;
618 ULONG post_data_len = 0;
619 LPWSTR headers = NULL;
622 TRACE("navigating to %s\n", debugstr_w(url));
624 hres = CreateURLMoniker(NULL, url, &mon);
626 WARN("CreateURLMoniker failed: %08x\n", hres);
630 if((Flags && V_VT(Flags) != VT_EMPTY)
631 || (TargetFrameName && V_VT(TargetFrameName) != VT_EMPTY))
632 FIXME("Unsupported args (Flags %p:%d; TargetFrameName %p:%d)\n",
633 Flags, Flags ? V_VT(Flags) : -1, TargetFrameName,
634 TargetFrameName ? V_VT(TargetFrameName) : -1);
637 TRACE("PostData vt=%d\n", V_VT(PostData));
639 if(V_VT(PostData) == (VT_ARRAY | VT_UI1)) {
640 SafeArrayAccessData(V_ARRAY(PostData), (void**)&post_data);
641 post_data_len = V_ARRAY(PostData)->rgsabound[0].cElements;
645 if(Headers && V_VT(Headers) != VT_EMPTY && V_VT(Headers) != VT_ERROR) {
646 if(V_VT(Headers) != VT_BSTR)
649 headers = V_BSTR(Headers);
650 TRACE("Headers: %s\n", debugstr_w(headers));
654 create_doc_view_hwnd(This);
656 hres = navigate_mon(This, mon, post_data, post_data_len, headers);
658 IMoniker_Release(mon);
660 SafeArrayUnaccessData(V_ARRAY(PostData));
665 static HRESULT navigate_hlink(DocHost *This, IMoniker *mon, IBindCtx *bindctx,
666 IBindStatusCallback *callback)
668 IHttpNegotiate *http_negotiate;
670 PBYTE post_data = NULL;
671 ULONG post_data_len = 0;
672 LPWSTR headers = NULL;
677 IMoniker_GetDisplayName(mon, NULL, NULL, &url);
678 TRACE("navigating to %s\n", debugstr_w(url));
680 hres = IBindStatusCallback_QueryInterface(callback, &IID_IHttpNegotiate,
681 (void**)&http_negotiate);
682 if(SUCCEEDED(hres)) {
683 static const WCHAR null_string[] = {0};
685 IHttpNegotiate_BeginningTransaction(http_negotiate, null_string, null_string, 0,
687 IHttpNegotiate_Release(http_negotiate);
690 memset(&bindinfo, 0, sizeof(bindinfo));
691 bindinfo.cbSize = sizeof(bindinfo);
693 hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
694 dump_BINDINFO(&bindinfo);
695 if(bindinfo.dwBindVerb == BINDVERB_POST) {
696 post_data_len = bindinfo.cbstgmedData;
698 post_data = bindinfo.stgmedData.u.hGlobal;
701 /* FIXME: We should do it after BindToObject call */
702 if(try_application_url(url)) {
707 hres = navigate_mon(This, mon, post_data, post_data_len, headers);
710 CoTaskMemFree(headers);
711 ReleaseBindInfo(&bindinfo);
716 HRESULT go_home(DocHost *This)
718 static const WCHAR wszAboutBlank[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
722 return navigate_url(This, wszAboutBlank, NULL, NULL, NULL, NULL);
725 #define HLINKFRAME_THIS(iface) DEFINE_THIS(WebBrowser, HlinkFrame, iface)
727 static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv)
729 WebBrowser *This = HLINKFRAME_THIS(iface);
730 return IWebBrowser2_QueryInterface(WEBBROWSER2(This), riid, ppv);
733 static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface)
735 WebBrowser *This = HLINKFRAME_THIS(iface);
736 return IWebBrowser2_AddRef(WEBBROWSER2(This));
739 static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface)
741 WebBrowser *This = HLINKFRAME_THIS(iface);
742 return IWebBrowser2_Release(WEBBROWSER2(This));
745 static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface,
746 IHlinkBrowseContext *pihlbc)
748 WebBrowser *This = HLINKFRAME_THIS(iface);
749 FIXME("(%p)->(%p)\n", This, pihlbc);
753 static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface,
754 IHlinkBrowseContext **ppihlbc)
756 WebBrowser *This = HLINKFRAME_THIS(iface);
757 FIXME("(%p)->(%p)\n", This, ppihlbc);
761 static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc,
762 IBindStatusCallback *pibsc, IHlink *pihlNavigate)
764 WebBrowser *This = HLINKFRAME_THIS(iface);
766 LPWSTR location = NULL;
768 TRACE("(%p)->(%08x %p %p %p)\n", This, grfHLNF, pbc, pibsc, pihlNavigate);
771 FIXME("unsupported grfHLNF=%08x\n", grfHLNF);
773 /* Windows calls GetTargetFrameName here. */
775 IHlink_GetMonikerReference(pihlNavigate, 1, &mon, &location);
778 FIXME("location = %s\n", debugstr_w(location));
779 CoTaskMemFree(location);
782 /* Windows calls GetHlinkSite here */
784 if(grfHLNF & HLNF_OPENINNEWWINDOW) {
785 FIXME("Not supported HLNF_OPENINNEWWINDOW\n");
789 return navigate_hlink(&This->doc_host, mon, pbc, pibsc);
792 static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF,
793 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved)
795 WebBrowser *This = HLINKFRAME_THIS(iface);
796 FIXME("(%p)->(%08x %p %s %s %d)\n", This, grfHLNF, pimkTarget, debugstr_w(pwzLocation),
797 debugstr_w(pwzFriendlyName), dwreserved);
801 static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID,
802 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
804 WebBrowser *This = HLINKFRAME_THIS(iface);
805 FIXME("(%p)->(%u %p %s %s)\n", This, uHLID, pimkTarget, debugstr_w(pwzLocation),
806 debugstr_w(pwzFriendlyName));
810 #undef HLINKFRAME_THIS
812 static const IHlinkFrameVtbl HlinkFrameVtbl = {
813 HlinkFrame_QueryInterface,
816 HlinkFrame_SetBrowseContext,
817 HlinkFrame_GetBrowseContext,
819 HlinkFrame_OnNavigate,
820 HlinkFrame_UpdateHlink
823 void WebBrowser_HlinkFrame_Init(WebBrowser *This)
825 This->lpHlinkFrameVtbl = &HlinkFrameVtbl;