netwerk/base/public/nsIDownloader.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/base/public/nsIDownloader.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "nsIStreamListener.idl"
     1.9 +
    1.10 +interface nsIFile;
    1.11 +interface nsIDownloadObserver;
    1.12 +
    1.13 +/**
    1.14 + * nsIDownloader
    1.15 + *
    1.16 + * A downloader is a special implementation of a nsIStreamListener that will
    1.17 + * make the contents of the stream available as a file.  This may utilize the
    1.18 + * disk cache as an optimization to avoid an extra copy of the data on disk.
    1.19 + * The resulting file is valid from the time the downloader completes until
    1.20 + * the last reference to the downloader is released.
    1.21 + */
    1.22 +[scriptable, uuid(fafe41a9-a531-4d6d-89bc-588a6522fb4e)]
    1.23 +interface nsIDownloader : nsIStreamListener
    1.24 +{
    1.25 +    /**
    1.26 +     * Initialize this downloader
    1.27 +     *
    1.28 +     * @param observer
    1.29 +     *        the observer to be notified when the download completes.
    1.30 +     * @param downloadLocation
    1.31 +     *        the location where the stream contents should be written.
    1.32 +     *        if null, the downloader will select a location and the
    1.33 +     *        resulting file will be deleted (or otherwise made invalid)
    1.34 +     *        when the downloader object is destroyed.  if an explicit
    1.35 +     *        download location is specified then the resulting file will
    1.36 +     *        not be deleted, and it will be the callers responsibility
    1.37 +     *        to keep track of the file, etc.
    1.38 +     */
    1.39 +    void init(in nsIDownloadObserver observer,
    1.40 +              in nsIFile             downloadLocation);
    1.41 +};
    1.42 +
    1.43 +[scriptable, uuid(44b3153e-a54e-4077-a527-b0325e40924e)]
    1.44 +interface nsIDownloadObserver : nsISupports
    1.45 +{
    1.46 +    /**
    1.47 +     * Called to signal a download that has completed.
    1.48 +     */
    1.49 +    void onDownloadComplete(in nsIDownloader downloader,
    1.50 +                            in nsIRequest    request,
    1.51 +                            in nsISupports   ctxt,
    1.52 +                            in nsresult      status,
    1.53 +                            in nsIFile       result);
    1.54 +};

mercurial