mshtml: Use mime type reported by moniker if possible.

This commit is contained in:
Jacek Caban 2006-06-03 00:48:13 +02:00 committed by Alexandre Julliard
parent 42f96fce67
commit 56bb028611
3 changed files with 24 additions and 0 deletions

View File

@ -129,6 +129,7 @@ typedef struct {
nsIInterfaceRequestor *notif_callback;
nsLoadFlags load_flags;
nsIURI *original_uri;
char *content;
} nsChannel;
typedef struct {

View File

@ -268,8 +268,24 @@ static HRESULT WINAPI BindStatusCallback_OnProgress(IBindStatusCallback *iface,
ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
{
BSCallback *This = STATUSCLB_THIS(iface);
TRACE("%p)->(%lu %lu %lu %s)\n", This, ulProgress, ulProgressMax, ulStatusCode,
debugstr_w(szStatusText));
switch(ulStatusCode) {
case BINDSTATUS_MIMETYPEAVAILABLE: {
int len;
if(!This->nschannel)
return S_OK;
HeapFree(GetProcessHeap(), 0, This->nschannel->content);
len = WideCharToMultiByte(CP_ACP, 0, szStatusText, -1, NULL, 0, NULL, NULL);
This->nschannel->content = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
WideCharToMultiByte(CP_ACP, 0, szStatusText, -1, This->nschannel->content, -1, NULL, NULL);
}
}
return S_OK;
}

View File

@ -213,6 +213,7 @@ static nsrefcnt NSAPI nsChannel_Release(nsIHttpChannel *iface)
nsIInterfaceRequestor_Release(This->notif_callback);
if(This->original_uri)
nsIURI_Release(This->original_uri);
HeapFree(GetProcessHeap(), 0, This->content);
HeapFree(GetProcessHeap(), 0, This);
}
@ -465,6 +466,11 @@ static nsresult NSAPI nsChannel_GetContentType(nsIHttpChannel *iface, nsACString
TRACE("(%p)->(%p)\n", This, aContentType);
if(This->content) {
nsACString_Init(aContentType, This->content);
return S_OK;
}
if(This->channel)
return nsIChannel_GetContentType(This->channel, aContentType);
@ -1450,6 +1456,7 @@ static nsresult NSAPI nsIOService_NewChannelFromURI(nsIIOService *iface, nsIURI
ret->load_group = NULL;
ret->notif_callback = NULL;
ret->load_flags = 0;
ret->content = NULL;
nsIURI_AddRef(aURI);
ret->original_uri = aURI;