michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 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 "nsIWebProgressListener2.idl" michael@0: michael@0: interface nsIArray; michael@0: interface nsIURI; michael@0: interface nsICancelable; michael@0: interface nsIMIMEInfo; michael@0: interface nsIFile; michael@0: michael@0: [scriptable, uuid(0c81b265-34b8-472d-be98-099b2512e3ec)] michael@0: interface nsITransfer : nsIWebProgressListener2 { michael@0: michael@0: /** michael@0: * Initializes the transfer with certain properties. This function must michael@0: * be called prior to accessing any properties on this interface. michael@0: * michael@0: * @param aSource The source URI of the transfer. Must not be null. michael@0: * michael@0: * @param aTarget The target URI of the transfer. Must not be null. michael@0: * michael@0: * @param aDisplayName The user-readable description of the transfer. michael@0: * Can be empty. michael@0: * michael@0: * @param aMIMEInfo The MIME info associated with the target, michael@0: * including MIME type and helper app when appropriate. michael@0: * This parameter is optional. michael@0: * michael@0: * @param startTime Time when the download started (ie, when the first michael@0: * response from the server was received) michael@0: * XXX presumably wbp and exthandler do this differently michael@0: * michael@0: * @param aTempFile The location of a temporary file; i.e. a file in which michael@0: * the received data will be stored, but which is not michael@0: * equal to the target file. (will be moved to the real michael@0: * target by the caller, when the download is finished) michael@0: * May be null. michael@0: * michael@0: * @param aCancelable An object that can be used to abort the download. michael@0: * Must not be null. michael@0: * Implementations are expected to hold a strong michael@0: * reference to this object until the download is michael@0: * finished, at which point they should release the michael@0: * reference. michael@0: * michael@0: * @param aIsPrivate Used to determine the privacy status of the new transfer. michael@0: * If true, indicates that the transfer was initiated from michael@0: * a source that desires privacy. michael@0: */ michael@0: void init(in nsIURI aSource, michael@0: in nsIURI aTarget, michael@0: in AString aDisplayName, michael@0: in nsIMIMEInfo aMIMEInfo, michael@0: in PRTime startTime, michael@0: in nsIFile aTempFile, michael@0: in nsICancelable aCancelable, michael@0: in boolean aIsPrivate); michael@0: michael@0: /* michael@0: * Used to notify the transfer object of the hash of the downloaded file. michael@0: * Must be called on the main thread, only after the download has finished michael@0: * successfully. michael@0: * @param aHash The SHA-256 hash in raw bytes of the downloaded file. michael@0: */ michael@0: void setSha256Hash(in ACString aHash); michael@0: michael@0: /* michael@0: * Used to notify the transfer object of the signature of the downloaded michael@0: * file. Must be called on the main thread, only after the download has michael@0: * finished successfully. michael@0: * @param aSignatureInfo The nsIArray of nsIX509CertList of nsIX509Cert michael@0: * certificates of the downloaded file. michael@0: */ michael@0: void setSignatureInfo(in nsIArray aSignatureInfo); michael@0: michael@0: }; michael@0: michael@0: %{C++ michael@0: /** michael@0: * A component with this contract ID will be created each time a download is michael@0: * started, and nsITransfer::Init will be called on it and an observer will be set. michael@0: * michael@0: * Notifications of the download progress will happen via michael@0: * nsIWebProgressListener/nsIWebProgressListener2. michael@0: * michael@0: * INTERFACES THAT MUST BE IMPLEMENTED: michael@0: * nsITransfer michael@0: * nsIWebProgressListener michael@0: * nsIWebProgressListener2 michael@0: * michael@0: * XXX move this to nsEmbedCID.h once the interfaces (and the contract ID) are michael@0: * frozen. michael@0: */ michael@0: #define NS_TRANSFER_CONTRACTID "@mozilla.org/transfer;1" michael@0: %}