|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #ifndef nsIconChannel_h_ |
|
6 #define nsIconChannel_h_ |
|
7 |
|
8 #include "mozilla/Attributes.h" |
|
9 |
|
10 #include "nsIChannel.h" |
|
11 #include "nsIStreamListener.h" |
|
12 #include "nsIURI.h" |
|
13 #include "nsIIconURI.h" |
|
14 #include "nsCOMPtr.h" |
|
15 |
|
16 /** |
|
17 * This class is the gnome implementation of nsIconChannel. It basically asks |
|
18 * gtk/gnome for an icon, saves it as a tmp icon, and creates a new channel for |
|
19 * that file to which all calls will be proxied. |
|
20 */ |
|
21 class nsIconChannel MOZ_FINAL : public nsIChannel { |
|
22 public: |
|
23 NS_DECL_ISUPPORTS |
|
24 NS_FORWARD_NSIREQUEST(mRealChannel->) |
|
25 NS_FORWARD_NSICHANNEL(mRealChannel->) |
|
26 |
|
27 nsIconChannel() {} |
|
28 ~nsIconChannel() {} |
|
29 |
|
30 static void Shutdown(); |
|
31 |
|
32 /** |
|
33 * Called by nsIconProtocolHandler after it creates this channel. |
|
34 * Must be called before calling any other function on this object. |
|
35 * If this method fails, no other function must be called on this object. |
|
36 */ |
|
37 NS_HIDDEN_(nsresult) Init(nsIURI* aURI); |
|
38 private: |
|
39 /** |
|
40 * The channel to the temp icon file (e.g. to /tmp/2qy9wjqw.html). |
|
41 * Will always be non-null after a successful Init. |
|
42 */ |
|
43 nsCOMPtr<nsIChannel> mRealChannel; |
|
44 |
|
45 /** |
|
46 * Called by Init if we need to use the gnomeui library. |
|
47 */ |
|
48 nsresult InitWithGnome(nsIMozIconURI *aURI); |
|
49 nsresult InitWithGIO(nsIMozIconURI *aIconURI); |
|
50 }; |
|
51 |
|
52 #endif |