r=mkaply, sr=blizzard
Same patch as 229695 for Windows to use MIME type for download icon


git-svn-id: svn://10.0.0.236/trunk@153702 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mkaply%us.ibm.com 2004-03-08 22:39:47 +00:00
parent 92c78c6e3e
commit b973d7127e

View File

@ -438,18 +438,19 @@ nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBloc
else
infoFlags |= SHGFI_SMALLICON;
if ( (filePath.IsEmpty()) && (contentType.get() && *contentType.get()) ) // if we have a content type without a file extension...then use it!
// if we have a content type... then use it! but for existing files, we want
// to show their real icon.
if (!fileExists && !contentType.IsEmpty())
{
nsCOMPtr<nsIMIMEService> mimeService (do_GetService(NS_MIMESERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
nsXPIDLCString fileExt;
rv = mimeService->GetPrimaryExtension(contentType.get(), nsnull, getter_Copies(fileExt));
if (NS_SUCCEEDED(rv))
{
// we need to insert a '.' before the extension...
filePath = NS_LITERAL_CSTRING(".") + fileExt;
}
mimeService->GetPrimaryExtension(contentType.get(), nsnull, getter_Copies(fileExt));
// If the mime service does not know about this mime type, we show
// the generic icon.
// In any case, we need to insert a '.' before the extension.
filePath = NS_LITERAL_CSTRING(".") + fileExt;
}
// (1) get an hIcon for the file