1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #include
"nsIWebProgressListener2.idl"
10 interface nsICancelable
;
11 interface nsIMIMEInfo
;
14 [scriptable
, uuid(37ec75d3
-97ad
-4da8
-afaa
-eabe5b4afd73
)]
15 interface nsITransfer
: nsIWebProgressListener2
{
18 * Initializes the transfer with certain properties. This function must
19 * be called prior to accessing any properties on this interface.
21 * @param aSource The source URI of the transfer. Must not be null.
23 * @param aTarget The target URI of the transfer. Must not be null.
25 * @param aDisplayName The user-readable description of the transfer.
28 * @param aMIMEInfo The MIME info associated with the target,
29 * including MIME type and helper app when appropriate.
30 * This parameter is optional.
32 * @param startTime Time when the download started (ie, when the first
33 * response from the server was received)
34 * XXX presumably wbp and exthandler do this differently
36 * @param aTempFile The location of a temporary file; i.e. a file in which
37 * the received data will be stored, but which is not
38 * equal to the target file. (will be moved to the real
39 * target by the caller, when the download is finished)
42 * @param aCancelable An object that can be used to abort the download.
44 * Implementations are expected to hold a strong
45 * reference to this object until the download is
46 * finished, at which point they should release the
49 * @param aIsPrivate Used to determine the privacy status of the new transfer.
50 * If true, indicates that the transfer was initiated from
51 * a source that desires privacy.
53 void init
(in nsIURI aSource
,
55 in AString aDisplayName
,
56 in nsIMIMEInfo aMIMEInfo
,
59 in nsICancelable aCancelable
,
60 in boolean aIsPrivate
);
63 * Used to notify the transfer object of the hash of the downloaded file.
64 * Must be called on the main thread, only after the download has finished
66 * @param aHash The SHA-256 hash in raw bytes of the downloaded file.
68 void setSha256Hash
(in ACString aHash
);
71 * Used to notify the transfer object of the signature of the downloaded
72 * file. Must be called on the main thread, only after the download has
73 * finished successfully.
74 * @param aSignatureInfo The nsIArray of nsIX509CertList of nsIX509Cert
75 * certificates of the downloaded file.
77 void setSignatureInfo
(in nsIArray aSignatureInfo
);
80 * Used to notify the transfer object of the redirects associated with the
81 * channel that terminated in the downloaded file. Must be called on the
82 * main thread, only after the download has finished successfully.
83 * @param aRedirects The nsIArray of nsIPrincipal of redirected URIs
84 * associated with the downloaded file.
86 void setRedirects
(in nsIArray aRedirects
);
91 * A component with this contract ID will be created each time a download is
92 * started, and nsITransfer::Init will be called on it and an observer will be set.
94 * Notifications of the download progress will happen via
95 * nsIWebProgressListener/nsIWebProgressListener2.
97 * INTERFACES THAT MUST BE IMPLEMENTED:
99 * nsIWebProgressListener
100 * nsIWebProgressListener2
102 * XXX move this to nsEmbedCID.h once the interfaces (and the contract ID) are
105 #define NS_TRANSFER_CONTRACTID
"@mozilla.org/transfer;1"