nsIconChannel.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2. *
  3. * This Source Code Form is subject to the terms of the Mozilla Public
  4. * License, v. 2.0. If a copy of the MPL was not distributed with this
  5. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  6. #ifndef mozilla_image_encoders_icon_win_nsIconChannel_h
  7. #define mozilla_image_encoders_icon_win_nsIconChannel_h
  8. #include "mozilla/Attributes.h"
  9. #include "nsCOMPtr.h"
  10. #include "nsXPIDLString.h"
  11. #include "nsIChannel.h"
  12. #include "nsILoadGroup.h"
  13. #include "nsILoadInfo.h"
  14. #include "nsIInterfaceRequestor.h"
  15. #include "nsIInterfaceRequestorUtils.h"
  16. #include "nsIURI.h"
  17. #include "nsIInputStreamPump.h"
  18. #include "nsIStreamListener.h"
  19. #include "nsIIconURI.h"
  20. #include <windows.h>
  21. class nsIFile;
  22. class nsIconChannel final : public nsIChannel, public nsIStreamListener
  23. {
  24. ~nsIconChannel();
  25. public:
  26. NS_DECL_THREADSAFE_ISUPPORTS
  27. NS_DECL_NSIREQUEST
  28. NS_DECL_NSICHANNEL
  29. NS_DECL_NSIREQUESTOBSERVER
  30. NS_DECL_NSISTREAMLISTENER
  31. nsIconChannel();
  32. nsresult Init(nsIURI* uri);
  33. protected:
  34. nsCOMPtr<nsIURI> mUrl;
  35. nsCOMPtr<nsIURI> mOriginalURI;
  36. nsCOMPtr<nsILoadGroup> mLoadGroup;
  37. nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
  38. nsCOMPtr<nsISupports> mOwner;
  39. nsCOMPtr<nsILoadInfo> mLoadInfo;
  40. nsCOMPtr<nsIInputStreamPump> mPump;
  41. nsCOMPtr<nsIStreamListener> mListener;
  42. nsresult ExtractIconInfoFromUrl(nsIFile** aLocalFile,
  43. uint32_t* aDesiredImageSize,
  44. nsCString& aContentType,
  45. nsCString& aFileExtension);
  46. nsresult GetHIconFromFile(HICON* hIcon);
  47. nsresult MakeInputStream(nsIInputStream** _retval, bool nonBlocking);
  48. // Functions specific to Vista and above
  49. protected:
  50. nsresult GetStockHIcon(nsIMozIconURI* aIconURI, HICON* hIcon);
  51. };
  52. #endif // mozilla_image_encoders_icon_win_nsIconChannel_h