OLD | NEW |
(Empty) | |
| 1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
| 2 * |
| 3 * ***** BEGIN LICENSE BLOCK ***** |
| 4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 5 * |
| 6 * The contents of this file are subject to the Mozilla Public License Version |
| 7 * 1.1 (the "License"); you may not use this file except in compliance with |
| 8 * the License. You may obtain a copy of the License at |
| 9 * http://www.mozilla.org/MPL/ |
| 10 * |
| 11 * Software distributed under the License is distributed on an "AS IS" basis, |
| 12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
| 13 * for the specific language governing rights and limitations under the |
| 14 * License. |
| 15 * |
| 16 * The Original Code is the Mozilla browser. |
| 17 * |
| 18 * The Initial Developer of the Original Code is |
| 19 * Netscape Communications, Inc. |
| 20 * Portions created by the Initial Developer are Copyright (C) 1999 |
| 21 * the Initial Developer. All Rights Reserved. |
| 22 * |
| 23 * Contributor(s): |
| 24 * Travis Bogard <travis@netscape.com> |
| 25 * Darin Fisher <darin@meer.net> |
| 26 * |
| 27 * Alternatively, the contents of this file may be used under the terms of |
| 28 * either of the GNU General Public License Version 2 or later (the "GPL"), |
| 29 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
| 30 * in which case the provisions of the GPL or the LGPL are applicable instead |
| 31 * of those above. If you wish to allow use of your version of this file only |
| 32 * under the terms of either the GPL or the LGPL, and not to allow others to |
| 33 * use your version of this file under the terms of the MPL, indicate your |
| 34 * decision by deleting the provisions above and replace them with the notice |
| 35 * and other provisions required by the GPL or the LGPL. If you do not delete |
| 36 * the provisions above, a recipient may use your version of this file under |
| 37 * the terms of any one of the MPL, the GPL or the LGPL. |
| 38 * |
| 39 * ***** END LICENSE BLOCK ***** */ |
| 40 |
| 41 #include "nsISupports.idl" |
| 42 |
| 43 interface nsIWebProgress; |
| 44 interface nsIRequest; |
| 45 interface nsIURI; |
| 46 |
| 47 /** |
| 48 * The nsIWebProgressListener interface is implemented by clients wishing to |
| 49 * listen in on the progress associated with the loading of asynchronous |
| 50 * requests in the context of a nsIWebProgress instance as well as any child |
| 51 * nsIWebProgress instances. nsIWebProgress.idl describes the parent-child |
| 52 * relationship of nsIWebProgress instances. |
| 53 * |
| 54 * @status FROZEN |
| 55 */ |
| 56 [scriptable, uuid(570F39D1-EFD0-11d3-B093-00A024FFC08C)] |
| 57 interface nsIWebProgressListener : nsISupports |
| 58 { |
| 59 /** |
| 60 * State Transition Flags |
| 61 * |
| 62 * These flags indicate the various states that requests may transition |
| 63 * through as they are being loaded. These flags are mutually exclusive. |
| 64 * |
| 65 * For any given request, onStateChange is called once with the STATE_START |
| 66 * flag, zero or more times with the STATE_TRANSFERRING flag or once with the |
| 67 * STATE_REDIRECTING flag, and then finally once with the STATE_STOP flag. |
| 68 * NOTE: For document requests, a second STATE_STOP is generated (see the |
| 69 * description of STATE_IS_WINDOW for more details). |
| 70 * |
| 71 * STATE_START |
| 72 * This flag indicates the start of a request. This flag is set when a |
| 73 * request is initiated. The request is complete when onStateChange is |
| 74 * called for the same request with the STATE_STOP flag set. |
| 75 * |
| 76 * STATE_REDIRECTING |
| 77 * This flag indicates that a request is being redirected. The request |
| 78 * passed to onStateChange is the request that is being redirected. When a |
| 79 * redirect occurs, a new request is generated automatically to process the |
| 80 * new request. Expect a corresponding STATE_START event for the new |
| 81 * request, and a STATE_STOP for the redirected request. |
| 82 * |
| 83 * STATE_TRANSFERRING |
| 84 * This flag indicates that data for a request is being transferred to an |
| 85 * end consumer. This flag indicates that the request has been targeted, |
| 86 * and that the user may start seeing content corresponding to the request. |
| 87 * |
| 88 * STATE_NEGOTIATING |
| 89 * This flag is not used. |
| 90 * |
| 91 * STATE_STOP |
| 92 * This flag indicates the completion of a request. The aStatus parameter |
| 93 * to onStateChange indicates the final status of the request. |
| 94 */ |
| 95 const unsigned long STATE_START = 0x00000001; |
| 96 const unsigned long STATE_REDIRECTING = 0x00000002; |
| 97 const unsigned long STATE_TRANSFERRING = 0x00000004; |
| 98 const unsigned long STATE_NEGOTIATING = 0x00000008; |
| 99 const unsigned long STATE_STOP = 0x00000010; |
| 100 |
| 101 |
| 102 /** |
| 103 * State Type Flags |
| 104 * |
| 105 * These flags further describe the entity for which the state transition is |
| 106 * occuring. These flags are NOT mutually exclusive (i.e., an onStateChange |
| 107 * event may indicate some combination of these flags). |
| 108 * |
| 109 * STATE_IS_REQUEST |
| 110 * This flag indicates that the state transition is for a request, which |
| 111 * includes but is not limited to document requests. (See below for a |
| 112 * description of document requests.) Other types of requests, such as |
| 113 * requests for inline content (e.g., images and stylesheets) are |
| 114 * considered normal requests. |
| 115 * |
| 116 * STATE_IS_DOCUMENT |
| 117 * This flag indicates that the state transition is for a document request. |
| 118 * This flag is set in addition to STATE_IS_REQUEST. A document request |
| 119 * supports the nsIChannel interface and its loadFlags attribute includes |
| 120 * the nsIChannel::LOAD_DOCUMENT_URI flag. |
| 121 * |
| 122 * A document request does not complete until all requests associated with |
| 123 * the loading of its corresponding document have completed. This includes |
| 124 * other document requests (e.g., corresponding to HTML <iframe> elements). |
| 125 * The document corresponding to a document request is available via the |
| 126 * DOMWindow attribute of onStateChange's aWebProgress parameter. |
| 127 * |
| 128 * STATE_IS_NETWORK |
| 129 * This flag indicates that the state transition corresponds to the start |
| 130 * or stop of activity in the indicated nsIWebProgress instance. This flag |
| 131 * is accompanied by either STATE_START or STATE_STOP, and it may be |
| 132 * combined with other State Type Flags. |
| 133 * |
| 134 * Unlike STATE_IS_WINDOW, this flag is only set when activity within the |
| 135 * nsIWebProgress instance being observed starts or stops. If activity |
| 136 * only occurs in a child nsIWebProgress instance, then this flag will be |
| 137 * set to indicate the start and stop of that activity. |
| 138 * |
| 139 * For example, in the case of navigation within a single frame of a HTML |
| 140 * frameset, a nsIWebProgressListener instance attached to the |
| 141 * nsIWebProgress of the frameset window will receive onStateChange calls |
| 142 * with the STATE_IS_NETWORK flag set to indicate the start and stop of |
| 143 * said navigation. In other words, an observer of an outer window can |
| 144 * determine when activity, that may be constrained to a child window or |
| 145 * set of child windows, starts and stops. |
| 146 * |
| 147 * STATE_IS_WINDOW |
| 148 * This flag indicates that the state transition corresponds to the start |
| 149 * or stop of activity in the indicated nsIWebProgress instance. This flag |
| 150 * is accompanied by either STATE_START or STATE_STOP, and it may be |
| 151 * combined with other State Type Flags. |
| 152 * |
| 153 * This flag is similar to STATE_IS_DOCUMENT. However, when a document |
| 154 * request completes, two onStateChange calls with STATE_STOP are |
| 155 * generated. The document request is passed as aRequest to both calls. |
| 156 * The first has STATE_IS_REQUEST and STATE_IS_DOCUMENT set, and the second |
| 157 * has the STATE_IS_WINDOW flag set (and possibly the STATE_IS_NETWORK flag |
| 158 * set as well -- see above for a description of when the STATE_IS_NETWORK |
| 159 * flag may be set). This second STATE_STOP event may be useful as a way |
| 160 * to partition the work that occurs when a document request completes. |
| 161 */ |
| 162 const unsigned long STATE_IS_REQUEST = 0x00010000; |
| 163 const unsigned long STATE_IS_DOCUMENT = 0x00020000; |
| 164 const unsigned long STATE_IS_NETWORK = 0x00040000; |
| 165 const unsigned long STATE_IS_WINDOW = 0x00080000; |
| 166 |
| 167 |
| 168 /** |
| 169 * State Modifier Flags |
| 170 * |
| 171 * These flags further describe the transition which is occuring. These |
| 172 * flags are NOT mutually exclusive (i.e., an onStateChange event may |
| 173 * indicate some combination of these flags). |
| 174 * |
| 175 * STATE_RESTORING |
| 176 * This flag indicates that the state transition corresponds to the start |
| 177 * or stop of activity for restoring a previously-rendered presentation. |
| 178 * As such, there is no actual network activity associated with this |
| 179 * request, and any modifications made to the document or presentation |
| 180 * when it was originally loaded will still be present. |
| 181 */ |
| 182 const unsigned long STATE_RESTORING = 0x01000000; |
| 183 |
| 184 /** |
| 185 * State Security Flags |
| 186 * |
| 187 * These flags describe the security state reported by a call to the |
| 188 * onSecurityChange method. These flags are mutually exclusive. |
| 189 * |
| 190 * STATE_IS_INSECURE |
| 191 * This flag indicates that the data corresponding to the request |
| 192 * was received over an insecure channel. |
| 193 * |
| 194 * STATE_IS_BROKEN |
| 195 * This flag indicates an unknown security state. This may mean that the |
| 196 * request is being loaded as part of a page in which some content was |
| 197 * received over an insecure channel. |
| 198 * |
| 199 * STATE_IS_SECURE |
| 200 * This flag indicates that the data corresponding to the request was |
| 201 * received over a secure channel. The degree of security is expressed by |
| 202 * STATE_SECURE_HIGH, STATE_SECURE_MED, or STATE_SECURE_LOW. |
| 203 */ |
| 204 const unsigned long STATE_IS_INSECURE = 0x00000004; |
| 205 const unsigned long STATE_IS_BROKEN = 0x00000001; |
| 206 const unsigned long STATE_IS_SECURE = 0x00000002; |
| 207 |
| 208 /** |
| 209 * Security Strength Flags |
| 210 * |
| 211 * These flags describe the security strength and accompany STATE_IS_SECURE |
| 212 * in a call to the onSecurityChange method. These flags are mutually |
| 213 * exclusive. |
| 214 * |
| 215 * These flags are not meant to provide a precise description of data |
| 216 * transfer security. These are instead intended as a rough indicator that |
| 217 * may be used to, for example, color code a security indicator or otherwise |
| 218 * provide basic data transfer security feedback to the user. |
| 219 * |
| 220 * STATE_SECURE_HIGH |
| 221 * This flag indicates a high degree of security. |
| 222 * |
| 223 * STATE_SECURE_MED |
| 224 * This flag indicates a medium degree of security. |
| 225 * |
| 226 * STATE_SECURE_LOW |
| 227 * This flag indicates a low degree of security. |
| 228 */ |
| 229 const unsigned long STATE_SECURE_HIGH = 0x00040000; |
| 230 const unsigned long STATE_SECURE_MED = 0x00010000; |
| 231 const unsigned long STATE_SECURE_LOW = 0x00020000; |
| 232 |
| 233 |
| 234 /** |
| 235 * Notification indicating the state has changed for one of the requests |
| 236 * associated with aWebProgress. |
| 237 * |
| 238 * @param aWebProgress |
| 239 * The nsIWebProgress instance that fired the notification |
| 240 * @param aRequest |
| 241 * The nsIRequest that has changed state. |
| 242 * @param aStateFlags |
| 243 * Flags indicating the new state. This value is a combination of one |
| 244 * of the State Transition Flags and one or more of the State Type |
| 245 * Flags defined above. Any undefined bits are reserved for future |
| 246 * use. |
| 247 * @param aStatus |
| 248 * Error status code associated with the state change. This parameter |
| 249 * should be ignored unless aStateFlags includes the STATE_STOP bit. |
| 250 * The status code indicates success or failure of the request |
| 251 * associated with the state change. NOTE: aStatus may be a success |
| 252 * code even for server generated errors, such as the HTTP 404 error. |
| 253 * In such cases, the request itself should be queried for extended |
| 254 * error information (e.g., for HTTP requests see nsIHttpChannel). |
| 255 */ |
| 256 void onStateChange(in nsIWebProgress aWebProgress, |
| 257 in nsIRequest aRequest, |
| 258 in unsigned long aStateFlags, |
| 259 in nsresult aStatus); |
| 260 |
| 261 /** |
| 262 * Notification that the progress has changed for one of the requests |
| 263 * associated with aWebProgress. Progress totals are reset to zero when all |
| 264 * requests in aWebProgress complete (corresponding to onStateChange being |
| 265 * called with aStateFlags including the STATE_STOP and STATE_IS_WINDOW |
| 266 * flags). |
| 267 * |
| 268 * @param aWebProgress |
| 269 * The nsIWebProgress instance that fired the notification. |
| 270 * @param aRequest |
| 271 * The nsIRequest that has new progress. |
| 272 * @param aCurSelfProgress |
| 273 * The current progress for aRequest. |
| 274 * @param aMaxSelfProgress |
| 275 * The maximum progress for aRequest. |
| 276 * @param aCurTotalProgress |
| 277 * The current progress for all requests associated with aWebProgress. |
| 278 * @param aMaxTotalProgress |
| 279 * The total progress for all requests associated with aWebProgress. |
| 280 * |
| 281 * NOTE: If any progress value is unknown, or if its value would exceed the |
| 282 * maximum value of type long, then its value is replaced with -1. |
| 283 * |
| 284 * NOTE: If the object also implements nsIWebProgressListener2 and the caller |
| 285 * knows about that interface, this function will not be called. Instead, |
| 286 * nsIWebProgressListener2::onProgressChange64 will be called. |
| 287 */ |
| 288 void onProgressChange(in nsIWebProgress aWebProgress, |
| 289 in nsIRequest aRequest, |
| 290 in long aCurSelfProgress, |
| 291 in long aMaxSelfProgress, |
| 292 in long aCurTotalProgress, |
| 293 in long aMaxTotalProgress); |
| 294 |
| 295 /** |
| 296 * Called when the location of the window being watched changes. This is not |
| 297 * when a load is requested, but rather once it is verified that the load is |
| 298 * going to occur in the given window. For instance, a load that starts in a |
| 299 * window might send progress and status messages for the new site, but it |
| 300 * will not send the onLocationChange until we are sure that we are loading |
| 301 * this new page here. |
| 302 * |
| 303 * @param aWebProgress |
| 304 * The nsIWebProgress instance that fired the notification. |
| 305 * @param aRequest |
| 306 * The associated nsIRequest. This may be null in some cases. |
| 307 * @param aLocation |
| 308 * The URI of the location that is being loaded. |
| 309 */ |
| 310 void onLocationChange(in nsIWebProgress aWebProgress, |
| 311 in nsIRequest aRequest, |
| 312 in nsIURI aLocation); |
| 313 |
| 314 /** |
| 315 * Notification that the status of a request has changed. The status message |
| 316 * is intended to be displayed to the user (e.g., in the status bar of the |
| 317 * browser). |
| 318 * |
| 319 * @param aWebProgress |
| 320 * The nsIWebProgress instance that fired the notification. |
| 321 * @param aRequest |
| 322 * The nsIRequest that has new status. |
| 323 * @param aStatus |
| 324 * This value is not an error code. Instead, it is a numeric value |
| 325 * that indicates the current status of the request. This interface |
| 326 * does not define the set of possible status codes. NOTE: Some |
| 327 * status values are defined by nsITransport and nsISocketTransport. |
| 328 * @param aMessage |
| 329 * Localized text corresponding to aStatus. |
| 330 */ |
| 331 void onStatusChange(in nsIWebProgress aWebProgress, |
| 332 in nsIRequest aRequest, |
| 333 in nsresult aStatus, |
| 334 in wstring aMessage); |
| 335 |
| 336 /** |
| 337 * Notification called for security progress. This method will be called on |
| 338 * security transitions (eg HTTP -> HTTPS, HTTPS -> HTTP, FOO -> HTTPS) and |
| 339 * after document load completion. It might also be called if an error |
| 340 * occurs during network loading. |
| 341 * |
| 342 * @param aWebProgress |
| 343 * The nsIWebProgress instance that fired the notification. |
| 344 * @param aRequest |
| 345 * The nsIRequest that has new security state. |
| 346 * @param aState |
| 347 * A value composed of the Security State Flags and the Security |
| 348 * Strength Flags listed above. Any undefined bits are reserved for |
| 349 * future use. |
| 350 * |
| 351 * NOTE: These notifications will only occur if a security package is |
| 352 * installed. |
| 353 */ |
| 354 void onSecurityChange(in nsIWebProgress aWebProgress, |
| 355 in nsIRequest aRequest, |
| 356 in unsigned long aState); |
| 357 }; |
OLD | NEW |