mshtml: Moved OLECMDID_SETDOWNLOADSTATE call to separated function.

This commit is contained in:
Jacek Caban 2011-07-23 12:50:49 +02:00 committed by Alexandre Julliard
parent e325be79dc
commit 402c875699
3 changed files with 49 additions and 41 deletions

View File

@ -692,6 +692,7 @@ void set_current_mon(HTMLWindow*,IMoniker*) DECLSPEC_HIDDEN;
HRESULT start_binding(HTMLWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN; HRESULT start_binding(HTMLWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
HRESULT async_start_doc_binding(HTMLWindow*,nsChannelBSC*) DECLSPEC_HIDDEN; HRESULT async_start_doc_binding(HTMLWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
void abort_document_bindings(HTMLDocumentNode*) DECLSPEC_HIDDEN; void abort_document_bindings(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*) DECLSPEC_HIDDEN; HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*) DECLSPEC_HIDDEN;

View File

@ -184,6 +184,7 @@ static nsresult NSAPI handle_keypress(nsIDOMEventListener *iface,
static void handle_docobj_load(HTMLDocumentObj *doc) static void handle_docobj_load(HTMLDocumentObj *doc)
{ {
IOleCommandTarget *olecmd = NULL;
HRESULT hres; HRESULT hres;
if(doc->nscontainer->editor_controller) { if(doc->nscontainer->editor_controller) {
@ -195,33 +196,31 @@ static void handle_docobj_load(HTMLDocumentObj *doc)
handle_edit_load(&doc->basedoc); handle_edit_load(&doc->basedoc);
if(doc->client) { if(doc->client) {
IOleCommandTarget *olecmd = NULL;
hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd); hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
if(SUCCEEDED(hres)) { if(FAILED(hres))
olecmd = NULL;
}
if(doc->download_state) { if(doc->download_state) {
VARIANT state, progress; if(olecmd) {
VARIANT progress;
V_VT(&progress) = VT_I4; V_VT(&progress) = VT_I4;
V_I4(&progress) = 0; V_I4(&progress) = 0;
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETPROGRESSPOS, IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETPROGRESSPOS,
OLECMDEXECOPT_DONTPROMPTUSER, &progress, NULL); OLECMDEXECOPT_DONTPROMPTUSER, &progress, NULL);
V_VT(&state) = VT_I4;
V_I4(&state) = 0;
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETDOWNLOADSTATE,
OLECMDEXECOPT_DONTPROMPTUSER, &state, NULL);
} }
set_download_state(doc, 0);
}
if(olecmd) {
IOleCommandTarget_Exec(olecmd, &CGID_ShellDocView, 103, 0, NULL, NULL); IOleCommandTarget_Exec(olecmd, &CGID_ShellDocView, 103, 0, NULL, NULL);
IOleCommandTarget_Exec(olecmd, &CGID_MSHTML, IDM_PARSECOMPLETE, 0, NULL, NULL); IOleCommandTarget_Exec(olecmd, &CGID_MSHTML, IDM_PARSECOMPLETE, 0, NULL, NULL);
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_HTTPEQUIV_DONE, 0, NULL, NULL); IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_HTTPEQUIV_DONE, 0, NULL, NULL);
IOleCommandTarget_Release(olecmd); IOleCommandTarget_Release(olecmd);
} }
}
doc->download_state = 0;
} }
static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event) static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event)

View File

@ -94,6 +94,28 @@ void set_current_mon(HTMLWindow *This, IMoniker *mon)
set_script_mode(This, use_gecko_script(This) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT); set_script_mode(This, use_gecko_script(This) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT);
} }
void set_download_state(HTMLDocumentObj *doc, int state)
{
if(doc->client) {
IOleCommandTarget *olecmd;
HRESULT hres;
hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
if(SUCCEEDED(hres)) {
VARIANT var;
V_VT(&var) = VT_I4;
V_I4(&var) = state;
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETDOWNLOADSTATE,
OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
IOleCommandTarget_Release(olecmd);
}
}
doc->download_state = state;
}
static void set_progress_proc(task_t *_task) static void set_progress_proc(task_t *_task)
{ {
docobj_task_t *task = (docobj_task_t*)_task; docobj_task_t *task = (docobj_task_t*)_task;
@ -139,7 +161,6 @@ static void set_downloading_proc(task_t *_task)
{ {
download_proc_task_t *task = (download_proc_task_t*)_task; download_proc_task_t *task = (download_proc_task_t*)_task;
HTMLDocumentObj *doc = task->doc; HTMLDocumentObj *doc = task->doc;
IOleCommandTarget *olecmd;
HRESULT hres; HRESULT hres;
TRACE("(%p)\n", doc); TRACE("(%p)\n", doc);
@ -147,25 +168,12 @@ static void set_downloading_proc(task_t *_task)
set_statustext(doc, IDS_STATUS_DOWNLOADINGFROM, task->url); set_statustext(doc, IDS_STATUS_DOWNLOADINGFROM, task->url);
CoTaskMemFree(task->url); CoTaskMemFree(task->url);
if(task->set_download)
set_download_state(doc, 1);
if(!doc->client) if(!doc->client)
return; return;
if(task->set_download) {
hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
if(SUCCEEDED(hres)) {
VARIANT var;
V_VT(&var) = VT_I4;
V_I4(&var) = 1;
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETDOWNLOADSTATE,
OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
IOleCommandTarget_Release(olecmd);
}
doc->download_state = 1;
}
if(doc->view_sink) if(doc->view_sink)
IAdviseSink_OnViewChange(doc->view_sink, DVASPECT_CONTENT, -1); IAdviseSink_OnViewChange(doc->view_sink, DVASPECT_CONTENT, -1);