michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface imgINotificationObserver; michael@0: interface imgIRequest; michael@0: michael@0: interface nsIChannel; michael@0: interface nsILoadGroup; michael@0: interface nsIPrincipal; michael@0: interface nsIStreamListener; michael@0: interface nsIURI; michael@0: michael@0: interface nsISimpleEnumerator; michael@0: interface nsIChannelPolicy; michael@0: michael@0: #include "nsIRequest.idl" // for nsLoadFlags michael@0: michael@0: /** michael@0: * imgILoader interface michael@0: * michael@0: * @author Stuart Parmenter michael@0: * @version 0.3 michael@0: * @see imagelib2 michael@0: */ michael@0: [scriptable, builtinclass, uuid(c8126129-8dac-43cd-b1ba-3896fba2dd01)] michael@0: interface imgILoader : nsISupports michael@0: { michael@0: // Extra flags to pass to loadImage if you want a load to use CORS michael@0: // validation. michael@0: const unsigned long LOAD_CORS_ANONYMOUS = 1 << 16; michael@0: const unsigned long LOAD_CORS_USE_CREDENTIALS = 1 << 17; michael@0: michael@0: /** michael@0: * Start the load and decode of an image. michael@0: * @param aURI the URI to load michael@0: * @param aFirstPartyIsolationURI the urlbar URI that 'initiated' the load -- used for 3rd party blocking michael@0: * @param aReferrerURI the 'referring' URI michael@0: * @param aLoadingPrincipal the principal of the loading document michael@0: * @param aLoadGroup Loadgroup to put the image load into michael@0: * @param aObserver the observer (may be null) michael@0: * @param aCX some random data michael@0: * @param aLoadFlags Load flags for the request michael@0: * @param aCacheKey cache key to use for a load if the original michael@0: * image came from a request that had post data michael@0: michael@0: michael@0: * libpr0n does NOT keep a strong ref to the observer; this prevents michael@0: * reference cycles. This means that callers of loadImage should michael@0: * make sure to Cancel() the resulting request before the observer michael@0: * goes away. michael@0: */ michael@0: imgIRequest loadImageXPCOM(in nsIURI aURI, michael@0: in nsIURI aFirstPartyIsolationURI, michael@0: in nsIURI aReferrerURI, michael@0: in nsIPrincipal aLoadingPrincipal, michael@0: in nsILoadGroup aLoadGroup, michael@0: in imgINotificationObserver aObserver, michael@0: in nsISupports aCX, michael@0: in nsLoadFlags aLoadFlags, michael@0: in nsISupports cacheKey, michael@0: in nsIChannelPolicy channelPolicy); michael@0: michael@0: /** michael@0: * Start the load and decode of an image. michael@0: * @param aChannel the channel to load the image from. This must michael@0: * already be opened before ths method is called, and there michael@0: * must have been no OnDataAvailable calls for it yet. michael@0: * @param aObserver the observer (may be null) michael@0: * @param cx some random data michael@0: * @param aListener [out] michael@0: * A listener that you must send the channel's notifications and data to. michael@0: * Can be null, in which case imagelib has found a cached image and is michael@0: * not interested in the data. @aChannel will be canceled for you in michael@0: * this case. michael@0: * michael@0: * libpr0n does NOT keep a strong ref to the observer; this prevents michael@0: * reference cycles. This means that callers of loadImageWithChannel should michael@0: * make sure to Cancel() the resulting request before the observer goes away. michael@0: */ michael@0: imgIRequest loadImageWithChannelXPCOM(in nsIChannel aChannel, michael@0: in imgINotificationObserver aObserver, michael@0: in nsISupports cx, michael@0: out nsIStreamListener aListener); michael@0: };