uriloader/base/nsITransfer.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/uriloader/base/nsITransfer.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,98 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsIWebProgressListener2.idl"
    1.10 +
    1.11 +interface nsIArray;
    1.12 +interface nsIURI;
    1.13 +interface nsICancelable;
    1.14 +interface nsIMIMEInfo;
    1.15 +interface nsIFile;
    1.16 +
    1.17 +[scriptable, uuid(0c81b265-34b8-472d-be98-099b2512e3ec)]
    1.18 +interface nsITransfer : nsIWebProgressListener2 {
    1.19 +
    1.20 +    /**
    1.21 +     * Initializes the transfer with certain properties.  This function must
    1.22 +     * be called prior to accessing any properties on this interface.
    1.23 +     *
    1.24 +     * @param aSource The source URI of the transfer. Must not be null.
    1.25 +     *
    1.26 +     * @param aTarget The target URI of the transfer. Must not be null.
    1.27 +     *
    1.28 +     * @param aDisplayName The user-readable description of the transfer.
    1.29 +     *                     Can be empty.
    1.30 +     *
    1.31 +     * @param aMIMEInfo The MIME info associated with the target,
    1.32 +     *                  including MIME type and helper app when appropriate.
    1.33 +     *                  This parameter is optional.
    1.34 +     *
    1.35 +     * @param startTime Time when the download started (ie, when the first
    1.36 +     *                  response from the server was received)
    1.37 +     *                  XXX presumably wbp and exthandler do this differently
    1.38 +     *
    1.39 +     * @param aTempFile The location of a temporary file; i.e. a file in which
    1.40 +     *                  the received data will be stored, but which is not
    1.41 +     *                  equal to the target file. (will be moved to the real
    1.42 +     *                  target by the caller, when the download is finished)
    1.43 +     *                  May be null.
    1.44 +     *
    1.45 +     * @param aCancelable An object that can be used to abort the download.
    1.46 +     *                    Must not be null.
    1.47 +     *                    Implementations are expected to hold a strong
    1.48 +     *                    reference to this object until the download is
    1.49 +     *                    finished, at which point they should release the
    1.50 +     *                    reference.
    1.51 +     *
    1.52 +     * @param aIsPrivate Used to determine the privacy status of the new transfer.
    1.53 +     *                   If true, indicates that the transfer was initiated from
    1.54 +     *                   a source that desires privacy.
    1.55 +     */
    1.56 +    void init(in nsIURI aSource,
    1.57 +              in nsIURI aTarget,
    1.58 +              in AString aDisplayName,
    1.59 +              in nsIMIMEInfo aMIMEInfo,
    1.60 +              in PRTime startTime,
    1.61 +              in nsIFile aTempFile,
    1.62 +              in nsICancelable aCancelable,
    1.63 +              in boolean aIsPrivate);
    1.64 +
    1.65 +    /*
    1.66 +     * Used to notify the transfer object of the hash of the downloaded file.
    1.67 +     * Must be called on the main thread, only after the download has finished
    1.68 +     * successfully.
    1.69 +     * @param aHash The SHA-256 hash in raw bytes of the downloaded file.
    1.70 +     */
    1.71 +    void setSha256Hash(in ACString aHash);
    1.72 +
    1.73 +    /*
    1.74 +     * Used to notify the transfer object of the signature of the downloaded
    1.75 +     * file.  Must be called on the main thread, only after the download has
    1.76 +     * finished successfully.
    1.77 +     * @param aSignatureInfo The nsIArray of nsIX509CertList of nsIX509Cert
    1.78 +     *        certificates of the downloaded file.
    1.79 +     */
    1.80 +    void setSignatureInfo(in nsIArray aSignatureInfo);
    1.81 +
    1.82 +};
    1.83 +
    1.84 +%{C++
    1.85 +/**
    1.86 + * A component with this contract ID will be created each time a download is
    1.87 + * started, and nsITransfer::Init will be called on it and an observer will be set.
    1.88 + *
    1.89 + * Notifications of the download progress will happen via
    1.90 + * nsIWebProgressListener/nsIWebProgressListener2.
    1.91 + *
    1.92 + * INTERFACES THAT MUST BE IMPLEMENTED:
    1.93 + *   nsITransfer
    1.94 + *   nsIWebProgressListener
    1.95 + *   nsIWebProgressListener2
    1.96 + *
    1.97 + * XXX move this to nsEmbedCID.h once the interfaces (and the contract ID) are
    1.98 + * frozen.
    1.99 + */
   1.100 +#define NS_TRANSFER_CONTRACTID "@mozilla.org/transfer;1"
   1.101 +%}

mercurial