HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, nsChannelBSC *async_bsc, BOOL set_download) { nsChannelBSC *bscallback; docobj_task_t *task; download_proc_task_t *download_task; nsWineURI *nsuri; LPOLESTR url; HRESULT hres; hres = IMoniker_GetDisplayName(mon, pibc, NULL, &url); if(FAILED(hres)) { WARN("GetDiaplayName failed: %08x\n", hres); return hres; } TRACE("got url: %s\n", debugstr_w(url)); if(This->doc_obj->client) { VARIANT silent, offline; hres = get_client_disp_property(This->doc_obj->client, DISPID_AMBIENT_SILENT, &silent); if(SUCCEEDED(hres)) { if(V_VT(&silent) != VT_BOOL) WARN("V_VT(silent) = %d\n", V_VT(&silent)); else if(V_BOOL(&silent)) FIXME("silent == true\n"); } hres = get_client_disp_property(This->doc_obj->client, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED, &offline); if(SUCCEEDED(hres)) { if(V_VT(&offline) != VT_BOOL) WARN("V_VT(offline) = %d\n", V_VT(&offline)); else if(V_BOOL(&offline)) FIXME("offline == true\n"); } } if(This->window->mon) { update_doc(This, UPDATE_TITLE|UPDATE_UI); }else { update_doc(This, UPDATE_TITLE); set_current_mon(This->window, mon); } set_ready_state(This->window, READYSTATE_LOADING); if(This->doc_obj->client) { IOleCommandTarget *cmdtrg = NULL; hres = IOleClientSite_QueryInterface(This->doc_obj->client, &IID_IOleCommandTarget, (void**)&cmdtrg); if(SUCCEEDED(hres)) { VARIANT var, out; if(!async_bsc) { V_VT(&var) = VT_I4; V_I4(&var) = 0; IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 37, 0, &var, NULL); }else { V_VT(&var) = VT_UNKNOWN; V_UNKNOWN(&var) = (IUnknown*)&This->window->IHTMLWindow2_iface; V_VT(&out) = VT_EMPTY; hres = IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 63, 0, &var, &out); if(SUCCEEDED(hres)) VariantClear(&out); } IOleCommandTarget_Release(cmdtrg); } } hres = create_doc_uri(This->window, url, &nsuri); if(SUCCEEDED(hres)) { if(async_bsc) { bscallback = async_bsc; }else { hres = create_channelbsc(mon, NULL, NULL, 0, &bscallback); } } if(SUCCEEDED(hres)) { remove_target_tasks(This->task_magic); abort_document_bindings(This->doc_node); hres = load_nsuri(This->window, nsuri, bscallback, LOAD_INITIAL_DOCUMENT_URI); nsISupports_Release((nsISupports*)nsuri); /* FIXME */ if(SUCCEEDED(hres)) set_window_bscallback(This->window, bscallback); if(bscallback != async_bsc) IUnknown_Release((IUnknown*)bscallback); } if(FAILED(hres)) { CoTaskMemFree(url); return hres; } HTMLDocument_LockContainer(This->doc_obj, TRUE); if(This->doc_obj->frame) { task = heap_alloc(sizeof(docobj_task_t)); task->doc = This->doc_obj; push_task(&task->header, set_progress_proc, This->doc_obj->basedoc.task_magic); } download_task = heap_alloc(sizeof(download_proc_task_t)); download_task->doc = This->doc_obj; download_task->set_download = set_download; download_task->url = url; push_task(&download_task->header, set_downloading_proc, This->doc_obj->basedoc.task_magic); return S_OK; }
HRESULT set_moniker(HTMLOuterWindow *window, IMoniker *mon, IUri *nav_uri, IBindCtx *pibc, nsChannelBSC *async_bsc, BOOL set_download) { download_proc_task_t *download_task; HTMLDocumentObj *doc_obj = NULL; nsChannelBSC *bscallback; nsWineURI *nsuri; LPOLESTR url; IUri *uri; HRESULT hres; if(window->doc_obj && window->doc_obj->basedoc.window == window) doc_obj = window->doc_obj; hres = IMoniker_GetDisplayName(mon, pibc, NULL, &url); if(FAILED(hres)) { WARN("GetDiaplayName failed: %08x\n", hres); return hres; } if(nav_uri) { uri = nav_uri; }else { hres = create_uri(url, 0, &uri); if(FAILED(hres)) { CoTaskMemFree(url); return hres; } } TRACE("got url: %s\n", debugstr_w(url)); set_ready_state(window, READYSTATE_LOADING); hres = create_doc_uri(window, uri, &nsuri); if(!nav_uri) IUri_Release(uri); if(SUCCEEDED(hres)) { if(async_bsc) bscallback = async_bsc; else hres = create_channelbsc(mon, NULL, NULL, 0, TRUE, &bscallback); } if(SUCCEEDED(hres)) { if(window->base.inner_window->doc) remove_target_tasks(window->base.inner_window->task_magic); abort_window_bindings(window->base.inner_window); hres = load_nsuri(window, nsuri, bscallback, LOAD_FLAGS_BYPASS_CACHE); nsISupports_Release((nsISupports*)nsuri); /* FIXME */ if(SUCCEEDED(hres)) { hres = create_pending_window(window, bscallback); TRACE("pending window for %p %p %p\n", window, bscallback, window->pending_window); } if(bscallback != async_bsc) IBindStatusCallback_Release(&bscallback->bsc.IBindStatusCallback_iface); } if(FAILED(hres)) { CoTaskMemFree(url); return hres; } if(doc_obj) { HTMLDocument_LockContainer(doc_obj, TRUE); if(doc_obj->frame) { docobj_task_t *task; task = heap_alloc(sizeof(docobj_task_t)); task->doc = doc_obj; hres = push_task(&task->header, set_progress_proc, NULL, doc_obj->basedoc.task_magic); if(FAILED(hres)) { CoTaskMemFree(url); return hres; } } download_task = heap_alloc(sizeof(download_proc_task_t)); download_task->doc = doc_obj; download_task->set_download = set_download; download_task->url = url; return push_task(&download_task->header, set_downloading_proc, set_downloading_task_destr, doc_obj->basedoc.task_magic); } return S_OK; }
HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, nsChannelBSC *async_bsc, BOOL set_download) { download_proc_task_t *download_task; nsChannelBSC *bscallback; nsWineURI *nsuri; LPOLESTR url; HRESULT hres; hres = IMoniker_GetDisplayName(mon, pibc, NULL, &url); if(FAILED(hres)) { WARN("GetDiaplayName failed: %08x\n", hres); return hres; } TRACE("got url: %s\n", debugstr_w(url)); set_ready_state(This->window, READYSTATE_LOADING); hres = create_doc_uri(This->window, url, &nsuri); if(SUCCEEDED(hres)) { if(async_bsc) bscallback = async_bsc; else hres = create_channelbsc(mon, NULL, NULL, 0, &bscallback); } if(SUCCEEDED(hres)) { remove_target_tasks(This->task_magic); abort_document_bindings(This->doc_node); hres = load_nsuri(This->window, nsuri, bscallback, 0/*LOAD_INITIAL_DOCUMENT_URI*/); nsISupports_Release((nsISupports*)nsuri); /* FIXME */ if(SUCCEEDED(hres)) set_window_bscallback(This->window, bscallback); if(bscallback != async_bsc) IUnknown_Release((IUnknown*)bscallback); } if(FAILED(hres)) { CoTaskMemFree(url); return hres; } HTMLDocument_LockContainer(This->doc_obj, TRUE); if(This->doc_obj->frame) { docobj_task_t *task; task = heap_alloc(sizeof(docobj_task_t)); task->doc = This->doc_obj; push_task(&task->header, set_progress_proc, NULL, This->doc_obj->basedoc.task_magic); } download_task = heap_alloc(sizeof(download_proc_task_t)); download_task->doc = This->doc_obj; download_task->set_download = set_download; download_task->url = url; push_task(&download_task->header, set_downloading_proc, set_downloading_task_destr, This->doc_obj->basedoc.task_magic); return S_OK; }