Bug 1777549 - remove remaining e10s conditions in manifest files. r=gbrown,extension...
[gecko.git] / uriloader / base / nsITransfer.idl
blobba701c982d7a077d3f15b5249c3b692954d4ef99
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"
8 interface nsIArray;
9 interface nsIURI;
10 interface nsICancelable;
11 interface nsIMIMEInfo;
12 interface nsIFile;
13 interface nsIReferrerInfo;
14 interface nsIHttpChannel;
15 webidl BrowsingContext;
17 [scriptable, uuid(37ec75d3-97ad-4da8-afaa-eabe5b4afd73)]
18 interface nsITransfer : nsIWebProgressListener2 {
20 const unsigned long DOWNLOAD_ACCEPTABLE = 0;
21 const unsigned long DOWNLOAD_FORBIDDEN = 1;
22 const unsigned long DOWNLOAD_POTENTIALLY_UNSAFE = 2;
24 /**
25 * Initializes the transfer with certain properties. This function must
26 * be called prior to accessing any properties on this interface.
28 * @param aSource The source URI of the transfer. Must not be null.
30 * @param aSourceOriginalURI The original URI of the transfer in case
31 * aSource is a blob URL. Can be null.
33 * @param aTarget The target URI of the transfer. Must not be null.
35 * @param aDisplayName The user-readable description of the transfer.
36 * Can be empty.
38 * @param aMIMEInfo The MIME info associated with the target,
39 * including MIME type and helper app when appropriate.
40 * This parameter is optional.
42 * @param startTime Time when the download started (ie, when the first
43 * response from the server was received)
44 * XXX presumably wbp and exthandler do this differently
46 * @param aTempFile The location of a temporary file; i.e. a file in which
47 * the received data will be stored, but which is not
48 * equal to the target file. (will be moved to the real
49 * target by the caller, when the download is finished)
50 * May be null.
52 * @param aCancelable An object that can be used to abort the download.
53 * Must not be null.
54 * Implementations are expected to hold a strong
55 * reference to this object until the download is
56 * finished, at which point they should release the
57 * reference.
59 * @param aIsPrivate Used to determine the privacy status of the new transfer.
60 * If true, indicates that the transfer was initiated from
61 * a source that desires privacy.
63 * @param aDownloadClassification Indicates wheter the download is unwanted,
64 * should be considered dangerous or insecure.
65 * @param aReferrerInfo The Referrer this download is started with
67 void init(in nsIURI aSource,
68 in nsIURI aSourceOriginalURI,
69 in nsIURI aTarget,
70 in AString aDisplayName,
71 in nsIMIMEInfo aMIMEInfo,
72 in PRTime startTime,
73 in nsIFile aTempFile,
74 in nsICancelable aCancelable,
75 in boolean aIsPrivate,
76 in long aDownloadClassification,
77 in nsIReferrerInfo aReferrerInfo);
79 /**
80 * Same as init, but allows for passing the browsingContext
81 * which will allow for opening the download with the same
82 * userContextId and auth header.
84 * @param aBrowsingContext BrowsingContext of the initiating document.
86 * @param aHandleInternally Set to true if the download should be opened within
87 * the browser.
88 * @param aHttpChannel Channel of the initiating document.
90 void initWithBrowsingContext(in nsIURI aSource,
91 in nsIURI aTarget,
92 in AString aDisplayName,
93 in nsIMIMEInfo aMIMEInfo,
94 in PRTime startTime,
95 in nsIFile aTempFile,
96 in nsICancelable aCancelable,
97 in boolean aIsPrivate,
98 in long aDownloadClassification,
99 in nsIReferrerInfo aReferrerInfo,
100 in BrowsingContext aBrowsingContext,
101 in boolean aHandleInternally,
102 in nsIHttpChannel aHttpChannel);
106 * Used to notify the transfer object of the hash of the downloaded file.
107 * Must be called on the main thread, only after the download has finished
108 * successfully.
109 * @param aHash The SHA-256 hash in raw bytes of the downloaded file.
111 void setSha256Hash(in ACString aHash);
114 * Used to notify the transfer object of the signature of the downloaded
115 * file. Must be called on the main thread, only after the download has
116 * finished successfully.
117 * @param aSignatureInfo The Array of Array of Array of bytes
118 * certificates of the downloaded file.
120 void setSignatureInfo(in Array<Array<Array<uint8_t> > > aSignatureInfo);
123 * Used to notify the transfer object of the redirects associated with the
124 * channel that terminated in the downloaded file. Must be called on the
125 * main thread, only after the download has finished successfully.
126 * @param aRedirects The nsIArray of nsIPrincipal of redirected URIs
127 * associated with the downloaded file.
129 void setRedirects(in nsIArray aRedirects);
132 %{C++
134 * A component with this contract ID will be created each time a download is
135 * started, and nsITransfer::Init will be called on it and an observer will be set.
137 * Notifications of the download progress will happen via
138 * nsIWebProgressListener/nsIWebProgressListener2.
140 * INTERFACES THAT MUST BE IMPLEMENTED:
141 * nsITransfer
142 * nsIWebProgressListener
143 * nsIWebProgressListener2
145 * XXX move this to nsEmbedCID.h once the interfaces (and the contract ID) are
146 * frozen.
148 #define NS_TRANSFER_CONTRACTID "@mozilla.org/transfer;1"