nsIWebBrowser.idl 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. *
  26. * Alternatively, the contents of this file may be used under the terms of
  27. * either the GNU General Public License Version 2 or later (the "GPL"), or
  28. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  29. * in which case the provisions of the GPL or the LGPL are applicable instead
  30. * of those above. If you wish to allow use of your version of this file only
  31. * under the terms of either the GPL or the LGPL, and not to allow others to
  32. * use your version of this file under the terms of the MPL, indicate your
  33. * decision by deleting the provisions above and replace them with the notice
  34. * and other provisions required by the GPL or the LGPL. If you do not delete
  35. * the provisions above, a recipient may use your version of this file under
  36. * the terms of any one of the MPL, the GPL or the LGPL.
  37. *
  38. * ***** END LICENSE BLOCK ***** */
  39. #include "nsISupports.idl"
  40. interface nsIInterfaceRequestor;
  41. interface nsIWebBrowserChrome;
  42. interface nsIURIContentListener;
  43. interface nsIDOMWindow;
  44. interface nsIWeakReference;
  45. /**
  46. * The nsIWebBrowser interface is implemented by web browser objects.
  47. * Embedders use this interface during initialisation to associate
  48. * the new web browser instance with the embedders chrome and
  49. * to register any listeners. The interface may also be used at runtime
  50. * to obtain the content DOM window and from that the rest of the DOM.
  51. *
  52. * @status FROZEN
  53. */
  54. [scriptable, uuid(69E5DF00-7B8B-11d3-AF61-00A024FFC08C)]
  55. interface nsIWebBrowser : nsISupports
  56. {
  57. /**
  58. * Registers a listener of the type specified by the iid to receive
  59. * callbacks. The browser stores a weak reference to the listener
  60. * to avoid any circular dependencies.
  61. * Typically this method will be called to register an object
  62. * to receive <CODE>nsIWebProgressListener</CODE> or
  63. * <CODE>nsISHistoryListener</CODE> notifications in which case the
  64. * the IID is that of the interface.
  65. *
  66. * @param aListener The listener to be added.
  67. * @param aIID The IID of the interface that will be called
  68. * on the listener as appropriate.
  69. * @return <CODE>NS_OK</CODE> for successful registration;
  70. * <CODE>NS_ERROR_INVALID_ARG</CODE> if aIID is not
  71. * supposed to be registered using this method;
  72. * <CODE>NS_ERROR_FAILURE</CODE> either aListener did not
  73. * expose the interface specified by the IID, or some
  74. * other internal error occurred.
  75. *
  76. * @see removeWebBrowserListener
  77. * @see nsIWeakReference
  78. * @see nsIWebProgressListener
  79. * @see nsISHistoryListener
  80. *
  81. * @return <CODE>NS_OK</CODE>, listener was successfully added;
  82. * <CODE>NS_ERROR_INVALID_ARG</CODE>, one of the arguments was
  83. * invalid or the object did not implement the interface
  84. * specified by the IID.
  85. */
  86. void addWebBrowserListener(in nsIWeakReference aListener, in nsIIDRef aIID);
  87. /**
  88. * Removes a previously registered listener.
  89. *
  90. * @param aListener The listener to be removed.
  91. * @param aIID The IID of the interface on the listener that will
  92. * no longer be called.
  93. *
  94. * @return <CODE>NS_OK</CODE>, listener was successfully removed;
  95. * <CODE>NS_ERROR_INVALID_ARG</CODE> arguments was invalid or
  96. * the object did not implement the interface specified by the IID.
  97. *
  98. * @see addWebBrowserListener
  99. * @see nsIWeakReference
  100. */
  101. void removeWebBrowserListener(in nsIWeakReference aListener, in nsIIDRef aIID);
  102. /**
  103. * The chrome object associated with the browser instance. The embedder
  104. * must create one chrome object for <I>each</I> browser object
  105. * that is instantiated. The embedder must associate the two by setting
  106. * this property to point to the chrome object before creating the browser
  107. * window via the browser's <CODE>nsIBaseWindow</CODE> interface.
  108. *
  109. * The chrome object must also implement <CODE>nsIEmbeddingSiteWindow</CODE>.
  110. *
  111. * The chrome may optionally implement <CODE>nsIInterfaceRequestor</CODE>,
  112. * <CODE>nsIWebBrowserChromeFocus</CODE>,
  113. * <CODE>nsIContextMenuListener</CODE> and
  114. * <CODE>nsITooltipListener</CODE> to receive additional notifications
  115. * from the browser object.
  116. *
  117. * The chrome object may optionally implement <CODE>nsIWebProgressListener</CODE>
  118. * instead of explicitly calling <CODE>addWebBrowserListener</CODE> and
  119. * <CODE>removeWebBrowserListener</CODE> to register a progress listener
  120. * object. If the implementation does this, it must also implement
  121. * <CODE>nsIWeakReference</CODE>.
  122. *
  123. * @note The implementation should not refcount the supplied chrome
  124. * object; it should assume that a non <CODE>nsnull</CODE> value is
  125. * always valid. The embedder must explicitly set this value back
  126. * to nsnull if the chrome object is destroyed before the browser
  127. * object.
  128. *
  129. * @see nsIBaseWindow
  130. * @see nsIWebBrowserChrome
  131. * @see nsIEmbeddingSiteWindow
  132. * @see nsIInterfaceRequestor
  133. * @see nsIWebBrowserChromeFocus
  134. * @see nsIContextMenuListener
  135. * @see nsITooltipListener
  136. * @see nsIWeakReference
  137. * @see nsIWebProgressListener
  138. */
  139. attribute nsIWebBrowserChrome containerWindow;
  140. /**
  141. * URI content listener parent. The embedder may set this property to
  142. * their own implementation if they intend to override or prevent
  143. * how certain kinds of content are loaded.
  144. *
  145. * @note If this attribute is set to an object that implements
  146. * nsISupportsWeakReference, the implementation should get the
  147. * nsIWeakReference and hold that. Otherwise, the implementation
  148. * should not refcount this interface; it should assume that a non
  149. * null value is always valid. In that case, the embedder should
  150. * explicitly set this value back to null if the parent content
  151. * listener is destroyed before the browser object.
  152. *
  153. * @see nsIURIContentListener
  154. */
  155. attribute nsIURIContentListener parentURIContentListener;
  156. /**
  157. * The top-level DOM window. The embedder may walk the entire
  158. * DOM starting from this value.
  159. *
  160. * @see nsIDOMWindow
  161. */
  162. readonly attribute nsIDOMWindow contentDOMWindow;
  163. };