Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions
nsIconChannel.cpp File Reference
#include "nsIconChannel.h"
#include "nsIIconURI.h"
#include "nsIServiceManager.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsMimeTypes.h"
#include "nsMemory.h"
#include "nsIStringStream.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
#include "nsInt64.h"
#include "nsIFile.h"
#include "nsIFileURL.h"
#include "nsIMIMEService.h"
#include "nsCExternalHandlerService.h"
#include "nsDirectoryServiceDefs.h"
#include <windows.h>
#include <shellapi.h>
#include <shlobj.h>

Go to the source code of this file.

Classes

struct  ICONFILEHEADER
struct  ICONENTRY

Functions

 NS_IMPL_THREADSAFE_ISUPPORTS4 (nsIconChannel, nsIChannel, nsIRequest, nsIRequestObserver, nsIStreamListener) nsresult nsIconChannel
static DWORD GetSpecialFolderIcon (nsIFile *aFile, int aFolder, SHFILEINFO *aSFI, UINT aInfoFlags)

Class Documentation

struct ICONFILEHEADER

Definition at line 67 of file nsIconChannel.cpp.

Class Members
PRUint16 ifhCount
PRUint16 ifhReserved
PRUint16 ifhType
struct ICONENTRY

Definition at line 73 of file nsIconChannel.cpp.

Class Members
PRUint16 ieBitCount
PRUint8 ieColors
PRUint32 ieFileOffset
PRInt8 ieHeight
PRUint16 iePlanes
PRUint8 ieReserved
PRUint32 ieSizeImage
PRInt8 ieWidth

Function Documentation

static DWORD GetSpecialFolderIcon ( nsIFile aFile,
int  aFolder,
SHFILEINFO *  aSFI,
UINT  aInfoFlags 
) [static]

Definition at line 239 of file nsIconChannel.cpp.

{
  DWORD shellResult = 0;

  if (!aFile)
    return shellResult;

  char fileNativePath[MAX_PATH];
  nsCAutoString fileNativePathStr;
  aFile->GetNativePath(fileNativePathStr);
  ::GetShortPathName(fileNativePathStr.get(), fileNativePath, sizeof(fileNativePath));

  LPITEMIDLIST idList;
  HRESULT hr = ::SHGetSpecialFolderLocation(NULL, aFolder, &idList);
  if (SUCCEEDED(hr)) {
    char specialNativePath[MAX_PATH];
    ::SHGetPathFromIDList(idList, specialNativePath);
    ::GetShortPathName(specialNativePath, specialNativePath, sizeof(specialNativePath));
  
    if (nsDependentCString(fileNativePath).EqualsIgnoreCase(specialNativePath)) {
      aInfoFlags |= (SHGFI_PIDL | SHGFI_SYSICONINDEX);
      shellResult = ::SHGetFileInfo((LPCTSTR)(LPCITEMIDLIST)idList, 0, aSFI, 
                                    sizeof(SHFILEINFO), aInfoFlags);
      IMalloc* pMalloc;
      hr = ::SHGetMalloc(&pMalloc);
      if (SUCCEEDED(hr)) {
        pMalloc->Free(idList);
        pMalloc->Release();
      }
    }
  }
  return shellResult;
}

Here is the call graph for this function:

Definition at line 92 of file nsIconChannel.cpp.

{
  NS_ASSERTION(uri, "no uri");
  mUrl = uri;

  nsresult rv;
  mPump = do_CreateInstance(NS_INPUTSTREAMPUMP_CONTRACTID, &rv);
  return rv;
}

Here is the call graph for this function: