2 * Copyright 2005 Jacek Caban
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
25 #define NONAMELESSUNION
26 #define NONAMELESSSTRUCT
35 #define NO_SHLWAPI_REG
38 #include "wine/debug.h"
40 #include "mshtml_private.h"
41 #include "htmlevent.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
47 /* Undocumented notification, see tests */
48 #define CMDID_EXPLORER_UPDATEHISTORY 38
55 } download_proc_task_t;
57 static BOOL use_gecko_script(HTMLWindow *window)
62 hres = IInternetSecurityManager_MapUrlToZone(window->secmgr, window->url, &zone, 0);
64 WARN("Could not map %s to zone: %08x\n", debugstr_w(window->url), hres);
68 TRACE("zone %d\n", zone);
69 if(zone == URLZONE_LOCAL_MACHINE || zone == URLZONE_TRUSTED || !window->uri)
72 hres = IUri_GetScheme(window->uri, &scheme);
73 return FAILED(hres) || scheme != URL_SCHEME_ABOUT;
76 static void notify_travellog_update(HTMLDocumentObj *doc)
78 IOleCommandTarget *cmdtrg;
81 if(!doc->is_webbrowser)
84 /* Don't notify if we were in about: page */
85 if(doc->basedoc.window->uri) {
88 hres = IUri_GetScheme(doc->basedoc.window->uri, &scheme);
89 if(SUCCEEDED(hres) && scheme == URL_SCHEME_ABOUT)
93 hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&cmdtrg);
100 IOleCommandTarget_Exec(cmdtrg, &CGID_Explorer, CMDID_EXPLORER_UPDATEHISTORY, 0, &vin, NULL);
101 IOleCommandTarget_Release(cmdtrg);
105 void set_current_uri(HTMLWindow *window, IUri *uri)
108 IUri_Release(window->uri);
112 SysFreeString(window->url);
121 IUri_GetDisplayUri(uri, &window->url);
124 void set_current_mon(HTMLWindow *This, IMoniker *mon)
126 IUriContainer *uri_container;
132 notify_travellog_update(This->doc_obj);
133 IMoniker_Release(This->mon);
140 IMoniker_AddRef(mon);
143 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
144 if(SUCCEEDED(hres)) {
145 hres = IUriContainer_GetIUri(uri_container, &uri);
146 IUriContainer_Release(uri_container);
148 WARN("GetIUri failed: %08x\n", hres);
156 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
157 if(SUCCEEDED(hres)) {
158 hres = CreateUri(url, 0, 0, &uri);
160 WARN("CrateUri failed: %08x\n", hres);
161 set_current_uri(This, NULL);
162 This->url = SysAllocString(url);
168 WARN("GetDisplayName failed: %08x\n", hres);
172 set_current_uri(This, uri);
175 set_script_mode(This, use_gecko_script(This) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT);
178 void set_download_state(HTMLDocumentObj *doc, int state)
181 IOleCommandTarget *olecmd;
184 hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
185 if(SUCCEEDED(hres)) {
191 IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETDOWNLOADSTATE,
192 OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
193 IOleCommandTarget_Release(olecmd);
197 doc->download_state = state;
200 static void set_progress_proc(task_t *_task)
202 docobj_task_t *task = (docobj_task_t*)_task;
203 IOleCommandTarget *olecmd = NULL;
204 HTMLDocumentObj *doc = task->doc;
207 TRACE("(%p)\n", doc);
210 IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
213 VARIANT progress_max, progress;
215 V_VT(&progress_max) = VT_I4;
216 V_I4(&progress_max) = 0; /* FIXME */
217 IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETPROGRESSMAX, OLECMDEXECOPT_DONTPROMPTUSER,
218 &progress_max, NULL);
220 V_VT(&progress) = VT_I4;
221 V_I4(&progress) = 0; /* FIXME */
222 IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETPROGRESSPOS, OLECMDEXECOPT_DONTPROMPTUSER,
224 IOleCommandTarget_Release(olecmd);
227 if(doc->usermode == EDITMODE && doc->hostui) {
228 DOCHOSTUIINFO hostinfo;
230 memset(&hostinfo, 0, sizeof(DOCHOSTUIINFO));
231 hostinfo.cbSize = sizeof(DOCHOSTUIINFO);
232 hres = IDocHostUIHandler_GetHostInfo(doc->hostui, &hostinfo);
234 /* FIXME: use hostinfo */
235 TRACE("hostinfo = {%u %08x %08x %s %s}\n",
236 hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
237 debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
241 static void set_downloading_proc(task_t *_task)
243 download_proc_task_t *task = (download_proc_task_t*)_task;
244 HTMLDocumentObj *doc = task->doc;
247 TRACE("(%p)\n", doc);
249 set_statustext(doc, IDS_STATUS_DOWNLOADINGFROM, task->url);
251 if(task->set_download)
252 set_download_state(doc, 1);
258 IAdviseSink_OnViewChange(doc->view_sink, DVASPECT_CONTENT, -1);
261 IDropTarget *drop_target = NULL;
263 hres = IDocHostUIHandler_GetDropTarget(doc->hostui, NULL /* FIXME */, &drop_target);
264 if(SUCCEEDED(hres)) {
265 FIXME("Use IDropTarget\n");
266 IDropTarget_Release(drop_target);
271 static void set_downloading_task_destr(task_t *_task)
273 download_proc_task_t *task = (download_proc_task_t*)_task;
275 CoTaskMemFree(task->url);
279 void prepare_for_binding(HTMLDocument *This, IMoniker *mon, BOOL navigated_binding)
283 if(This->doc_obj->client) {
284 VARIANT silent, offline;
286 hres = get_client_disp_property(This->doc_obj->client, DISPID_AMBIENT_SILENT, &silent);
287 if(SUCCEEDED(hres)) {
288 if(V_VT(&silent) != VT_BOOL)
289 WARN("V_VT(silent) = %d\n", V_VT(&silent));
290 else if(V_BOOL(&silent))
291 FIXME("silent == true\n");
294 hres = get_client_disp_property(This->doc_obj->client,
295 DISPID_AMBIENT_OFFLINEIFNOTCONNECTED, &offline);
296 if(SUCCEEDED(hres)) {
297 if(V_VT(&offline) != VT_BOOL)
298 WARN("V_VT(offline) = %d\n", V_VT(&offline));
299 else if(V_BOOL(&offline))
300 FIXME("offline == true\n");
304 if(This->window->mon) {
305 update_doc(This, UPDATE_TITLE|UPDATE_UI);
307 update_doc(This, UPDATE_TITLE);
308 set_current_mon(This->window, mon);
311 if(This->doc_obj->client) {
312 IOleCommandTarget *cmdtrg = NULL;
314 hres = IOleClientSite_QueryInterface(This->doc_obj->client, &IID_IOleCommandTarget,
316 if(SUCCEEDED(hres)) {
319 if(!navigated_binding) {
322 IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 37, 0, &var, NULL);
324 V_VT(&var) = VT_UNKNOWN;
325 V_UNKNOWN(&var) = (IUnknown*)&This->window->IHTMLWindow2_iface;
326 V_VT(&out) = VT_EMPTY;
327 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 63, 0, &var, &out);
332 IOleCommandTarget_Release(cmdtrg);
337 HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, nsChannelBSC *async_bsc, BOOL set_download)
339 download_proc_task_t *download_task;
340 nsChannelBSC *bscallback;
345 hres = IMoniker_GetDisplayName(mon, pibc, NULL, &url);
347 WARN("GetDiaplayName failed: %08x\n", hres);
351 TRACE("got url: %s\n", debugstr_w(url));
353 set_ready_state(This->window, READYSTATE_LOADING);
355 hres = create_doc_uri(This->window, url, &nsuri);
356 if(SUCCEEDED(hres)) {
358 bscallback = async_bsc;
360 hres = create_channelbsc(mon, NULL, NULL, 0, &bscallback);
363 if(SUCCEEDED(hres)) {
364 remove_target_tasks(This->task_magic);
365 abort_document_bindings(This->doc_node);
367 hres = load_nsuri(This->window, nsuri, bscallback, 0/*LOAD_INITIAL_DOCUMENT_URI*/);
368 nsISupports_Release((nsISupports*)nsuri); /* FIXME */
370 set_window_bscallback(This->window, bscallback);
371 if(bscallback != async_bsc)
372 IUnknown_Release((IUnknown*)bscallback);
380 HTMLDocument_LockContainer(This->doc_obj, TRUE);
382 if(This->doc_obj->frame) {
385 task = heap_alloc(sizeof(docobj_task_t));
386 task->doc = This->doc_obj;
387 push_task(&task->header, set_progress_proc, NULL, This->doc_obj->basedoc.task_magic);
390 download_task = heap_alloc(sizeof(download_proc_task_t));
391 download_task->doc = This->doc_obj;
392 download_task->set_download = set_download;
393 download_task->url = url;
394 push_task(&download_task->header, set_downloading_proc, set_downloading_task_destr, This->doc_obj->basedoc.task_magic);
399 void set_ready_state(HTMLWindow *window, READYSTATE readystate)
401 window->readystate = readystate;
403 if(window->doc_obj && window->doc_obj->basedoc.window == window)
404 call_property_onchanged(&window->doc_obj->basedoc.cp_propnotif, DISPID_READYSTATE);
406 fire_event(window->doc, EVENTID_READYSTATECHANGE, FALSE, window->doc->node.nsnode, NULL);
408 if(window->frame_element)
409 fire_event(window->frame_element->element.node.doc, EVENTID_READYSTATECHANGE,
410 TRUE, window->frame_element->element.node.nsnode, NULL);
413 static HRESULT get_doc_string(HTMLDocumentNode *This, char **str)
422 WARN("NULL nsdoc\n");
426 nsres = nsIDOMHTMLDocument_QueryInterface(This->nsdoc, &IID_nsIDOMNode, (void**)&nsnode);
427 if(NS_FAILED(nsres)) {
428 ERR("Could not get nsIDOMNode failed: %08x\n", nsres);
432 nsAString_Init(&nsstr, NULL);
433 hres = nsnode_to_nsstring(nsnode, &nsstr);
434 nsIDOMNode_Release(nsnode);
436 nsAString_Finish(&nsstr);
440 nsAString_GetData(&nsstr, &strw);
441 TRACE("%s\n", debugstr_w(strw));
443 *str = heap_strdupWtoA(strw);
445 nsAString_Finish(&nsstr);
448 return E_OUTOFMEMORY;
453 /**********************************************************
454 * IPersistMoniker implementation
457 static inline HTMLDocument *impl_from_IPersistMoniker(IPersistMoniker *iface)
459 return CONTAINING_RECORD(iface, HTMLDocument, IPersistMoniker_iface);
462 static HRESULT WINAPI PersistMoniker_QueryInterface(IPersistMoniker *iface, REFIID riid, void **ppv)
464 HTMLDocument *This = impl_from_IPersistMoniker(iface);
465 return htmldoc_query_interface(This, riid, ppv);
468 static ULONG WINAPI PersistMoniker_AddRef(IPersistMoniker *iface)
470 HTMLDocument *This = impl_from_IPersistMoniker(iface);
471 return htmldoc_addref(This);
474 static ULONG WINAPI PersistMoniker_Release(IPersistMoniker *iface)
476 HTMLDocument *This = impl_from_IPersistMoniker(iface);
477 return htmldoc_release(This);
480 static HRESULT WINAPI PersistMoniker_GetClassID(IPersistMoniker *iface, CLSID *pClassID)
482 HTMLDocument *This = impl_from_IPersistMoniker(iface);
483 return IPersist_GetClassID(&This->IPersistFile_iface, pClassID);
486 static HRESULT WINAPI PersistMoniker_IsDirty(IPersistMoniker *iface)
488 HTMLDocument *This = impl_from_IPersistMoniker(iface);
490 TRACE("(%p)\n", This);
492 return IPersistStreamInit_IsDirty(&This->IPersistStreamInit_iface);
495 static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAvailable,
496 IMoniker *pimkName, LPBC pibc, DWORD grfMode)
498 HTMLDocument *This = impl_from_IPersistMoniker(iface);
501 TRACE("(%p)->(%x %p %p %08x)\n", This, fFullyAvailable, pimkName, pibc, grfMode);
504 IUnknown *unk = NULL;
508 * "__PrecreatedObject"
509 * "BIND_CONTEXT_PARAM"
510 * "__HTMLLOADOPTIONS"
513 * "_ITransData_Object_"
517 IBindCtx_GetObjectParam(pibc, (LPOLESTR)SZ_HTML_CLIENTSITE_OBJECTPARAM, &unk);
519 IOleClientSite *client = NULL;
521 hres = IUnknown_QueryInterface(unk, &IID_IOleClientSite, (void**)&client);
522 if(SUCCEEDED(hres)) {
523 TRACE("Got client site %p\n", client);
524 IOleObject_SetClientSite(&This->IOleObject_iface, client);
525 IOleClientSite_Release(client);
528 IUnknown_Release(unk);
532 prepare_for_binding(This, pimkName, FALSE);
533 hres = set_moniker(This, pimkName, pibc, NULL, TRUE);
537 return start_binding(This->window, NULL, (BSCallback*)This->window->bscallback, pibc);
540 static HRESULT WINAPI PersistMoniker_Save(IPersistMoniker *iface, IMoniker *pimkName,
541 LPBC pbc, BOOL fRemember)
543 HTMLDocument *This = impl_from_IPersistMoniker(iface);
544 FIXME("(%p)->(%p %p %x)\n", This, pimkName, pbc, fRemember);
548 static HRESULT WINAPI PersistMoniker_SaveCompleted(IPersistMoniker *iface, IMoniker *pimkName, LPBC pibc)
550 HTMLDocument *This = impl_from_IPersistMoniker(iface);
551 FIXME("(%p)->(%p %p)\n", This, pimkName, pibc);
555 static HRESULT WINAPI PersistMoniker_GetCurMoniker(IPersistMoniker *iface, IMoniker **ppimkName)
557 HTMLDocument *This = impl_from_IPersistMoniker(iface);
559 TRACE("(%p)->(%p)\n", This, ppimkName);
561 if(!This->window || !This->window->mon)
564 IMoniker_AddRef(This->window->mon);
565 *ppimkName = This->window->mon;
569 static const IPersistMonikerVtbl PersistMonikerVtbl = {
570 PersistMoniker_QueryInterface,
571 PersistMoniker_AddRef,
572 PersistMoniker_Release,
573 PersistMoniker_GetClassID,
574 PersistMoniker_IsDirty,
577 PersistMoniker_SaveCompleted,
578 PersistMoniker_GetCurMoniker
581 /**********************************************************
582 * IMonikerProp implementation
585 static inline HTMLDocument *impl_from_IMonikerProp(IMonikerProp *iface)
587 return CONTAINING_RECORD(iface, HTMLDocument, IMonikerProp_iface);
590 static HRESULT WINAPI MonikerProp_QueryInterface(IMonikerProp *iface, REFIID riid, void **ppv)
592 HTMLDocument *This = impl_from_IMonikerProp(iface);
593 return htmldoc_query_interface(This, riid, ppv);
596 static ULONG WINAPI MonikerProp_AddRef(IMonikerProp *iface)
598 HTMLDocument *This = impl_from_IMonikerProp(iface);
599 return htmldoc_addref(This);
602 static ULONG WINAPI MonikerProp_Release(IMonikerProp *iface)
604 HTMLDocument *This = impl_from_IMonikerProp(iface);
605 return htmldoc_release(This);
608 static HRESULT WINAPI MonikerProp_PutProperty(IMonikerProp *iface, MONIKERPROPERTY mkp, LPCWSTR val)
610 HTMLDocument *This = impl_from_IMonikerProp(iface);
612 TRACE("(%p)->(%d %s)\n", This, mkp, debugstr_w(val));
616 heap_free(This->doc_obj->mime);
617 This->doc_obj->mime = heap_strdupW(val);
624 FIXME("mkp %d\n", mkp);
631 static const IMonikerPropVtbl MonikerPropVtbl = {
632 MonikerProp_QueryInterface,
635 MonikerProp_PutProperty
638 /**********************************************************
639 * IPersistFile implementation
642 static inline HTMLDocument *impl_from_IPersistFile(IPersistFile *iface)
644 return CONTAINING_RECORD(iface, HTMLDocument, IPersistFile_iface);
647 static HRESULT WINAPI PersistFile_QueryInterface(IPersistFile *iface, REFIID riid, void **ppv)
649 HTMLDocument *This = impl_from_IPersistFile(iface);
650 return htmldoc_query_interface(This, riid, ppv);
653 static ULONG WINAPI PersistFile_AddRef(IPersistFile *iface)
655 HTMLDocument *This = impl_from_IPersistFile(iface);
656 return htmldoc_addref(This);
659 static ULONG WINAPI PersistFile_Release(IPersistFile *iface)
661 HTMLDocument *This = impl_from_IPersistFile(iface);
662 return htmldoc_release(This);
665 static HRESULT WINAPI PersistFile_GetClassID(IPersistFile *iface, CLSID *pClassID)
667 HTMLDocument *This = impl_from_IPersistFile(iface);
669 TRACE("(%p)->(%p)\n", This, pClassID);
674 *pClassID = CLSID_HTMLDocument;
678 static HRESULT WINAPI PersistFile_IsDirty(IPersistFile *iface)
680 HTMLDocument *This = impl_from_IPersistFile(iface);
682 TRACE("(%p)\n", This);
684 return IPersistStreamInit_IsDirty(&This->IPersistStreamInit_iface);
687 static HRESULT WINAPI PersistFile_Load(IPersistFile *iface, LPCOLESTR pszFileName, DWORD dwMode)
689 HTMLDocument *This = impl_from_IPersistFile(iface);
690 FIXME("(%p)->(%s %08x)\n", This, debugstr_w(pszFileName), dwMode);
694 static HRESULT WINAPI PersistFile_Save(IPersistFile *iface, LPCOLESTR pszFileName, BOOL fRemember)
696 HTMLDocument *This = impl_from_IPersistFile(iface);
702 TRACE("(%p)->(%s %x)\n", This, debugstr_w(pszFileName), fRemember);
704 file = CreateFileW(pszFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
705 FILE_ATTRIBUTE_NORMAL, NULL);
706 if(file == INVALID_HANDLE_VALUE) {
707 WARN("Could not create file: %u\n", GetLastError());
711 hres = get_doc_string(This->doc_node, &str);
713 WriteFile(file, str, strlen(str), &written, NULL);
719 static HRESULT WINAPI PersistFile_SaveCompleted(IPersistFile *iface, LPCOLESTR pszFileName)
721 HTMLDocument *This = impl_from_IPersistFile(iface);
722 FIXME("(%p)->(%s)\n", This, debugstr_w(pszFileName));
726 static HRESULT WINAPI PersistFile_GetCurFile(IPersistFile *iface, LPOLESTR *pszFileName)
728 HTMLDocument *This = impl_from_IPersistFile(iface);
729 FIXME("(%p)->(%p)\n", This, pszFileName);
733 static const IPersistFileVtbl PersistFileVtbl = {
734 PersistFile_QueryInterface,
737 PersistFile_GetClassID,
741 PersistFile_SaveCompleted,
742 PersistFile_GetCurFile
745 static inline HTMLDocument *impl_from_IPersistStreamInit(IPersistStreamInit *iface)
747 return CONTAINING_RECORD(iface, HTMLDocument, IPersistStreamInit_iface);
750 static HRESULT WINAPI PersistStreamInit_QueryInterface(IPersistStreamInit *iface,
751 REFIID riid, void **ppv)
753 HTMLDocument *This = impl_from_IPersistStreamInit(iface);
754 return htmldoc_query_interface(This, riid, ppv);
757 static ULONG WINAPI PersistStreamInit_AddRef(IPersistStreamInit *iface)
759 HTMLDocument *This = impl_from_IPersistStreamInit(iface);
760 return htmldoc_addref(This);
763 static ULONG WINAPI PersistStreamInit_Release(IPersistStreamInit *iface)
765 HTMLDocument *This = impl_from_IPersistStreamInit(iface);
766 return htmldoc_release(This);
769 static HRESULT WINAPI PersistStreamInit_GetClassID(IPersistStreamInit *iface, CLSID *pClassID)
771 HTMLDocument *This = impl_from_IPersistStreamInit(iface);
772 return IPersist_GetClassID(&This->IPersistFile_iface, pClassID);
775 static HRESULT WINAPI PersistStreamInit_IsDirty(IPersistStreamInit *iface)
777 HTMLDocument *This = impl_from_IPersistStreamInit(iface);
779 TRACE("(%p)\n", This);
781 if(This->doc_obj->usermode == EDITMODE)
782 return editor_is_dirty(This);
787 static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, LPSTREAM pStm)
789 HTMLDocument *This = impl_from_IPersistStreamInit(iface);
793 static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
795 TRACE("(%p)->(%p)\n", This, pStm);
797 hres = CreateURLMoniker(NULL, about_blankW, &mon);
799 WARN("CreateURLMoniker failed: %08x\n", hres);
803 prepare_for_binding(This, mon, FALSE);
804 hres = set_moniker(This, mon, NULL, NULL, TRUE);
805 IMoniker_Release(mon);
809 return channelbsc_load_stream(This->window->bscallback, pStm);
812 static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, LPSTREAM pStm,
815 HTMLDocument *This = impl_from_IPersistStreamInit(iface);
820 TRACE("(%p)->(%p %x)\n", This, pStm, fClearDirty);
822 hres = get_doc_string(This->doc_node, &str);
826 hres = IStream_Write(pStm, str, strlen(str), &written);
828 FIXME("Write failed: %08x\n", hres);
833 set_dirty(This, VARIANT_FALSE);
838 static HRESULT WINAPI PersistStreamInit_GetSizeMax(IPersistStreamInit *iface,
839 ULARGE_INTEGER *pcbSize)
841 HTMLDocument *This = impl_from_IPersistStreamInit(iface);
842 FIXME("(%p)->(%p)\n", This, pcbSize);
846 static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface)
848 HTMLDocument *This = impl_from_IPersistStreamInit(iface);
852 static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
854 TRACE("(%p)\n", This);
856 hres = CreateURLMoniker(NULL, about_blankW, &mon);
858 WARN("CreateURLMoniker failed: %08x\n", hres);
862 prepare_for_binding(This, mon, FALSE);
863 hres = set_moniker(This, mon, NULL, NULL, FALSE);
864 IMoniker_Release(mon);
868 return channelbsc_load_stream(This->window->bscallback, NULL);
871 static const IPersistStreamInitVtbl PersistStreamInitVtbl = {
872 PersistStreamInit_QueryInterface,
873 PersistStreamInit_AddRef,
874 PersistStreamInit_Release,
875 PersistStreamInit_GetClassID,
876 PersistStreamInit_IsDirty,
877 PersistStreamInit_Load,
878 PersistStreamInit_Save,
879 PersistStreamInit_GetSizeMax,
880 PersistStreamInit_InitNew
883 /**********************************************************
884 * IPersistHistory implementation
887 static inline HTMLDocument *impl_from_IPersistHistory(IPersistHistory *iface)
889 return CONTAINING_RECORD(iface, HTMLDocument, IPersistHistory_iface);
892 static HRESULT WINAPI PersistHistory_QueryInterface(IPersistHistory *iface, REFIID riid, void **ppv)
894 HTMLDocument *This = impl_from_IPersistHistory(iface);
895 return htmldoc_query_interface(This, riid, ppv);
898 static ULONG WINAPI PersistHistory_AddRef(IPersistHistory *iface)
900 HTMLDocument *This = impl_from_IPersistHistory(iface);
901 return htmldoc_addref(This);
904 static ULONG WINAPI PersistHistory_Release(IPersistHistory *iface)
906 HTMLDocument *This = impl_from_IPersistHistory(iface);
907 return htmldoc_release(This);
910 static HRESULT WINAPI PersistHistory_GetClassID(IPersistHistory *iface, CLSID *pClassID)
912 HTMLDocument *This = impl_from_IPersistHistory(iface);
913 return IPersist_GetClassID(&This->IPersistFile_iface, pClassID);
916 static HRESULT WINAPI PersistHistory_LoadHistory(IPersistHistory *iface, IStream *pStream, IBindCtx *pbc)
918 HTMLDocument *This = impl_from_IPersistHistory(iface);
919 FIXME("(%p)->(%p %p)\n", This, pStream, pbc);
923 static HRESULT WINAPI PersistHistory_SaveHistory(IPersistHistory *iface, IStream *pStream)
925 HTMLDocument *This = impl_from_IPersistHistory(iface);
926 FIXME("(%p)->(%p)\n", This, pStream);
930 static HRESULT WINAPI PersistHistory_SetPositionCookie(IPersistHistory *iface, DWORD dwPositioncookie)
932 HTMLDocument *This = impl_from_IPersistHistory(iface);
933 FIXME("(%p)->(%x)\n", This, dwPositioncookie);
937 static HRESULT WINAPI PersistHistory_GetPositionCookie(IPersistHistory *iface, DWORD *pdwPositioncookie)
939 HTMLDocument *This = impl_from_IPersistHistory(iface);
940 FIXME("(%p)->(%p)\n", This, pdwPositioncookie);
944 static const IPersistHistoryVtbl PersistHistoryVtbl = {
945 PersistHistory_QueryInterface,
946 PersistHistory_AddRef,
947 PersistHistory_Release,
948 PersistHistory_GetClassID,
949 PersistHistory_LoadHistory,
950 PersistHistory_SaveHistory,
951 PersistHistory_SetPositionCookie,
952 PersistHistory_GetPositionCookie
955 void HTMLDocument_Persist_Init(HTMLDocument *This)
957 This->IPersistMoniker_iface.lpVtbl = &PersistMonikerVtbl;
958 This->IPersistFile_iface.lpVtbl = &PersistFileVtbl;
959 This->IMonikerProp_iface.lpVtbl = &MonikerPropVtbl;
960 This->IPersistStreamInit_iface.lpVtbl = &PersistStreamInitVtbl;
961 This->IPersistHistory_iface.lpVtbl = &PersistHistoryVtbl;