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, SAFEARRAY *post_data, LPWSTR headers, VARIANT_BOOL *cancel)
383 VARIANT var_url, var_flags, var_frame_name, var_post_data, var_post_data2, var_headers;
384 DISPPARAMS dispparams;
385 VARIANTARG params[7];
387 dispparams.cArgs = 7;
388 dispparams.cNamedArgs = 0;
389 dispparams.rgdispidNamedArgs = NULL;
390 dispparams.rgvarg = params;
392 This->busy = VARIANT_TRUE;
394 V_VT(params) = VT_BOOL|VT_BYREF;
395 V_BOOLREF(params) = cancel;
397 V_VT(params+1) = (VT_BYREF|VT_VARIANT);
398 V_VARIANTREF(params+1) = &var_headers;
399 V_VT(&var_headers) = VT_BSTR;
400 V_BSTR(&var_headers) = headers;
402 V_VT(params+2) = (VT_BYREF|VT_VARIANT);
403 V_VARIANTREF(params+2) = &var_post_data2;
404 V_VT(&var_post_data2) = (VT_BYREF|VT_VARIANT);
405 V_VARIANTREF(&var_post_data2) = &var_post_data;
408 V_VT(&var_post_data) = VT_UI1|VT_ARRAY;
409 V_ARRAY(&var_post_data) = post_data;
411 V_VT(&var_post_data) = VT_EMPTY;
414 V_VT(params+3) = (VT_BYREF|VT_VARIANT);
415 V_VARIANTREF(params+3) = &var_frame_name;
416 V_VT(&var_frame_name) = VT_BSTR;
417 V_BSTR(&var_frame_name) = NULL;
419 V_VT(params+4) = (VT_BYREF|VT_VARIANT);
420 V_VARIANTREF(params+4) = &var_flags;
421 V_VT(&var_flags) = VT_I4;
422 V_I4(&var_flags) = 0;
424 V_VT(params+5) = (VT_BYREF|VT_VARIANT);
425 V_VARIANTREF(params+5) = &var_url;
426 V_VT(&var_url) = VT_BSTR;
427 V_BSTR(&var_url) = SysAllocString(url);
429 V_VT(params+6) = (VT_DISPATCH);
430 V_DISPATCH(params+6) = This->disp;
432 call_sink(This->cps.wbe2, DISPID_BEFORENAVIGATE2, &dispparams);
434 SysFreeString(V_BSTR(&var_url));
437 /* FIXME: urlmon should handle it */
438 static BOOL try_application_url(LPCWSTR url)
440 SHELLEXECUTEINFOW exec_info;
446 static const WCHAR wszURLProtocol[] = {'U','R','L',' ','P','r','o','t','o','c','o','l',0};
448 hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, app, sizeof(app)/sizeof(WCHAR), NULL, 0);
452 res = RegOpenKeyW(HKEY_CLASSES_ROOT, app, &hkey);
453 if(res != ERROR_SUCCESS)
456 res = RegQueryValueExW(hkey, wszURLProtocol, NULL, &type, NULL, NULL);
458 if(res != ERROR_SUCCESS || type != REG_SZ)
461 TRACE("openning application %s\n", debugstr_w(app));
463 memset(&exec_info, 0, sizeof(exec_info));
464 exec_info.cbSize = sizeof(exec_info);
465 exec_info.lpFile = url;
466 exec_info.nShow = SW_SHOW;
468 return ShellExecuteExW(&exec_info);
471 static HRESULT create_moniker(LPCWSTR url, IMoniker **mon)
473 WCHAR new_url[INTERNET_MAX_URL_LENGTH];
478 return CreateURLMoniker(NULL, url, mon);
481 size = sizeof(new_url);
482 hres = UrlCreateFromPathW(url, new_url, &size, 0);
484 WARN("UrlCreateFromPathW failed: %08x\n", hres);
488 size = sizeof(new_url);
489 hres = UrlApplySchemeW(url, new_url, &size, URL_APPLY_GUESSSCHEME);
490 TRACE("got %s\n", debugstr_w(new_url));
492 WARN("UrlApplyScheme failed: %08x\n", hres);
497 return CreateURLMoniker(NULL, new_url, mon);
500 static HRESULT bind_to_object(DocHost *This, IMoniker *mon, LPCWSTR url, IBindCtx *bindctx,
501 IBindStatusCallback *callback)
503 IUnknown *unk = NULL;
507 IMoniker_AddRef(mon);
509 hres = create_moniker(url, &mon);
514 CoTaskMemFree(This->url);
515 hres = IMoniker_GetDisplayName(mon, 0, NULL, &This->url);
517 FIXME("GetDisplayName failed: %08x\n", hres);
519 IBindCtx_RegisterObjectParam(bindctx, (LPOLESTR)SZ_HTML_CLIENTSITE_OBJECTPARAM,
520 (IUnknown*)CLIENTSITE(This));
522 hres = IMoniker_BindToObject(mon, bindctx, NULL, &IID_IUnknown, (void**)&unk);
523 if(SUCCEEDED(hres)) {
526 IUnknown_Release(unk);
527 }else if(try_application_url(url)) {
530 FIXME("BindToObject failed: %08x\n", hres);
533 IMoniker_Release(mon);
537 static HRESULT navigate_bsc(DocHost *This, BindStatusCallback *bsc, IMoniker *mon)
539 VARIANT_BOOL cancel = VARIANT_FALSE;
540 SAFEARRAY *post_data = NULL;
544 set_doc_state(This, READYSTATE_LOADING);
547 post_data = SafeArrayCreateVector(VT_UI1, 0, bsc->post_data_len);
548 memcpy(post_data->pvData, post_data, bsc->post_data_len);
551 on_before_navigate2(This, bsc->url, post_data, bsc->headers, &cancel);
553 SafeArrayDestroy(post_data);
555 FIXME("Navigation canceled\n");
560 deactivate_document(This);
562 CreateAsyncBindCtx(0, BINDSC(bsc), 0, &bindctx);
565 IOleInPlaceFrame_EnableModeless(This->frame, FALSE);
567 hres = bind_to_object(This, mon, bsc->url, bindctx, BINDSC(bsc));
570 IOleInPlaceFrame_EnableModeless(This->frame, TRUE);
572 IBindCtx_Release(bindctx);
578 task_header_t header;
579 BindStatusCallback *bsc;
580 } task_navigate_bsc_t;
582 static void navigate_bsc_proc(DocHost *This, task_header_t *t)
584 task_navigate_bsc_t *task = (task_navigate_bsc_t*)t;
587 create_doc_view_hwnd(This);
589 navigate_bsc(This, task->bsc, NULL);
591 IBindStatusCallback_Release(BINDSC(task->bsc));
595 HRESULT navigate_url(DocHost *This, LPCWSTR url, const VARIANT *Flags,
596 const VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
598 task_navigate_bsc_t *task;
599 PBYTE post_data = NULL;
600 ULONG post_data_len = 0;
601 LPWSTR headers = NULL;
603 TRACE("navigating to %s\n", debugstr_w(url));
605 if((Flags && V_VT(Flags) != VT_EMPTY)
606 || (TargetFrameName && V_VT(TargetFrameName) != VT_EMPTY))
607 FIXME("Unsupported args (Flags %p:%d; TargetFrameName %p:%d)\n",
608 Flags, Flags ? V_VT(Flags) : -1, TargetFrameName,
609 TargetFrameName ? V_VT(TargetFrameName) : -1);
612 TRACE("PostData vt=%d\n", V_VT(PostData));
614 if(V_VT(PostData) == (VT_ARRAY | VT_UI1)) {
615 SafeArrayAccessData(V_ARRAY(PostData), (void**)&post_data);
616 post_data_len = V_ARRAY(PostData)->rgsabound[0].cElements;
620 if(Headers && V_VT(Headers) != VT_EMPTY && V_VT(Headers) != VT_ERROR) {
621 if(V_VT(Headers) != VT_BSTR)
624 headers = V_BSTR(Headers);
625 TRACE("Headers: %s\n", debugstr_w(headers));
628 task = heap_alloc(sizeof(*task));
629 task->bsc = create_callback(This, url, post_data, post_data_len, headers);
632 SafeArrayUnaccessData(V_ARRAY(PostData));
634 push_dochost_task(This, &task->header, navigate_bsc_proc, This->url == NULL);
639 static HRESULT navigate_hlink(DocHost *This, IMoniker *mon, IBindCtx *bindctx,
640 IBindStatusCallback *callback)
642 IHttpNegotiate *http_negotiate;
643 BindStatusCallback *bsc;
644 PBYTE post_data = NULL;
645 ULONG post_data_len = 0;
646 LPWSTR headers = NULL, url;
651 hres = IBindStatusCallback_QueryInterface(callback, &IID_IHttpNegotiate,
652 (void**)&http_negotiate);
653 if(SUCCEEDED(hres)) {
654 static const WCHAR null_string[] = {0};
656 IHttpNegotiate_BeginningTransaction(http_negotiate, null_string, null_string, 0,
658 IHttpNegotiate_Release(http_negotiate);
661 memset(&bindinfo, 0, sizeof(bindinfo));
662 bindinfo.cbSize = sizeof(bindinfo);
664 hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
665 dump_BINDINFO(&bindinfo);
666 if(bindinfo.dwBindVerb == BINDVERB_POST) {
667 post_data_len = bindinfo.cbstgmedData;
669 post_data = bindinfo.stgmedData.u.hGlobal;
672 hres = IMoniker_GetDisplayName(mon, 0, NULL, &url);
674 FIXME("GetDisplayName failed: %08x\n", hres);
676 bsc = create_callback(This, url, post_data, post_data_len, headers);
679 hres = navigate_bsc(This, bsc, mon);
681 IBindStatusCallback_Release(BINDSC(bsc));
682 CoTaskMemFree(headers);
683 ReleaseBindInfo(&bindinfo);
688 HRESULT go_home(DocHost *This)
691 DWORD res, type, size;
692 WCHAR wszPageName[MAX_PATH];
693 static const WCHAR wszAboutBlank[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
694 static const WCHAR wszStartPage[] = {'S','t','a','r','t',' ','P','a','g','e',0};
695 static const WCHAR wszSubKey[] = {'S','o','f','t','w','a','r','e','\\',
696 'M','i','c','r','o','s','o','f','t','\\',
697 'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','\\',
700 res = RegOpenKeyW(HKEY_CURRENT_USER, wszSubKey, &hkey);
701 if (res != ERROR_SUCCESS)
702 return navigate_url(This, wszAboutBlank, NULL, NULL, NULL, NULL);
704 size = sizeof(wszPageName);
705 res = RegQueryValueExW(hkey, wszStartPage, NULL, &type, (LPBYTE)wszPageName, &size);
707 if (res != ERROR_SUCCESS || type != REG_SZ)
708 return navigate_url(This, wszAboutBlank, NULL, NULL, NULL, NULL);
710 return navigate_url(This, wszPageName, NULL, NULL, NULL, NULL);
713 #define HLINKFRAME_THIS(iface) DEFINE_THIS(WebBrowser, HlinkFrame, iface)
715 static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv)
717 WebBrowser *This = HLINKFRAME_THIS(iface);
718 return IWebBrowser2_QueryInterface(WEBBROWSER2(This), riid, ppv);
721 static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface)
723 WebBrowser *This = HLINKFRAME_THIS(iface);
724 return IWebBrowser2_AddRef(WEBBROWSER2(This));
727 static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface)
729 WebBrowser *This = HLINKFRAME_THIS(iface);
730 return IWebBrowser2_Release(WEBBROWSER2(This));
733 static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface,
734 IHlinkBrowseContext *pihlbc)
736 WebBrowser *This = HLINKFRAME_THIS(iface);
737 FIXME("(%p)->(%p)\n", This, pihlbc);
741 static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface,
742 IHlinkBrowseContext **ppihlbc)
744 WebBrowser *This = HLINKFRAME_THIS(iface);
745 FIXME("(%p)->(%p)\n", This, ppihlbc);
749 static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc,
750 IBindStatusCallback *pibsc, IHlink *pihlNavigate)
752 WebBrowser *This = HLINKFRAME_THIS(iface);
754 LPWSTR location = NULL;
756 TRACE("(%p)->(%08x %p %p %p)\n", This, grfHLNF, pbc, pibsc, pihlNavigate);
759 FIXME("unsupported grfHLNF=%08x\n", grfHLNF);
761 /* Windows calls GetTargetFrameName here. */
763 IHlink_GetMonikerReference(pihlNavigate, 1, &mon, &location);
766 FIXME("location = %s\n", debugstr_w(location));
767 CoTaskMemFree(location);
770 /* Windows calls GetHlinkSite here */
772 if(grfHLNF & HLNF_OPENINNEWWINDOW) {
773 FIXME("Not supported HLNF_OPENINNEWWINDOW\n");
777 return navigate_hlink(&This->doc_host, mon, pbc, pibsc);
780 static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF,
781 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved)
783 WebBrowser *This = HLINKFRAME_THIS(iface);
784 FIXME("(%p)->(%08x %p %s %s %d)\n", This, grfHLNF, pimkTarget, debugstr_w(pwzLocation),
785 debugstr_w(pwzFriendlyName), dwreserved);
789 static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID,
790 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
792 WebBrowser *This = HLINKFRAME_THIS(iface);
793 FIXME("(%p)->(%u %p %s %s)\n", This, uHLID, pimkTarget, debugstr_w(pwzLocation),
794 debugstr_w(pwzFriendlyName));
798 #undef HLINKFRAME_THIS
800 static const IHlinkFrameVtbl HlinkFrameVtbl = {
801 HlinkFrame_QueryInterface,
804 HlinkFrame_SetBrowseContext,
805 HlinkFrame_GetBrowseContext,
807 HlinkFrame_OnNavigate,
808 HlinkFrame_UpdateHlink
811 void WebBrowser_HlinkFrame_Init(WebBrowser *This)
813 This->lpHlinkFrameVtbl = &HlinkFrameVtbl;