Bug 461849 - enable icon decoder on Windows Mobile. r=stuart
authorDoug Turner <dougt@meer.net>
Thu, 19 Feb 2009 18:56:49 -0800
changeset 23903 7d6ca5277d4aa8ec7b42f859d82f95a8cfd217d2
parent 23902 9ef760885920501df8e485671c1611e461178c95
child 23904 5997a9c48915c32d0fd4fad0f3490e9086520de2
push id978
push userdougt@mozilla.com
push dateWed, 25 Mar 2009 02:36:59 +0000
reviewersstuart
bugs461849
milestone1.9.1b4pre
Bug 461849 - enable icon decoder on Windows Mobile. r=stuart
modules/libpr0n/decoders/icon/win/nsIconChannel.cpp
--- 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;
 }