|
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 |
|
7 #ifndef nsIconChannel_h___ |
|
8 #define nsIconChannel_h___ |
|
9 |
|
10 #include "mozilla/Attributes.h" |
|
11 |
|
12 #include "nsCOMPtr.h" |
|
13 #include "nsXPIDLString.h" |
|
14 #include "nsIChannel.h" |
|
15 #include "nsILoadGroup.h" |
|
16 #include "nsIInterfaceRequestor.h" |
|
17 #include "nsIInterfaceRequestorUtils.h" |
|
18 #include "nsIURI.h" |
|
19 #include "nsIInputStreamPump.h" |
|
20 #include "nsIStreamListener.h" |
|
21 #include "nsIIconURI.h" |
|
22 |
|
23 #include <windows.h> |
|
24 |
|
25 class nsIFile; |
|
26 |
|
27 class nsIconChannel MOZ_FINAL : public nsIChannel, public nsIStreamListener |
|
28 { |
|
29 public: |
|
30 NS_DECL_THREADSAFE_ISUPPORTS |
|
31 NS_DECL_NSIREQUEST |
|
32 NS_DECL_NSICHANNEL |
|
33 NS_DECL_NSIREQUESTOBSERVER |
|
34 NS_DECL_NSISTREAMLISTENER |
|
35 |
|
36 nsIconChannel(); |
|
37 ~nsIconChannel(); |
|
38 |
|
39 nsresult Init(nsIURI* uri); |
|
40 |
|
41 protected: |
|
42 nsCOMPtr<nsIURI> mUrl; |
|
43 nsCOMPtr<nsIURI> mOriginalURI; |
|
44 int64_t mContentLength; |
|
45 nsCOMPtr<nsILoadGroup> mLoadGroup; |
|
46 nsCOMPtr<nsIInterfaceRequestor> mCallbacks; |
|
47 nsCOMPtr<nsISupports> mOwner; |
|
48 |
|
49 nsCOMPtr<nsIInputStreamPump> mPump; |
|
50 nsCOMPtr<nsIStreamListener> mListener; |
|
51 |
|
52 nsresult ExtractIconInfoFromUrl(nsIFile ** aLocalFile, uint32_t * aDesiredImageSize, nsCString &aContentType, nsCString &aFileExtension); |
|
53 nsresult GetHIconFromFile(HICON *hIcon); |
|
54 nsresult MakeInputStream(nsIInputStream** _retval, bool nonBlocking); |
|
55 |
|
56 // Functions specific to Vista and above |
|
57 protected: |
|
58 nsresult GetStockHIcon(nsIMozIconURI *aIconURI, HICON *hIcon); |
|
59 }; |
|
60 |
|
61 #endif /* nsIconChannel_h___ */ |