PageRenderTime 205ms CodeModel.GetById 161ms app.highlight 11ms RepoModel.GetById 29ms app.codeStats 0ms

/gecko_sdk/idl/nsIWebProgressListener.idl

http://firefox-mac-pdf.googlecode.com/
IDL | 369 lines | 45 code | 16 blank | 308 comment | 0 complexity | b3b827ad378047d395194f15b2d172df MD5 | raw file
  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
 43interface nsIWebProgress;
 44interface nsIRequest;
 45interface 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)]
 57interface 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    * State bits for EV == Extended Validation == High Assurance
235    *
236    * These flags describe the level of identity verification
237    * in a call to the onSecurityChange method. 
238    *
239    * STATE_IDENTITY_EV_TOPLEVEL
240    *   The topmost document uses an EV cert.
241    *   NOTE: Available since Gecko 1.9
242    */
243
244  const unsigned long STATE_IDENTITY_EV_TOPLEVEL    = 0x00100000;
245
246  /**
247   * Notification indicating the state has changed for one of the requests
248   * associated with aWebProgress.
249   *
250   * @param aWebProgress
251   *        The nsIWebProgress instance that fired the notification
252   * @param aRequest
253   *        The nsIRequest that has changed state.
254   * @param aStateFlags
255   *        Flags indicating the new state.  This value is a combination of one
256   *        of the State Transition Flags and one or more of the State Type
257   *        Flags defined above.  Any undefined bits are reserved for future
258   *        use.
259   * @param aStatus
260   *        Error status code associated with the state change.  This parameter
261   *        should be ignored unless aStateFlags includes the STATE_STOP bit.
262   *        The status code indicates success or failure of the request
263   *        associated with the state change.  NOTE: aStatus may be a success
264   *        code even for server generated errors, such as the HTTP 404 error.
265   *        In such cases, the request itself should be queried for extended
266   *        error information (e.g., for HTTP requests see nsIHttpChannel).
267   */
268  void onStateChange(in nsIWebProgress aWebProgress,
269                     in nsIRequest aRequest,
270                     in unsigned long aStateFlags,
271                     in nsresult aStatus);
272
273  /**
274   * Notification that the progress has changed for one of the requests
275   * associated with aWebProgress.  Progress totals are reset to zero when all
276   * requests in aWebProgress complete (corresponding to onStateChange being
277   * called with aStateFlags including the STATE_STOP and STATE_IS_WINDOW
278   * flags).
279   *
280   * @param aWebProgress
281   *        The nsIWebProgress instance that fired the notification.
282   * @param aRequest
283   *        The nsIRequest that has new progress.
284   * @param aCurSelfProgress
285   *        The current progress for aRequest.
286   * @param aMaxSelfProgress
287   *        The maximum progress for aRequest.
288   * @param aCurTotalProgress
289   *        The current progress for all requests associated with aWebProgress.
290   * @param aMaxTotalProgress
291   *        The total progress for all requests associated with aWebProgress.
292   *
293   * NOTE: If any progress value is unknown, or if its value would exceed the
294   * maximum value of type long, then its value is replaced with -1.
295   *
296   * NOTE: If the object also implements nsIWebProgressListener2 and the caller
297   * knows about that interface, this function will not be called. Instead,
298   * nsIWebProgressListener2::onProgressChange64 will be called.
299   */
300  void onProgressChange(in nsIWebProgress aWebProgress,
301                        in nsIRequest aRequest,
302                        in long aCurSelfProgress,
303                        in long aMaxSelfProgress,
304                        in long aCurTotalProgress,
305                        in long aMaxTotalProgress);
306
307  /**
308   * Called when the location of the window being watched changes.  This is not
309   * when a load is requested, but rather once it is verified that the load is
310   * going to occur in the given window.  For instance, a load that starts in a
311   * window might send progress and status messages for the new site, but it
312   * will not send the onLocationChange until we are sure that we are loading
313   * this new page here.
314   *
315   * @param aWebProgress
316   *        The nsIWebProgress instance that fired the notification.
317   * @param aRequest
318   *        The associated nsIRequest.  This may be null in some cases.
319   * @param aLocation
320   *        The URI of the location that is being loaded.
321   */
322  void onLocationChange(in nsIWebProgress aWebProgress,
323                        in nsIRequest aRequest,
324                        in nsIURI aLocation);
325
326  /**
327   * Notification that the status of a request has changed.  The status message
328   * is intended to be displayed to the user (e.g., in the status bar of the
329   * browser).
330   *
331   * @param aWebProgress
332   *        The nsIWebProgress instance that fired the notification.
333   * @param aRequest
334   *        The nsIRequest that has new status.
335   * @param aStatus
336   *        This value is not an error code.  Instead, it is a numeric value
337   *        that indicates the current status of the request.  This interface
338   *        does not define the set of possible status codes.  NOTE: Some
339   *        status values are defined by nsITransport and nsISocketTransport.
340   * @param aMessage
341   *        Localized text corresponding to aStatus.
342   */
343  void onStatusChange(in nsIWebProgress aWebProgress,
344                      in nsIRequest aRequest,
345                      in nsresult aStatus,
346                      in wstring aMessage);
347
348  /**
349   * Notification called for security progress.  This method will be called on
350   * security transitions (eg HTTP -> HTTPS, HTTPS -> HTTP, FOO -> HTTPS) and
351   * after document load completion.  It might also be called if an error
352   * occurs during network loading.
353   *
354   * @param aWebProgress
355   *        The nsIWebProgress instance that fired the notification.
356   * @param aRequest
357   *        The nsIRequest that has new security state.
358   * @param aState
359   *        A value composed of the Security State Flags and the Security
360   *        Strength Flags listed above.  Any undefined bits are reserved for
361   *        future use.
362   *
363   * NOTE: These notifications will only occur if a security package is
364   * installed.
365   */
366  void onSecurityChange(in nsIWebProgress aWebProgress,
367                        in nsIRequest aRequest,
368                        in unsigned long aState);
369};