1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_image_decoders_icon_gtk_nsIconChannel_h
7 #define mozilla_image_decoders_icon_gtk_nsIconChannel_h
9 #include "mozilla/Attributes.h"
11 #include "nsIChannel.h"
13 #include "nsIIconURI.h"
16 namespace mozilla::ipc
{
20 /// This class is the GTK implementation of nsIconChannel. It asks
21 /// GTK for the icon, translates the pixel data in-memory into
22 /// nsIconDecoder format, and proxies the nsChannel interface to a new
23 /// channel returning that image.
24 class nsIconChannel final
: public nsIChannel
{
27 NS_FORWARD_NSIREQUEST(mRealChannel
->)
28 NS_FORWARD_NSICHANNEL(mRealChannel
->)
32 static void Shutdown();
34 /// Called by nsIconProtocolHandler after it creates this channel.
35 /// Must be called before calling any other function on this object.
36 /// If this method fails, no other function must be called on this object.
37 nsresult
Init(nsIURI
* aURI
);
39 /// Obtains an icon, in nsIconDecoder format, as a ByteBuf instead
40 /// of a channel. For use with IPC.
41 static nsresult
GetIcon(nsIURI
* aURI
, mozilla::ipc::ByteBuf
* aDataOut
);
45 /// The input stream channel which will yield the image.
46 /// Will always be non-null after a successful Init.
47 nsCOMPtr
<nsIChannel
> mRealChannel
;
49 static nsresult
GetIconWithGIO(nsIMozIconURI
* aIconURI
,
50 mozilla::ipc::ByteBuf
* aDataOut
);
53 #endif // mozilla_image_decoders_icon_gtk_nsIconChannel_h