nsISHistory.idl 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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) 1999
  20. * the Initial Developer. All Rights Reserved.
  21. *
  22. * Contributor(s):
  23. * Radha Kulkarni ([email protected])
  24. *
  25. * Alternatively, the contents of this file may be used under the terms of
  26. * either of the GNU General Public License Version 2 or later (the "GPL"),
  27. * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  28. * in which case the provisions of the GPL or the LGPL are applicable instead
  29. * of those above. If you wish to allow use of your version of this file only
  30. * under the terms of either the GPL or the LGPL, and not to allow others to
  31. * use your version of this file under the terms of the MPL, indicate your
  32. * decision by deleting the provisions above and replace them with the notice
  33. * and other provisions required by the GPL or the LGPL. If you do not delete
  34. * the provisions above, a recipient may use your version of this file under
  35. * the terms of any one of the MPL, the GPL or the LGPL.
  36. *
  37. * ***** END LICENSE BLOCK ***** */
  38. #include "nsISupports.idl"
  39. interface nsIHistoryEntry;
  40. interface nsISHistoryListener;
  41. interface nsISimpleEnumerator;
  42. /**
  43. * An interface to the primary properties of the Session History
  44. * component. In an embedded browser environment, the nsIWebBrowser
  45. * object creates an instance of session history for each open window.
  46. * A handle to the session history object can be obtained from
  47. * nsIWebNavigation. In a non-embedded situation, the owner of the
  48. * session history component must create a instance of it and set
  49. * it in the nsIWebNavigation object.
  50. * This interface is accessible from javascript.
  51. *
  52. * @status FROZEN
  53. */
  54. %{C++
  55. #define NS_SHISTORY_CID \
  56. {0x7294fe9c, 0x14d8, 0x11d5, {0x98, 0x82, 0x00, 0xC0, 0x4f, 0xa0, 0x2f, 0x40}}
  57. #define NS_SHISTORY_CONTRACTID "@mozilla.org/browser/shistory;1"
  58. %}
  59. [scriptable, uuid(7294FE9B-14D8-11D5-9882-00C04FA02F40)]
  60. interface nsISHistory: nsISupports
  61. {
  62. /**
  63. * A readonly property of the interface that returns
  64. * the number of toplevel documents currently available
  65. * in session history.
  66. */
  67. readonly attribute long count;
  68. /**
  69. * A readonly property of the interface that returns
  70. * the index of the current document in session history.
  71. */
  72. readonly attribute long index;
  73. /**
  74. * A read/write property of the interface, used to Get/Set
  75. * the maximum number of toplevel documents, session history
  76. * can hold for each instance.
  77. */
  78. attribute long maxLength;
  79. /**
  80. * Called to obtain handle to the history entry at a
  81. * given index.
  82. *
  83. * @param index The index value whose entry is requested.
  84. * @param modifyIndex A boolean flag that indicates if the current
  85. * index of session history should be modified
  86. * to the parameter index.
  87. *
  88. * @return <code>NS_OK</code> history entry for
  89. * the index is obtained successfully.
  90. * <code>NS_ERROR_FAILURE</code> Error in obtaining
  91. * history entry for the given index.
  92. */
  93. nsIHistoryEntry getEntryAtIndex(in long index, in boolean modifyIndex);
  94. /**
  95. * Called to purge older documents from history.
  96. * Documents can be removed from session history for various
  97. * reasons. For example to control memory usage of the browser, to
  98. * prevent users from loading documents from history, to erase evidence of
  99. * prior page loads etc...
  100. *
  101. * @param numEntries The number of toplevel documents to be
  102. * purged from history. During purge operation,
  103. * the latest documents are maintained and older
  104. * 'numEntries' documents are removed from history.
  105. * @throws <code>NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA</code> Purge was vetod.
  106. * @throws <code>NS_ERROR_FAILURE</code> numEntries is
  107. * invalid or out of bounds with the size of history.
  108. *
  109. */
  110. void PurgeHistory(in long numEntries);
  111. /**
  112. * Called to register a listener for the session history component.
  113. * Listeners are notified when pages are loaded or purged from history.
  114. *
  115. * @param aListener Listener object to be notified for all
  116. * page loads that initiate in session history.
  117. *
  118. * @note A listener object must implement
  119. * nsISHistoryListener and nsSupportsWeakReference
  120. *
  121. * @see nsISHistoryListener
  122. * @see nsSupportsWeakReference
  123. */
  124. void addSHistoryListener(in nsISHistoryListener aListener);
  125. /**
  126. * Called to remove a listener for the session history component.
  127. * Listeners are notified when pages are loaded from history.
  128. *
  129. * @param aListener Listener object to be removed from
  130. * session history.
  131. *
  132. * @note A listener object must implement
  133. * nsISHistoryListener and nsSupportsWeakReference
  134. * @see nsISHistoryListener
  135. * @see nsSupportsWeakReference
  136. */
  137. void removeSHistoryListener(in nsISHistoryListener aListener);
  138. /**
  139. * Called to obtain a enumerator for all the documents stored in
  140. * session history. The enumerator object thus returned by this method
  141. * can be traversed using nsISimpleEnumerator.
  142. *
  143. * @note To access individual history entries of the enumerator, perform the
  144. * following steps:
  145. * 1) Call nsISHistory->GetSHistoryEnumerator() to obtain handle
  146. * the nsISimpleEnumerator object.
  147. * 2) Use nsISimpleEnumerator->GetNext() on the object returned
  148. * by step #1 to obtain handle to the next object in the list.
  149. * The object returned by this step is of type nsISupports.
  150. * 3) Perform a QueryInterface on the object returned by step #2
  151. * to nsIHistoryEntry.
  152. * 4) Use nsIHistoryEntry to access properties of each history entry.
  153. *
  154. * @see nsISimpleEnumerator
  155. * @see nsIHistoryEntry
  156. * @see QueryInterface()
  157. * @see do_QueryInterface()
  158. */
  159. readonly attribute nsISimpleEnumerator SHistoryEnumerator;
  160. };