nsIWebProgress.idl 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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 <[email protected]>
  25. * Darin Fisher <[email protected]>
  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. #include "nsISupports.idl"
  41. interface nsIDOMWindow;
  42. interface nsIWebProgressListener;
  43. /**
  44. * The nsIWebProgress interface is used to add or remove nsIWebProgressListener
  45. * instances to observe the loading of asynchronous requests (usually in the
  46. * context of a DOM window).
  47. *
  48. * nsIWebProgress instances may be arranged in a parent-child configuration,
  49. * corresponding to the parent-child configuration of their respective DOM
  50. * windows. However, in some cases a nsIWebProgress instance may not have an
  51. * associated DOM window. The parent-child relationship of nsIWebProgress
  52. * instances is not made explicit by this interface, but the relationship may
  53. * exist in some implementations.
  54. *
  55. * A nsIWebProgressListener instance receives notifications for the
  56. * nsIWebProgress instance to which it added itself, and it may also receive
  57. * notifications from any nsIWebProgress instances that are children of that
  58. * nsIWebProgress instance.
  59. *
  60. * @status FROZEN
  61. */
  62. [scriptable, uuid(570F39D0-EFD0-11d3-B093-00A024FFC08C)]
  63. interface nsIWebProgress : nsISupports
  64. {
  65. /**
  66. * The following flags may be combined to form the aNotifyMask parameter for
  67. * the addProgressListener method. They limit the set of events that are
  68. * delivered to an nsIWebProgressListener instance.
  69. */
  70. /**
  71. * These flags indicate the state transistions to observe, corresponding to
  72. * nsIWebProgressListener::onStateChange.
  73. *
  74. * NOTIFY_STATE_REQUEST
  75. * Only receive the onStateChange event if the aStateFlags parameter
  76. * includes nsIWebProgressListener::STATE_IS_REQUEST.
  77. *
  78. * NOTIFY_STATE_DOCUMENT
  79. * Only receive the onStateChange event if the aStateFlags parameter
  80. * includes nsIWebProgressListener::STATE_IS_DOCUMENT.
  81. *
  82. * NOTIFY_STATE_NETWORK
  83. * Only receive the onStateChange event if the aStateFlags parameter
  84. * includes nsIWebProgressListener::STATE_IS_NETWORK.
  85. *
  86. * NOTIFY_STATE_WINDOW
  87. * Only receive the onStateChange event if the aStateFlags parameter
  88. * includes nsIWebProgressListener::STATE_IS_WINDOW.
  89. *
  90. * NOTIFY_STATE_ALL
  91. * Receive all onStateChange events.
  92. */
  93. const unsigned long NOTIFY_STATE_REQUEST = 0x00000001;
  94. const unsigned long NOTIFY_STATE_DOCUMENT = 0x00000002;
  95. const unsigned long NOTIFY_STATE_NETWORK = 0x00000004;
  96. const unsigned long NOTIFY_STATE_WINDOW = 0x00000008;
  97. const unsigned long NOTIFY_STATE_ALL = 0x0000000f;
  98. /**
  99. * These flags indicate the other events to observe, corresponding to the
  100. * other four methods defined on nsIWebProgressListener.
  101. *
  102. * NOTIFY_PROGRESS
  103. * Receive onProgressChange events.
  104. *
  105. * NOTIFY_STATUS
  106. * Receive onStatusChange events.
  107. *
  108. * NOTIFY_SECURITY
  109. * Receive onSecurityChange events.
  110. *
  111. * NOTIFY_LOCATION
  112. * Receive onLocationChange events.
  113. */
  114. const unsigned long NOTIFY_PROGRESS = 0x00000010;
  115. const unsigned long NOTIFY_STATUS = 0x00000020;
  116. const unsigned long NOTIFY_SECURITY = 0x00000040;
  117. const unsigned long NOTIFY_LOCATION = 0x00000080;
  118. /**
  119. * This flag enables all notifications.
  120. */
  121. const unsigned long NOTIFY_ALL = 0x000000ff;
  122. /**
  123. * Registers a listener to receive web progress events.
  124. *
  125. * @param aListener
  126. * The listener interface to be called when a progress event occurs.
  127. * This object must also implement nsISupportsWeakReference.
  128. * @param aNotifyMask
  129. * The types of notifications to receive.
  130. *
  131. * @throw NS_ERROR_INVALID_ARG
  132. * Indicates that aListener was either null or that it does not
  133. * support weak references.
  134. * @throw NS_ERROR_FAILURE
  135. * Indicates that aListener was already registered.
  136. */
  137. void addProgressListener(in nsIWebProgressListener aListener,
  138. in unsigned long aNotifyMask);
  139. /**
  140. * Removes a previously registered listener of progress events.
  141. *
  142. * @param aListener
  143. * The listener interface previously registered with a call to
  144. * addProgressListener.
  145. *
  146. * @throw NS_ERROR_FAILURE
  147. * Indicates that aListener was not registered.
  148. */
  149. void removeProgressListener(in nsIWebProgressListener aListener);
  150. /**
  151. * The DOM window associated with this nsIWebProgress instance.
  152. *
  153. * @throw NS_ERROR_FAILURE
  154. * Indicates that there is no associated DOM window.
  155. */
  156. readonly attribute nsIDOMWindow DOMWindow;
  157. /**
  158. * Indicates whether or not a document is currently being loaded
  159. * in the context of this nsIWebProgress instance.
  160. */
  161. readonly attribute PRBool isLoadingDocument;
  162. };