PageRenderTime 25ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/gecko_sdk/idl/nsISHistory.idl

http://firefox-mac-pdf.googlecode.com/
IDL | 182 lines | 22 code | 15 blank | 145 comment | 0 complexity | bdd2df2c635d2b4608ae7c81648c6bb7 MD5 | raw file
  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 (radha@netscape.com)
  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(9883609F-CDD8-4d83-9B55-868FF08AD433)]
  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 readonly property of the interface that returns
  75. * the index of the last document that started to load and
  76. * didn't finished yet. When document finishes the loading
  77. * value -1 is returned.
  78. */
  79. readonly attribute long requestedIndex;
  80. /**
  81. * A read/write property of the interface, used to Get/Set
  82. * the maximum number of toplevel documents, session history
  83. * can hold for each instance.
  84. */
  85. attribute long maxLength;
  86. /**
  87. * Called to obtain handle to the history entry at a
  88. * given index.
  89. *
  90. * @param index The index value whose entry is requested.
  91. * @param modifyIndex A boolean flag that indicates if the current
  92. * index of session history should be modified
  93. * to the parameter index.
  94. *
  95. * @return <code>NS_OK</code> history entry for
  96. * the index is obtained successfully.
  97. * <code>NS_ERROR_FAILURE</code> Error in obtaining
  98. * history entry for the given index.
  99. */
  100. nsIHistoryEntry getEntryAtIndex(in long index, in boolean modifyIndex);
  101. /**
  102. * Called to purge older documents from history.
  103. * Documents can be removed from session history for various
  104. * reasons. For example to control memory usage of the browser, to
  105. * prevent users from loading documents from history, to erase evidence of
  106. * prior page loads etc...
  107. *
  108. * @param numEntries The number of toplevel documents to be
  109. * purged from history. During purge operation,
  110. * the latest documents are maintained and older
  111. * 'numEntries' documents are removed from history.
  112. * @throws <code>NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA</code> Purge was vetod.
  113. * @throws <code>NS_ERROR_FAILURE</code> numEntries is
  114. * invalid or out of bounds with the size of history.
  115. *
  116. */
  117. void PurgeHistory(in long numEntries);
  118. /**
  119. * Called to register a listener for the session history component.
  120. * Listeners are notified when pages are loaded or purged from history.
  121. *
  122. * @param aListener Listener object to be notified for all
  123. * page loads that initiate in session history.
  124. *
  125. * @note A listener object must implement
  126. * nsISHistoryListener and nsSupportsWeakReference
  127. *
  128. * @see nsISHistoryListener
  129. * @see nsSupportsWeakReference
  130. */
  131. void addSHistoryListener(in nsISHistoryListener aListener);
  132. /**
  133. * Called to remove a listener for the session history component.
  134. * Listeners are notified when pages are loaded from history.
  135. *
  136. * @param aListener Listener object to be removed from
  137. * session history.
  138. *
  139. * @note A listener object must implement
  140. * nsISHistoryListener and nsSupportsWeakReference
  141. * @see nsISHistoryListener
  142. * @see nsSupportsWeakReference
  143. */
  144. void removeSHistoryListener(in nsISHistoryListener aListener);
  145. /**
  146. * Called to obtain a enumerator for all the documents stored in
  147. * session history. The enumerator object thus returned by this method
  148. * can be traversed using nsISimpleEnumerator.
  149. *
  150. * @note To access individual history entries of the enumerator, perform the
  151. * following steps:
  152. * 1) Call nsISHistory->GetSHistoryEnumerator() to obtain handle
  153. * the nsISimpleEnumerator object.
  154. * 2) Use nsISimpleEnumerator->GetNext() on the object returned
  155. * by step #1 to obtain handle to the next object in the list.
  156. * The object returned by this step is of type nsISupports.
  157. * 3) Perform a QueryInterface on the object returned by step #2
  158. * to nsIHistoryEntry.
  159. * 4) Use nsIHistoryEntry to access properties of each history entry.
  160. *
  161. * @see nsISimpleEnumerator
  162. * @see nsIHistoryEntry
  163. * @see QueryInterface()
  164. * @see do_QueryInterface()
  165. */
  166. readonly attribute nsISimpleEnumerator SHistoryEnumerator;
  167. };