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"
31 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
33 static const WCHAR emptyW[] = {0};
36 const IBindStatusCallbackVtbl *lpBindStatusCallbackVtbl;
37 const IHttpNegotiateVtbl *lpHttpNegotiateVtbl;
49 #define BINDSC(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
50 #define HTTPNEG(x) ((IHttpNegotiate*) &(x)->lpHttpNegotiateVtbl)
52 static void dump_BINDINFO(BINDINFO *bi)
54 static const char * const BINDINFOF_str[] = {
56 "BINDINFOF_URLENCODESTGMEDDATA",
57 "BINDINFOF_URLENCODEDEXTRAINFO"
60 static const char * const BINDVERB_str[] = {
80 bi->cbSize, debugstr_w(bi->szExtraInfo),
81 bi->stgmedData.tymed, bi->stgmedData.u.hGlobal, bi->stgmedData.pUnkForRelease,
82 bi->grfBindInfoF > BINDINFOF_URLENCODEDEXTRAINFO
83 ? "unknown" : BINDINFOF_str[bi->grfBindInfoF],
84 bi->dwBindVerb > BINDVERB_CUSTOM
85 ? "unknown" : BINDVERB_str[bi->dwBindVerb],
86 debugstr_w(bi->szCustomVerb),
87 bi->cbstgmedData, bi->dwOptions, bi->dwOptionsFlags, bi->dwCodePage,
88 bi->securityAttributes.nLength,
89 bi->securityAttributes.lpSecurityDescriptor,
90 bi->securityAttributes.bInheritHandle,
91 debugstr_guid(&bi->iid),
92 bi->pUnk, bi->dwReserved
96 static void set_status_text(BindStatusCallback *This, LPCWSTR str)
99 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
104 V_VT(&arg) = VT_BSTR;
105 V_BSTR(&arg) = str ? SysAllocString(str) : NULL;
106 call_sink(This->doc_host->cps.wbe2, DISPID_STATUSTEXTCHANGE, &dispparams);
109 if(This->doc_host->frame)
110 IOleInPlaceFrame_SetStatusText(This->doc_host->frame, str);
113 #define BINDSC_THIS(iface) DEFINE_THIS(BindStatusCallback, BindStatusCallback, iface)
115 static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallback *iface,
116 REFIID riid, void **ppv)
118 BindStatusCallback *This = BINDSC_THIS(iface);
122 if(IsEqualGUID(&IID_IUnknown, riid)) {
123 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
125 }else if(IsEqualGUID(&IID_IBindStatusCallback, riid)) {
126 TRACE("(%p)->(IID_IBindStatusCallback %p)\n", This, ppv);
128 }else if(IsEqualGUID(&IID_IHttpNegotiate, riid)) {
129 TRACE("(%p)->(IID_IHttpNegotiate %p)\n", This, ppv);
130 *ppv = HTTPNEG(This);
134 IBindStatusCallback_AddRef(BINDSC(This));
138 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
139 return E_NOINTERFACE;
142 static ULONG WINAPI BindStatusCallback_AddRef(IBindStatusCallback *iface)
144 BindStatusCallback *This = BINDSC_THIS(iface);
145 LONG ref = InterlockedIncrement(&This->ref);
147 TRACE("(%p) ref=%d\n", This, ref);
152 static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface)
154 BindStatusCallback *This = BINDSC_THIS(iface);
155 LONG ref = InterlockedDecrement(&This->ref);
157 TRACE("(%p) ref=%d\n", This, ref);
161 IOleClientSite_Release(CLIENTSITE(This->doc_host));
163 GlobalFree(This->post_data);
164 SysFreeString(This->headers);
165 heap_free(This->url);
172 static HRESULT WINAPI BindStatusCallback_OnStartBinding(IBindStatusCallback *iface,
173 DWORD dwReserved, IBinding *pbind)
175 BindStatusCallback *This = BINDSC_THIS(iface);
177 TRACE("(%p)->(%d %p)\n", This, dwReserved, pbind);
182 static HRESULT WINAPI BindStatusCallback_GetPriority(IBindStatusCallback *iface,
185 BindStatusCallback *This = BINDSC_THIS(iface);
186 FIXME("(%p)->(%p)\n", This, pnPriority);
190 static HRESULT WINAPI BindStatusCallback_OnLowResource(IBindStatusCallback *iface,
193 BindStatusCallback *This = BINDSC_THIS(iface);
194 FIXME("(%p)->(%d)\n", This, reserved);
198 static HRESULT WINAPI BindStatusCallback_OnProgress(IBindStatusCallback *iface,
199 ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
201 BindStatusCallback *This = BINDSC_THIS(iface);
203 TRACE("(%p)->(%d %d %d %s)\n", This, ulProgress, ulProgressMax, ulStatusCode,
204 debugstr_w(szStatusText));
206 switch(ulStatusCode) {
207 case BINDSTATUS_BEGINDOWNLOADDATA:
208 set_status_text(This, szStatusText); /* FIXME: "Start downloading from site: %s" */
210 case BINDSTATUS_ENDDOWNLOADDATA:
211 set_status_text(This, szStatusText); /* FIXME: "Downloading from site: %s" */
213 case BINDSTATUS_CLASSIDAVAILABLE:
214 case BINDSTATUS_MIMETYPEAVAILABLE:
215 case BINDSTATUS_BEGINSYNCOPERATION:
216 case BINDSTATUS_ENDSYNCOPERATION:
219 FIXME("status code %u\n", ulStatusCode);
225 static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *iface,
226 HRESULT hresult, LPCWSTR szError)
228 BindStatusCallback *This = BINDSC_THIS(iface);
230 TRACE("(%p)->(%08x %s)\n", This, hresult, debugstr_w(szError));
232 set_status_text(This, emptyW);
235 IOleClientSite_Release(CLIENTSITE(This->doc_host));
236 This->doc_host = NULL;
242 static HRESULT WINAPI BindStatusCallback_GetBindInfo(IBindStatusCallback *iface,
243 DWORD *grfBINDF, BINDINFO *pbindinfo)
245 BindStatusCallback *This = BINDSC_THIS(iface);
247 TRACE("(%p)->(%p %p)\n", This, grfBINDF, pbindinfo);
249 *grfBINDF = BINDF_ASYNCHRONOUS;
251 if(This->post_data) {
252 pbindinfo->dwBindVerb = BINDVERB_POST;
254 pbindinfo->stgmedData.tymed = TYMED_HGLOBAL;
255 pbindinfo->stgmedData.u.hGlobal = This->post_data;
256 pbindinfo->cbstgmedData = This->post_data_len;
257 pbindinfo->stgmedData.pUnkForRelease = (IUnknown*)BINDSC(This);
258 IBindStatusCallback_AddRef(BINDSC(This));
264 static HRESULT WINAPI BindStatusCallback_OnDataAvailable(IBindStatusCallback *iface,
265 DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
267 BindStatusCallback *This = BINDSC_THIS(iface);
268 FIXME("(%p)->(%08x %d %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed);
272 static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallback *iface,
273 REFIID riid, IUnknown *punk)
275 BindStatusCallback *This = BINDSC_THIS(iface);
277 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), punk);
279 return dochost_object_available(This->doc_host, punk);
284 static const IBindStatusCallbackVtbl BindStatusCallbackVtbl = {
285 BindStatusCallback_QueryInterface,
286 BindStatusCallback_AddRef,
287 BindStatusCallback_Release,
288 BindStatusCallback_OnStartBinding,
289 BindStatusCallback_GetPriority,
290 BindStatusCallback_OnLowResource,
291 BindStatusCallback_OnProgress,
292 BindStatusCallback_OnStopBinding,
293 BindStatusCallback_GetBindInfo,
294 BindStatusCallback_OnDataAvailable,
295 BindStatusCallback_OnObjectAvailable
298 #define HTTPNEG_THIS(iface) DEFINE_THIS(BindStatusCallback, HttpNegotiate, iface)
300 static HRESULT WINAPI HttpNegotiate_QueryInterface(IHttpNegotiate *iface,
301 REFIID riid, void **ppv)
303 BindStatusCallback *This = HTTPNEG_THIS(iface);
304 return IBindStatusCallback_QueryInterface(BINDSC(This), riid, ppv);
307 static ULONG WINAPI HttpNegotiate_AddRef(IHttpNegotiate *iface)
309 BindStatusCallback *This = HTTPNEG_THIS(iface);
310 return IBindStatusCallback_AddRef(BINDSC(This));
313 static ULONG WINAPI HttpNegotiate_Release(IHttpNegotiate *iface)
315 BindStatusCallback *This = HTTPNEG_THIS(iface);
316 return IBindStatusCallback_Release(BINDSC(This));
319 static HRESULT WINAPI HttpNegotiate_BeginningTransaction(IHttpNegotiate *iface,
320 LPCWSTR szURL, LPCWSTR szHeaders, DWORD dwReserved, LPWSTR *pszAdditionalHeaders)
322 BindStatusCallback *This = HTTPNEG_THIS(iface);
324 TRACE("(%p)->(%s %s %d %p)\n", This, debugstr_w(szURL), debugstr_w(szHeaders),
325 dwReserved, pszAdditionalHeaders);
328 int size = (strlenW(This->headers)+1)*sizeof(WCHAR);
329 *pszAdditionalHeaders = CoTaskMemAlloc(size);
330 memcpy(*pszAdditionalHeaders, This->headers, size);
336 static HRESULT WINAPI HttpNegotiate_OnResponse(IHttpNegotiate *iface,
337 DWORD dwResponseCode, LPCWSTR szResponseHeaders, LPCWSTR szRequestHeaders,
338 LPWSTR *pszAdditionalRequestHeaders)
340 BindStatusCallback *This = HTTPNEG_THIS(iface);
341 TRACE("(%p)->(%d %s %s %p)\n", This, dwResponseCode, debugstr_w(szResponseHeaders),
342 debugstr_w(szRequestHeaders), pszAdditionalRequestHeaders);
348 static const IHttpNegotiateVtbl HttpNegotiateVtbl = {
349 HttpNegotiate_QueryInterface,
350 HttpNegotiate_AddRef,
351 HttpNegotiate_Release,
352 HttpNegotiate_BeginningTransaction,
353 HttpNegotiate_OnResponse
356 static BindStatusCallback *create_callback(DocHost *doc_host, LPCWSTR url, PBYTE post_data,
357 ULONG post_data_len, LPCWSTR headers)
359 BindStatusCallback *ret = heap_alloc(sizeof(BindStatusCallback));
361 ret->lpBindStatusCallbackVtbl = &BindStatusCallbackVtbl;
362 ret->lpHttpNegotiateVtbl = &HttpNegotiateVtbl;
365 ret->url = heap_strdupW(url);
366 ret->post_data = NULL;
367 ret->post_data_len = post_data_len;
368 ret->headers = headers ? SysAllocString(headers) : NULL;
370 ret->doc_host = doc_host;
371 IOleClientSite_AddRef(CLIENTSITE(doc_host));
374 ret->post_data = GlobalAlloc(0, post_data_len);
375 memcpy(ret->post_data, post_data, post_data_len);
381 static void on_before_navigate2(DocHost *This, LPCWSTR url, const BYTE *post_data,
382 ULONG post_data_len, LPWSTR headers, VARIANT_BOOL *cancel)
384 VARIANT var_url, var_flags, var_frame_name, var_post_data, var_post_data2, var_headers;
385 DISPPARAMS dispparams;
386 VARIANTARG params[7];
388 dispparams.cArgs = 7;
389 dispparams.cNamedArgs = 0;
390 dispparams.rgdispidNamedArgs = NULL;
391 dispparams.rgvarg = params;
393 This->busy = VARIANT_TRUE;
395 V_VT(params) = VT_BOOL|VT_BYREF;
396 V_BOOLREF(params) = cancel;
398 V_VT(params+1) = (VT_BYREF|VT_VARIANT);
399 V_VARIANTREF(params+1) = &var_headers;
400 V_VT(&var_headers) = VT_BSTR;
401 V_BSTR(&var_headers) = headers;
403 V_VT(params+2) = (VT_BYREF|VT_VARIANT);
404 V_VARIANTREF(params+2) = &var_post_data2;
405 V_VT(&var_post_data2) = (VT_BYREF|VT_VARIANT);
406 V_VARIANTREF(&var_post_data2) = &var_post_data;
407 VariantInit(&var_post_data);
410 SAFEARRAYBOUND bound = {post_data_len, 0};
413 V_VT(&var_post_data) = VT_UI1|VT_ARRAY;
414 V_ARRAY(&var_post_data) = SafeArrayCreate(VT_UI1, 1, &bound);
416 SafeArrayAccessData(V_ARRAY(&var_post_data), &data);
417 memcpy(data, post_data, post_data_len);
418 SafeArrayUnaccessData(V_ARRAY(&var_post_data));
421 V_VT(params+3) = (VT_BYREF|VT_VARIANT);
422 V_VARIANTREF(params+3) = &var_frame_name;
423 V_VT(&var_frame_name) = VT_BSTR;
424 V_BSTR(&var_frame_name) = NULL;
426 V_VT(params+4) = (VT_BYREF|VT_VARIANT);
427 V_VARIANTREF(params+4) = &var_flags;
428 V_VT(&var_flags) = VT_I4;
429 V_I4(&var_flags) = 0;
431 V_VT(params+5) = (VT_BYREF|VT_VARIANT);
432 V_VARIANTREF(params+5) = &var_url;
433 V_VT(&var_url) = VT_BSTR;
434 V_BSTR(&var_url) = SysAllocString(url);
436 V_VT(params+6) = (VT_DISPATCH);
437 V_DISPATCH(params+6) = This->disp;
439 call_sink(This->cps.wbe2, DISPID_BEFORENAVIGATE2, &dispparams);
441 SysFreeString(V_BSTR(&var_url));
443 SafeArrayDestroy(V_ARRAY(&var_post_data));
446 /* FIXME: urlmon should handle it */
447 static BOOL try_application_url(LPCWSTR url)
449 SHELLEXECUTEINFOW exec_info;
455 static const WCHAR wszURLProtocol[] = {'U','R','L',' ','P','r','o','t','o','c','o','l',0};
457 hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, app, sizeof(app)/sizeof(WCHAR), NULL, 0);
461 res = RegOpenKeyW(HKEY_CLASSES_ROOT, app, &hkey);
462 if(res != ERROR_SUCCESS)
465 res = RegQueryValueExW(hkey, wszURLProtocol, NULL, &type, NULL, NULL);
467 if(res != ERROR_SUCCESS || type != REG_SZ)
470 TRACE("openning application %s\n", debugstr_w(app));
472 memset(&exec_info, 0, sizeof(exec_info));
473 exec_info.cbSize = sizeof(exec_info);
474 exec_info.lpFile = url;
475 exec_info.nShow = SW_SHOW;
477 return ShellExecuteExW(&exec_info);
480 static HRESULT create_moniker(LPCWSTR url, IMoniker **mon)
482 WCHAR new_url[INTERNET_MAX_URL_LENGTH];
487 return CreateURLMoniker(NULL, url, mon);
490 size = sizeof(new_url);
491 hres = UrlCreateFromPathW(url, new_url, &size, 0);
493 WARN("UrlCreateFromPathW failed: %08x\n", hres);
497 size = sizeof(new_url);
498 hres = UrlApplySchemeW(url, new_url, &size, URL_APPLY_GUESSSCHEME);
499 TRACE("got %s\n", debugstr_w(new_url));
501 WARN("UrlApplyScheme failed: %08x\n", hres);
506 return CreateURLMoniker(NULL, new_url, mon);
509 static HRESULT bind_to_object(DocHost *This, IMoniker *mon, LPCWSTR url, IBindCtx *bindctx,
510 IBindStatusCallback *callback)
512 IUnknown *unk = NULL;
516 IMoniker_AddRef(mon);
518 hres = create_moniker(url, &mon);
523 CoTaskMemFree(This->url);
524 hres = IMoniker_GetDisplayName(mon, 0, NULL, &This->url);
526 FIXME("GetDisplayName failed: %08x\n", hres);
528 IBindCtx_RegisterObjectParam(bindctx, (LPOLESTR)SZ_HTML_CLIENTSITE_OBJECTPARAM,
529 (IUnknown*)CLIENTSITE(This));
531 hres = IMoniker_BindToObject(mon, bindctx, NULL, &IID_IUnknown, (void**)&unk);
532 if(SUCCEEDED(hres)) {
535 IUnknown_Release(unk);
536 }else if(try_application_url(url)) {
539 FIXME("BindToObject failed: %08x\n", hres);
542 IMoniker_Release(mon);
546 static HRESULT navigate_bsc(DocHost *This, BindStatusCallback *bsc, IMoniker *mon)
549 VARIANT_BOOL cancel = VARIANT_FALSE;
552 This->ready_state = READYSTATE_LOADING;
554 on_before_navigate2(This, bsc->url, bsc->post_data, bsc->post_data_len, bsc->headers, &cancel);
556 FIXME("Navigation canceled\n");
561 deactivate_document(This);
563 CreateAsyncBindCtx(0, BINDSC(bsc), 0, &bindctx);
566 IOleInPlaceFrame_EnableModeless(This->frame, FALSE);
568 hres = bind_to_object(This, mon, bsc->url, bindctx, BINDSC(bsc));
571 IOleInPlaceFrame_EnableModeless(This->frame, TRUE);
573 IBindCtx_Release(bindctx);
579 task_header_t header;
580 BindStatusCallback *bsc;
581 } task_navigate_bsc_t;
583 static void navigate_bsc_proc(DocHost *This, task_header_t *t)
585 task_navigate_bsc_t *task = (task_navigate_bsc_t*)t;
588 create_doc_view_hwnd(This);
590 navigate_bsc(This, task->bsc, NULL);
592 IBindStatusCallback_Release(BINDSC(task->bsc));
596 HRESULT navigate_url(DocHost *This, LPCWSTR url, const VARIANT *Flags,
597 const VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
599 task_navigate_bsc_t *task;
600 PBYTE post_data = NULL;
601 ULONG post_data_len = 0;
602 LPWSTR headers = NULL;
604 TRACE("navigating to %s\n", debugstr_w(url));
606 if((Flags && V_VT(Flags) != VT_EMPTY)
607 || (TargetFrameName && V_VT(TargetFrameName) != VT_EMPTY))
608 FIXME("Unsupported args (Flags %p:%d; TargetFrameName %p:%d)\n",
609 Flags, Flags ? V_VT(Flags) : -1, TargetFrameName,
610 TargetFrameName ? V_VT(TargetFrameName) : -1);
613 TRACE("PostData vt=%d\n", V_VT(PostData));
615 if(V_VT(PostData) == (VT_ARRAY | VT_UI1)) {
616 SafeArrayAccessData(V_ARRAY(PostData), (void**)&post_data);
617 post_data_len = V_ARRAY(PostData)->rgsabound[0].cElements;
621 if(Headers && V_VT(Headers) != VT_EMPTY && V_VT(Headers) != VT_ERROR) {
622 if(V_VT(Headers) != VT_BSTR)
625 headers = V_BSTR(Headers);
626 TRACE("Headers: %s\n", debugstr_w(headers));
629 task = heap_alloc(sizeof(*task));
630 task->bsc = create_callback(This, url, post_data, post_data_len, headers);
633 SafeArrayUnaccessData(V_ARRAY(PostData));
635 push_dochost_task(This, &task->header, navigate_bsc_proc, This->url == NULL);
640 static HRESULT navigate_hlink(DocHost *This, IMoniker *mon, IBindCtx *bindctx,
641 IBindStatusCallback *callback)
643 IHttpNegotiate *http_negotiate;
644 BindStatusCallback *bsc;
645 PBYTE post_data = NULL;
646 ULONG post_data_len = 0;
647 LPWSTR headers = NULL, url;
652 hres = IBindStatusCallback_QueryInterface(callback, &IID_IHttpNegotiate,
653 (void**)&http_negotiate);
654 if(SUCCEEDED(hres)) {
655 static const WCHAR null_string[] = {0};
657 IHttpNegotiate_BeginningTransaction(http_negotiate, null_string, null_string, 0,
659 IHttpNegotiate_Release(http_negotiate);
662 memset(&bindinfo, 0, sizeof(bindinfo));
663 bindinfo.cbSize = sizeof(bindinfo);
665 hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
666 dump_BINDINFO(&bindinfo);
667 if(bindinfo.dwBindVerb == BINDVERB_POST) {
668 post_data_len = bindinfo.cbstgmedData;
670 post_data = bindinfo.stgmedData.u.hGlobal;
673 hres = IMoniker_GetDisplayName(mon, 0, NULL, &url);
675 FIXME("GetDisplayName failed: %08x\n", hres);
677 bsc = create_callback(This, url, post_data, post_data_len, headers);
680 hres = navigate_bsc(This, bsc, mon);
682 IBindStatusCallback_Release(BINDSC(bsc));
683 CoTaskMemFree(headers);
684 ReleaseBindInfo(&bindinfo);
689 HRESULT go_home(DocHost *This)
692 DWORD res, type, size;
693 WCHAR wszPageName[MAX_PATH];
694 static const WCHAR wszAboutBlank[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
695 static const WCHAR wszStartPage[] = {'S','t','a','r','t',' ','P','a','g','e',0};
696 static const WCHAR wszSubKey[] = {'S','o','f','t','w','a','r','e','\\',
697 'M','i','c','r','o','s','o','f','t','\\',
698 'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','\\',
701 res = RegOpenKeyW(HKEY_CURRENT_USER, wszSubKey, &hkey);
702 if (res != ERROR_SUCCESS)
703 return navigate_url(This, wszAboutBlank, NULL, NULL, NULL, NULL);
705 size = sizeof(wszPageName);
706 res = RegQueryValueExW(hkey, wszStartPage, NULL, &type, (LPBYTE)wszPageName, &size);
708 if (res != ERROR_SUCCESS || type != REG_SZ)
709 return navigate_url(This, wszAboutBlank, NULL, NULL, NULL, NULL);
711 return navigate_url(This, wszPageName, NULL, NULL, NULL, NULL);
714 #define HLINKFRAME_THIS(iface) DEFINE_THIS(WebBrowser, HlinkFrame, iface)
716 static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv)
718 WebBrowser *This = HLINKFRAME_THIS(iface);
719 return IWebBrowser2_QueryInterface(WEBBROWSER2(This), riid, ppv);
722 static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface)
724 WebBrowser *This = HLINKFRAME_THIS(iface);
725 return IWebBrowser2_AddRef(WEBBROWSER2(This));
728 static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface)
730 WebBrowser *This = HLINKFRAME_THIS(iface);
731 return IWebBrowser2_Release(WEBBROWSER2(This));
734 static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface,
735 IHlinkBrowseContext *pihlbc)
737 WebBrowser *This = HLINKFRAME_THIS(iface);
738 FIXME("(%p)->(%p)\n", This, pihlbc);
742 static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface,
743 IHlinkBrowseContext **ppihlbc)
745 WebBrowser *This = HLINKFRAME_THIS(iface);
746 FIXME("(%p)->(%p)\n", This, ppihlbc);
750 static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc,
751 IBindStatusCallback *pibsc, IHlink *pihlNavigate)
753 WebBrowser *This = HLINKFRAME_THIS(iface);
755 LPWSTR location = NULL;
757 TRACE("(%p)->(%08x %p %p %p)\n", This, grfHLNF, pbc, pibsc, pihlNavigate);
760 FIXME("unsupported grfHLNF=%08x\n", grfHLNF);
762 /* Windows calls GetTargetFrameName here. */
764 IHlink_GetMonikerReference(pihlNavigate, 1, &mon, &location);
767 FIXME("location = %s\n", debugstr_w(location));
768 CoTaskMemFree(location);
771 /* Windows calls GetHlinkSite here */
773 if(grfHLNF & HLNF_OPENINNEWWINDOW) {
774 FIXME("Not supported HLNF_OPENINNEWWINDOW\n");
778 return navigate_hlink(&This->doc_host, mon, pbc, pibsc);
781 static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF,
782 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved)
784 WebBrowser *This = HLINKFRAME_THIS(iface);
785 FIXME("(%p)->(%08x %p %s %s %d)\n", This, grfHLNF, pimkTarget, debugstr_w(pwzLocation),
786 debugstr_w(pwzFriendlyName), dwreserved);
790 static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID,
791 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
793 WebBrowser *This = HLINKFRAME_THIS(iface);
794 FIXME("(%p)->(%u %p %s %s)\n", This, uHLID, pimkTarget, debugstr_w(pwzLocation),
795 debugstr_w(pwzFriendlyName));
799 #undef HLINKFRAME_THIS
801 static const IHlinkFrameVtbl HlinkFrameVtbl = {
802 HlinkFrame_QueryInterface,
805 HlinkFrame_SetBrowseContext,
806 HlinkFrame_GetBrowseContext,
808 HlinkFrame_OnNavigate,
809 HlinkFrame_UpdateHlink
812 void WebBrowser_HlinkFrame_Init(WebBrowser *This)
814 This->lpHlinkFrameVtbl = &HlinkFrameVtbl;