Bug 461849 - enable icon decoder on Windows Mobile. r=stuart
--- a/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp
+++ b/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp
@@ -254,16 +254,17 @@ NS_IMETHODIMP nsIconChannel::AsyncOpen(n
mListener = aListener;
// Add ourself to the load group, if available
if (mLoadGroup)
mLoadGroup->AddRequest(this, nsnull);
}
return rv;
}
+#ifndef WINCE
static DWORD GetSpecialFolderIcon(nsIFile* aFile, int aFolder, SHFILEINFOW* aSFI, UINT aInfoFlags)
{
DWORD shellResult = 0;
if (!aFile)
return shellResult;
PRUnichar fileNativePath[MAX_PATH];
@@ -287,32 +288,38 @@ static DWORD GetSpecialFolderIcon(nsIFil
if (SUCCEEDED(hr)) {
pMalloc->Free(idList);
pMalloc->Release();
}
}
}
return shellResult;
}
+#endif
static UINT GetSizeInfoFlag(PRUint32 aDesiredImageSize)
{
UINT infoFlag;
#ifndef WINCE
+ // SHGFI_SHELLICONSIZE does not exist on windows mobile.
if (aDesiredImageSize > 16)
infoFlag = SHGFI_SHELLICONSIZE;
else
#endif
infoFlag = SHGFI_SMALLICON;
return infoFlag;
}
nsresult nsIconChannel::GetHIconFromFile(HICON *hIcon)
{
+#ifdef WINCE
+ // GetDIBits does not exist on windows mobile.
+ return NS_ERROR_NOT_AVAILABLE;
+#else
nsXPIDLCString contentType;
nsCString fileExt;
nsCOMPtr<nsIFile> localFile; // file we want an icon for
PRUint32 desiredImageSize;
nsresult rv = ExtractIconInfoFromUrl(getter_AddRefs(localFile), &desiredImageSize, contentType, fileExt);
NS_ENSURE_SUCCESS(rv, rv);
// if the file exists, we are going to use it's real attributes...otherwise we only want to use it for it's extension...
@@ -378,16 +385,17 @@ nsresult nsIconChannel::GetHIconFromFile
FILE_ATTRIBUTE_ARCHIVE, &sfi, sizeof(sfi), infoFlags);
if (shellResult && sfi.hIcon)
*hIcon = sfi.hIcon;
else
rv = NS_ERROR_NOT_AVAILABLE;
return rv;
+#endif
}
#ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS
nsresult nsIconChannel::GetStockHIcon(nsIMozIconURI *aIconURI, HICON *hIcon)
{
nsresult rv = NS_OK;
// We can only do this on Vista or above
@@ -428,17 +436,20 @@ nsresult nsIconChannel::GetStockHIcon(ns
return rv;
}
#endif
nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking)
{
// Check whether the icon requested's a file icon or a stock icon
- nsresult rv;
+ nsresult rv = NS_ERROR_NOT_AVAILABLE;
+
+ // GetDIBits does not exist on windows mobile.
+#ifndef WINCE
HICON hIcon = NULL;
#ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS
nsCOMPtr<nsIMozIconURI> iconURI(do_QueryInterface(mUrl, &rv));
NS_ENSURE_SUCCESS(rv, rv);
nsCAutoString stockIcon;
iconURI->GetStockIcon(stockIcon);
@@ -517,16 +528,17 @@ nsresult nsIconChannel::MakeInputStream(
DeleteDC(hDC);
DeleteObject(iconInfo.hbmColor);
DeleteObject(iconInfo.hbmMask);
} // if we got icon info
DestroyIcon(hIcon);
} // if we got an hIcon
+#endif
return rv;
}
NS_IMETHODIMP nsIconChannel::GetContentType(nsACString &aContentType)
{
aContentType.AssignLiteral("image/x-icon");
return NS_OK;
}