1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38 #include "nsISupports.idl"
39
40 interface nsIURI;
41 interface nsIRequest;
42
43 /**
44 * nsIProgressEventSink
45 *
46 * This interface is used to asynchronously convey channel status and progress
47 * information that is generally not critical to the processing of the channel.
48 * The information is intended to be displayed to the user in some meaningful
49 * way.
50 *
51 * An implementation of this interface can be passed to a channel via the
52 * channel's notificationCallbacks attribute. See nsIChannel for more info.
53 *
54 * The channel will begin passing notifications to the progress event sink
55 * after its asyncOpen method has been called. Notifications will cease once
56 * the channel calls its listener's onStopRequest method or once the channel
57 * is canceled (via nsIRequest::cancel).
58 *
59 * NOTE: This interface is actually not specific to channels and may be used
60 * with other implementations of nsIRequest.
61 *
62 * @status UNDER_REVIEW
63 */
64 [scriptable, uuid(D974C99E-4148-4df9-8D98-DE834A2F6462)]
65 interface nsIProgressEventSink : nsISupports
66 {
67 /**
68 * Called to notify the event sink that progress has occurred for the
69 * given request.
70 *
71 * @param aRequest
72 * the request being observed (may QI to nsIChannel).
73 * @param aContext
74 * if aRequest is a channel, then this parameter is the listener
75 * context passed to nsIChannel::asyncOpen.
76 * @param aProgress
77 * numeric value in the range 0 to aProgressMax indicating the
78 * number of bytes transfered thus far.
79 * @param aProgressMax
80 * numeric value indicating maximum number of bytes that will be
81 * transfered (or 0xFFFFFFFFFFFFFFFF if total is unknown).
82 */
83 void onProgress(in nsIRequest aRequest,
84 in nsISupports aContext,
85 in unsigned long long aProgress,
86 in unsigned long long aProgressMax);
87
88 /**
89 * Called to notify the event sink with a status message for the given
90 * request.
91 *
92 * @param aRequest
93 * the request being observed (may QI to nsIChannel).
94 * @param aContext
95 * if aRequest is a channel, then this parameter is the listener
96 * context passed to nsIChannel::asyncOpen.
97 * @param aStatus
98 * status code (not necessarily an error code) indicating the
99 * state of the channel (usually the state of the underlying
100 * transport). see nsISocketTransport for socket specific status
101 * codes.
102 * @param aStatusArg
103 * status code argument to be used with the string bundle service
104 * to convert the status message into localized, human readable
105 * text. the meaning of this parameter is specific to the value
106 * of the status code. for socket status codes, this parameter
107 * indicates the host:port associated with the status code.
108 */
109 void onStatus(in nsIRequest aRequest,
110 in nsISupports aContext,
111 in nsresult aStatus,
112 in wstring aStatusArg);
113
114 };