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 "htmlscript.h"
42 #include "htmlevent.h"
46 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
48 /* Undocumented notification, see tests */
49 #define CMDID_EXPLORER_UPDATEHISTORY 38
56 } download_proc_task_t;
58 static BOOL use_gecko_script(HTMLOuterWindow *window)
63 hres = IInternetSecurityManager_MapUrlToZone(window->secmgr, window->url, &zone, 0);
65 WARN("Could not map %s to zone: %08x\n", debugstr_w(window->url), hres);
69 TRACE("zone %d\n", zone);
70 return zone == URLZONE_UNTRUSTED;
73 static void notify_travellog_update(HTMLDocumentObj *doc)
75 IOleCommandTarget *cmdtrg;
78 if(!doc->is_webbrowser)
81 /* Don't notify if we were in about: page */
82 if(doc->basedoc.window->uri) {
85 hres = IUri_GetScheme(doc->basedoc.window->uri, &scheme);
86 if(SUCCEEDED(hres) && scheme == URL_SCHEME_ABOUT)
90 hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&cmdtrg);
97 IOleCommandTarget_Exec(cmdtrg, &CGID_Explorer, CMDID_EXPLORER_UPDATEHISTORY, 0, &vin, NULL);
98 IOleCommandTarget_Release(cmdtrg);
102 void set_current_uri(HTMLOuterWindow *window, IUri *uri)
105 IUri_Release(window->uri);
109 SysFreeString(window->url);
118 IUri_GetDisplayUri(uri, &window->url);
121 void set_current_mon(HTMLOuterWindow *This, IMoniker *mon)
123 IUriContainer *uri_container;
129 notify_travellog_update(This->doc_obj);
130 IMoniker_Release(This->mon);
137 IMoniker_AddRef(mon);
140 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
141 if(SUCCEEDED(hres)) {
142 hres = IUriContainer_GetIUri(uri_container, &uri);
143 IUriContainer_Release(uri_container);
145 WARN("GetIUri failed: %08x\n", hres);
153 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
154 if(SUCCEEDED(hres)) {
155 hres = CreateUri(url, 0, 0, &uri);
157 WARN("CrateUri failed: %08x\n", hres);
158 set_current_uri(This, NULL);
159 This->url = SysAllocString(url);
165 WARN("GetDisplayName failed: %08x\n", hres);
169 set_current_uri(This, uri);
172 set_script_mode(This, use_gecko_script(This) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT);
175 HRESULT create_relative_uri(HTMLOuterWindow *window, const WCHAR *rel_uri, IUri **uri)
178 ? CoInternetCombineUrlEx(window->uri, rel_uri, URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO, uri, 0)
179 : CreateUri(rel_uri, 0, 0, uri);
182 void set_download_state(HTMLDocumentObj *doc, int state)
185 IOleCommandTarget *olecmd;
188 hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
189 if(SUCCEEDED(hres)) {
195 IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETDOWNLOADSTATE,
196 OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
197 IOleCommandTarget_Release(olecmd);
201 doc->download_state = state;
204 static void set_progress_proc(task_t *_task)
206 docobj_task_t *task = (docobj_task_t*)_task;
207 IOleCommandTarget *olecmd = NULL;
208 HTMLDocumentObj *doc = task->doc;
211 TRACE("(%p)\n", doc);
214 IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
217 VARIANT progress_max, progress;
219 V_VT(&progress_max) = VT_I4;
220 V_I4(&progress_max) = 0; /* FIXME */
221 IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETPROGRESSMAX, OLECMDEXECOPT_DONTPROMPTUSER,
222 &progress_max, NULL);
224 V_VT(&progress) = VT_I4;
225 V_I4(&progress) = 0; /* FIXME */
226 IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETPROGRESSPOS, OLECMDEXECOPT_DONTPROMPTUSER,
228 IOleCommandTarget_Release(olecmd);
231 if(doc->usermode == EDITMODE && doc->hostui) {
232 DOCHOSTUIINFO hostinfo;
234 memset(&hostinfo, 0, sizeof(DOCHOSTUIINFO));
235 hostinfo.cbSize = sizeof(DOCHOSTUIINFO);
236 hres = IDocHostUIHandler_GetHostInfo(doc->hostui, &hostinfo);
238 /* FIXME: use hostinfo */
239 TRACE("hostinfo = {%u %08x %08x %s %s}\n",
240 hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
241 debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
245 static void set_downloading_proc(task_t *_task)
247 download_proc_task_t *task = (download_proc_task_t*)_task;
248 HTMLDocumentObj *doc = task->doc;
251 TRACE("(%p)\n", doc);
253 set_statustext(doc, IDS_STATUS_DOWNLOADINGFROM, task->url);
255 if(task->set_download)
256 set_download_state(doc, 1);
262 IAdviseSink_OnViewChange(doc->view_sink, DVASPECT_CONTENT, -1);
265 IDropTarget *drop_target = NULL;
267 hres = IDocHostUIHandler_GetDropTarget(doc->hostui, NULL /* FIXME */, &drop_target);
268 if(SUCCEEDED(hres) && drop_target) {
269 FIXME("Use IDropTarget\n");
270 IDropTarget_Release(drop_target);
275 static void set_downloading_task_destr(task_t *_task)
277 download_proc_task_t *task = (download_proc_task_t*)_task;
279 CoTaskMemFree(task->url);
283 void prepare_for_binding(HTMLDocument *This, IMoniker *mon, BOOL navigated_binding)
287 if(This->doc_obj->client) {
288 VARIANT silent, offline;
290 hres = get_client_disp_property(This->doc_obj->client, DISPID_AMBIENT_SILENT, &silent);
291 if(SUCCEEDED(hres)) {
292 if(V_VT(&silent) != VT_BOOL)
293 WARN("silent = %s\n", debugstr_variant(&silent));
294 else if(V_BOOL(&silent))
295 FIXME("silent == true\n");
298 hres = get_client_disp_property(This->doc_obj->client,
299 DISPID_AMBIENT_OFFLINEIFNOTCONNECTED, &offline);
300 if(SUCCEEDED(hres)) {
301 if(V_VT(&offline) != VT_BOOL)
302 WARN("offline = %s\n", debugstr_variant(&offline));
303 else if(V_BOOL(&offline))
304 FIXME("offline == true\n");
308 if(This->window->mon) {
309 update_doc(This, UPDATE_TITLE|UPDATE_UI);
311 update_doc(This, UPDATE_TITLE);
312 set_current_mon(This->window, mon);
315 if(This->doc_obj->client) {
316 IOleCommandTarget *cmdtrg = NULL;
318 hres = IOleClientSite_QueryInterface(This->doc_obj->client, &IID_IOleCommandTarget,
320 if(SUCCEEDED(hres)) {
323 if(!navigated_binding) {
326 IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 37, 0, &var, NULL);
328 V_VT(&var) = VT_UNKNOWN;
329 V_UNKNOWN(&var) = (IUnknown*)&This->window->base.IHTMLWindow2_iface;
330 V_VT(&out) = VT_EMPTY;
331 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 63, 0, &var, &out);
336 IOleCommandTarget_Release(cmdtrg);
341 HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, nsChannelBSC *async_bsc, BOOL set_download)
343 download_proc_task_t *download_task;
344 nsChannelBSC *bscallback;
349 hres = IMoniker_GetDisplayName(mon, pibc, NULL, &url);
351 WARN("GetDiaplayName failed: %08x\n", hres);
355 TRACE("got url: %s\n", debugstr_w(url));
357 set_ready_state(This->window, READYSTATE_LOADING);
359 hres = create_doc_uri(This->window, url, &nsuri);
360 if(SUCCEEDED(hres)) {
362 bscallback = async_bsc;
364 hres = create_channelbsc(mon, NULL, NULL, 0, TRUE, &bscallback);
367 if(SUCCEEDED(hres)) {
368 remove_target_tasks(This->task_magic);
369 abort_window_bindings(This->window->base.inner_window);
371 hres = load_nsuri(This->window, nsuri, bscallback, 0/*LOAD_INITIAL_DOCUMENT_URI*/);
372 nsISupports_Release((nsISupports*)nsuri); /* FIXME */
374 hres = create_pending_window(This->window, bscallback);
375 if(bscallback != async_bsc)
376 IBindStatusCallback_Release(&bscallback->bsc.IBindStatusCallback_iface);
384 HTMLDocument_LockContainer(This->doc_obj, TRUE);
386 if(This->doc_obj->frame) {
389 task = heap_alloc(sizeof(docobj_task_t));
390 task->doc = This->doc_obj;
391 push_task(&task->header, set_progress_proc, NULL, This->doc_obj->basedoc.task_magic);
394 download_task = heap_alloc(sizeof(download_proc_task_t));
395 download_task->doc = This->doc_obj;
396 download_task->set_download = set_download;
397 download_task->url = url;
398 push_task(&download_task->header, set_downloading_proc, set_downloading_task_destr, This->doc_obj->basedoc.task_magic);
403 void set_ready_state(HTMLOuterWindow *window, READYSTATE readystate)
405 window->readystate = readystate;
407 if(window->doc_obj && window->doc_obj->basedoc.window == window)
408 call_property_onchanged(&window->doc_obj->basedoc.cp_propnotif, DISPID_READYSTATE);
410 fire_event(window->base.inner_window->doc, EVENTID_READYSTATECHANGE, FALSE, window->base.inner_window->doc->node.nsnode, NULL);
412 if(window->frame_element)
413 fire_event(window->frame_element->element.node.doc, EVENTID_READYSTATECHANGE,
414 TRUE, window->frame_element->element.node.nsnode, NULL);
417 static HRESULT get_doc_string(HTMLDocumentNode *This, char **str)
426 WARN("NULL nsdoc\n");
430 nsres = nsIDOMHTMLDocument_QueryInterface(This->nsdoc, &IID_nsIDOMNode, (void**)&nsnode);
431 if(NS_FAILED(nsres)) {
432 ERR("Could not get nsIDOMNode failed: %08x\n", nsres);
436 nsAString_Init(&nsstr, NULL);
437 hres = nsnode_to_nsstring(nsnode, &nsstr);
438 nsIDOMNode_Release(nsnode);
440 nsAString_Finish(&nsstr);
444 nsAString_GetData(&nsstr, &strw);
445 TRACE("%s\n", debugstr_w(strw));
447 *str = heap_strdupWtoA(strw);
449 nsAString_Finish(&nsstr);
452 return E_OUTOFMEMORY;
457 /**********************************************************
458 * IPersistMoniker implementation
461 static inline HTMLDocument *impl_from_IPersistMoniker(IPersistMoniker *iface)
463 return CONTAINING_RECORD(iface, HTMLDocument, IPersistMoniker_iface);
466 static HRESULT WINAPI PersistMoniker_QueryInterface(IPersistMoniker *iface, REFIID riid, void **ppv)
468 HTMLDocument *This = impl_from_IPersistMoniker(iface);
469 return htmldoc_query_interface(This, riid, ppv);
472 static ULONG WINAPI PersistMoniker_AddRef(IPersistMoniker *iface)
474 HTMLDocument *This = impl_from_IPersistMoniker(iface);
475 return htmldoc_addref(This);
478 static ULONG WINAPI PersistMoniker_Release(IPersistMoniker *iface)
480 HTMLDocument *This = impl_from_IPersistMoniker(iface);
481 return htmldoc_release(This);
484 static HRESULT WINAPI PersistMoniker_GetClassID(IPersistMoniker *iface, CLSID *pClassID)
486 HTMLDocument *This = impl_from_IPersistMoniker(iface);
487 return IPersistFile_GetClassID(&This->IPersistFile_iface, pClassID);
490 static HRESULT WINAPI PersistMoniker_IsDirty(IPersistMoniker *iface)
492 HTMLDocument *This = impl_from_IPersistMoniker(iface);
494 TRACE("(%p)\n", This);
496 return IPersistStreamInit_IsDirty(&This->IPersistStreamInit_iface);
499 static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAvailable,
500 IMoniker *pimkName, LPBC pibc, DWORD grfMode)
502 HTMLDocument *This = impl_from_IPersistMoniker(iface);
505 TRACE("(%p)->(%x %p %p %08x)\n", This, fFullyAvailable, pimkName, pibc, grfMode);
508 IUnknown *unk = NULL;
512 * "__PrecreatedObject"
513 * "BIND_CONTEXT_PARAM"
514 * "__HTMLLOADOPTIONS"
517 * "_ITransData_Object_"
521 IBindCtx_GetObjectParam(pibc, (LPOLESTR)SZ_HTML_CLIENTSITE_OBJECTPARAM, &unk);
523 IOleClientSite *client = NULL;
525 hres = IUnknown_QueryInterface(unk, &IID_IOleClientSite, (void**)&client);
526 if(SUCCEEDED(hres)) {
527 TRACE("Got client site %p\n", client);
528 IOleObject_SetClientSite(&This->IOleObject_iface, client);
529 IOleClientSite_Release(client);
532 IUnknown_Release(unk);
536 prepare_for_binding(This, pimkName, FALSE);
537 call_docview_84(This->doc_obj);
538 hres = set_moniker(This, pimkName, pibc, NULL, TRUE);
542 return start_binding(This->window->pending_window, (BSCallback*)This->window->pending_window->bscallback, pibc);
545 static HRESULT WINAPI PersistMoniker_Save(IPersistMoniker *iface, IMoniker *pimkName,
546 LPBC pbc, BOOL fRemember)
548 HTMLDocument *This = impl_from_IPersistMoniker(iface);
549 FIXME("(%p)->(%p %p %x)\n", This, pimkName, pbc, fRemember);
553 static HRESULT WINAPI PersistMoniker_SaveCompleted(IPersistMoniker *iface, IMoniker *pimkName, LPBC pibc)
555 HTMLDocument *This = impl_from_IPersistMoniker(iface);
556 FIXME("(%p)->(%p %p)\n", This, pimkName, pibc);
560 static HRESULT WINAPI PersistMoniker_GetCurMoniker(IPersistMoniker *iface, IMoniker **ppimkName)
562 HTMLDocument *This = impl_from_IPersistMoniker(iface);
564 TRACE("(%p)->(%p)\n", This, ppimkName);
566 if(!This->window || !This->window->mon)
569 IMoniker_AddRef(This->window->mon);
570 *ppimkName = This->window->mon;
574 static const IPersistMonikerVtbl PersistMonikerVtbl = {
575 PersistMoniker_QueryInterface,
576 PersistMoniker_AddRef,
577 PersistMoniker_Release,
578 PersistMoniker_GetClassID,
579 PersistMoniker_IsDirty,
582 PersistMoniker_SaveCompleted,
583 PersistMoniker_GetCurMoniker
586 /**********************************************************
587 * IMonikerProp implementation
590 static inline HTMLDocument *impl_from_IMonikerProp(IMonikerProp *iface)
592 return CONTAINING_RECORD(iface, HTMLDocument, IMonikerProp_iface);
595 static HRESULT WINAPI MonikerProp_QueryInterface(IMonikerProp *iface, REFIID riid, void **ppv)
597 HTMLDocument *This = impl_from_IMonikerProp(iface);
598 return htmldoc_query_interface(This, riid, ppv);
601 static ULONG WINAPI MonikerProp_AddRef(IMonikerProp *iface)
603 HTMLDocument *This = impl_from_IMonikerProp(iface);
604 return htmldoc_addref(This);
607 static ULONG WINAPI MonikerProp_Release(IMonikerProp *iface)
609 HTMLDocument *This = impl_from_IMonikerProp(iface);
610 return htmldoc_release(This);
613 static HRESULT WINAPI MonikerProp_PutProperty(IMonikerProp *iface, MONIKERPROPERTY mkp, LPCWSTR val)
615 HTMLDocument *This = impl_from_IMonikerProp(iface);
617 TRACE("(%p)->(%d %s)\n", This, mkp, debugstr_w(val));
621 heap_free(This->doc_obj->mime);
622 This->doc_obj->mime = heap_strdupW(val);
629 FIXME("mkp %d\n", mkp);
636 static const IMonikerPropVtbl MonikerPropVtbl = {
637 MonikerProp_QueryInterface,
640 MonikerProp_PutProperty
643 /**********************************************************
644 * IPersistFile implementation
647 static inline HTMLDocument *impl_from_IPersistFile(IPersistFile *iface)
649 return CONTAINING_RECORD(iface, HTMLDocument, IPersistFile_iface);
652 static HRESULT WINAPI PersistFile_QueryInterface(IPersistFile *iface, REFIID riid, void **ppv)
654 HTMLDocument *This = impl_from_IPersistFile(iface);
655 return htmldoc_query_interface(This, riid, ppv);
658 static ULONG WINAPI PersistFile_AddRef(IPersistFile *iface)
660 HTMLDocument *This = impl_from_IPersistFile(iface);
661 return htmldoc_addref(This);
664 static ULONG WINAPI PersistFile_Release(IPersistFile *iface)
666 HTMLDocument *This = impl_from_IPersistFile(iface);
667 return htmldoc_release(This);
670 static HRESULT WINAPI PersistFile_GetClassID(IPersistFile *iface, CLSID *pClassID)
672 HTMLDocument *This = impl_from_IPersistFile(iface);
674 TRACE("(%p)->(%p)\n", This, pClassID);
679 *pClassID = CLSID_HTMLDocument;
683 static HRESULT WINAPI PersistFile_IsDirty(IPersistFile *iface)
685 HTMLDocument *This = impl_from_IPersistFile(iface);
687 TRACE("(%p)\n", This);
689 return IPersistStreamInit_IsDirty(&This->IPersistStreamInit_iface);
692 static HRESULT WINAPI PersistFile_Load(IPersistFile *iface, LPCOLESTR pszFileName, DWORD dwMode)
694 HTMLDocument *This = impl_from_IPersistFile(iface);
695 FIXME("(%p)->(%s %08x)\n", This, debugstr_w(pszFileName), dwMode);
699 static HRESULT WINAPI PersistFile_Save(IPersistFile *iface, LPCOLESTR pszFileName, BOOL fRemember)
701 HTMLDocument *This = impl_from_IPersistFile(iface);
707 TRACE("(%p)->(%s %x)\n", This, debugstr_w(pszFileName), fRemember);
709 file = CreateFileW(pszFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
710 FILE_ATTRIBUTE_NORMAL, NULL);
711 if(file == INVALID_HANDLE_VALUE) {
712 WARN("Could not create file: %u\n", GetLastError());
716 hres = get_doc_string(This->doc_node, &str);
718 WriteFile(file, str, strlen(str), &written, NULL);
724 static HRESULT WINAPI PersistFile_SaveCompleted(IPersistFile *iface, LPCOLESTR pszFileName)
726 HTMLDocument *This = impl_from_IPersistFile(iface);
727 FIXME("(%p)->(%s)\n", This, debugstr_w(pszFileName));
731 static HRESULT WINAPI PersistFile_GetCurFile(IPersistFile *iface, LPOLESTR *pszFileName)
733 HTMLDocument *This = impl_from_IPersistFile(iface);
734 FIXME("(%p)->(%p)\n", This, pszFileName);
738 static const IPersistFileVtbl PersistFileVtbl = {
739 PersistFile_QueryInterface,
742 PersistFile_GetClassID,
746 PersistFile_SaveCompleted,
747 PersistFile_GetCurFile
750 static inline HTMLDocument *impl_from_IPersistStreamInit(IPersistStreamInit *iface)
752 return CONTAINING_RECORD(iface, HTMLDocument, IPersistStreamInit_iface);
755 static HRESULT WINAPI PersistStreamInit_QueryInterface(IPersistStreamInit *iface,
756 REFIID riid, void **ppv)
758 HTMLDocument *This = impl_from_IPersistStreamInit(iface);
759 return htmldoc_query_interface(This, riid, ppv);
762 static ULONG WINAPI PersistStreamInit_AddRef(IPersistStreamInit *iface)
764 HTMLDocument *This = impl_from_IPersistStreamInit(iface);
765 return htmldoc_addref(This);
768 static ULONG WINAPI PersistStreamInit_Release(IPersistStreamInit *iface)
770 HTMLDocument *This = impl_from_IPersistStreamInit(iface);
771 return htmldoc_release(This);
774 static HRESULT WINAPI PersistStreamInit_GetClassID(IPersistStreamInit *iface, CLSID *pClassID)
776 HTMLDocument *This = impl_from_IPersistStreamInit(iface);
777 return IPersistFile_GetClassID(&This->IPersistFile_iface, pClassID);
780 static HRESULT WINAPI PersistStreamInit_IsDirty(IPersistStreamInit *iface)
782 HTMLDocument *This = impl_from_IPersistStreamInit(iface);
784 TRACE("(%p)\n", This);
786 if(This->doc_obj->usermode == EDITMODE)
787 return editor_is_dirty(This);
792 static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, LPSTREAM pStm)
794 HTMLDocument *This = impl_from_IPersistStreamInit(iface);
798 static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
800 TRACE("(%p)->(%p)\n", This, pStm);
802 hres = CreateURLMoniker(NULL, about_blankW, &mon);
804 WARN("CreateURLMoniker failed: %08x\n", hres);
808 prepare_for_binding(This, mon, FALSE);
809 hres = set_moniker(This, mon, NULL, NULL, TRUE);
810 IMoniker_Release(mon);
814 return channelbsc_load_stream(This->window->pending_window, pStm);
817 static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, LPSTREAM pStm,
820 HTMLDocument *This = impl_from_IPersistStreamInit(iface);
825 TRACE("(%p)->(%p %x)\n", This, pStm, fClearDirty);
827 hres = get_doc_string(This->doc_node, &str);
831 hres = IStream_Write(pStm, str, strlen(str), &written);
833 FIXME("Write failed: %08x\n", hres);
838 set_dirty(This, VARIANT_FALSE);
843 static HRESULT WINAPI PersistStreamInit_GetSizeMax(IPersistStreamInit *iface,
844 ULARGE_INTEGER *pcbSize)
846 HTMLDocument *This = impl_from_IPersistStreamInit(iface);
847 FIXME("(%p)->(%p)\n", This, pcbSize);
851 static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface)
853 HTMLDocument *This = impl_from_IPersistStreamInit(iface);
857 static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
859 TRACE("(%p)\n", This);
861 hres = CreateURLMoniker(NULL, about_blankW, &mon);
863 WARN("CreateURLMoniker failed: %08x\n", hres);
867 prepare_for_binding(This, mon, FALSE);
868 hres = set_moniker(This, mon, NULL, NULL, FALSE);
869 IMoniker_Release(mon);
873 return channelbsc_load_stream(This->window->pending_window, NULL);
876 static const IPersistStreamInitVtbl PersistStreamInitVtbl = {
877 PersistStreamInit_QueryInterface,
878 PersistStreamInit_AddRef,
879 PersistStreamInit_Release,
880 PersistStreamInit_GetClassID,
881 PersistStreamInit_IsDirty,
882 PersistStreamInit_Load,
883 PersistStreamInit_Save,
884 PersistStreamInit_GetSizeMax,
885 PersistStreamInit_InitNew
888 /**********************************************************
889 * IPersistHistory implementation
892 static inline HTMLDocument *impl_from_IPersistHistory(IPersistHistory *iface)
894 return CONTAINING_RECORD(iface, HTMLDocument, IPersistHistory_iface);
897 static HRESULT WINAPI PersistHistory_QueryInterface(IPersistHistory *iface, REFIID riid, void **ppv)
899 HTMLDocument *This = impl_from_IPersistHistory(iface);
900 return htmldoc_query_interface(This, riid, ppv);
903 static ULONG WINAPI PersistHistory_AddRef(IPersistHistory *iface)
905 HTMLDocument *This = impl_from_IPersistHistory(iface);
906 return htmldoc_addref(This);
909 static ULONG WINAPI PersistHistory_Release(IPersistHistory *iface)
911 HTMLDocument *This = impl_from_IPersistHistory(iface);
912 return htmldoc_release(This);
915 static HRESULT WINAPI PersistHistory_GetClassID(IPersistHistory *iface, CLSID *pClassID)
917 HTMLDocument *This = impl_from_IPersistHistory(iface);
918 return IPersistFile_GetClassID(&This->IPersistFile_iface, pClassID);
921 static HRESULT WINAPI PersistHistory_LoadHistory(IPersistHistory *iface, IStream *pStream, IBindCtx *pbc)
923 HTMLDocument *This = impl_from_IPersistHistory(iface);
924 FIXME("(%p)->(%p %p)\n", This, pStream, pbc);
928 static HRESULT WINAPI PersistHistory_SaveHistory(IPersistHistory *iface, IStream *pStream)
930 HTMLDocument *This = impl_from_IPersistHistory(iface);
931 FIXME("(%p)->(%p)\n", This, pStream);
935 static HRESULT WINAPI PersistHistory_SetPositionCookie(IPersistHistory *iface, DWORD dwPositioncookie)
937 HTMLDocument *This = impl_from_IPersistHistory(iface);
938 FIXME("(%p)->(%x)\n", This, dwPositioncookie);
942 static HRESULT WINAPI PersistHistory_GetPositionCookie(IPersistHistory *iface, DWORD *pdwPositioncookie)
944 HTMLDocument *This = impl_from_IPersistHistory(iface);
945 FIXME("(%p)->(%p)\n", This, pdwPositioncookie);
949 static const IPersistHistoryVtbl PersistHistoryVtbl = {
950 PersistHistory_QueryInterface,
951 PersistHistory_AddRef,
952 PersistHistory_Release,
953 PersistHistory_GetClassID,
954 PersistHistory_LoadHistory,
955 PersistHistory_SaveHistory,
956 PersistHistory_SetPositionCookie,
957 PersistHistory_GetPositionCookie
960 void HTMLDocument_Persist_Init(HTMLDocument *This)
962 This->IPersistMoniker_iface.lpVtbl = &PersistMonikerVtbl;
963 This->IPersistFile_iface.lpVtbl = &PersistFileVtbl;
964 This->IMonikerProp_iface.lpVtbl = &MonikerPropVtbl;
965 This->IPersistStreamInit_iface.lpVtbl = &PersistStreamInitVtbl;
966 This->IPersistHistory_iface.lpVtbl = &PersistHistoryVtbl;