PageRenderTime 123ms CodeModel.GetById 60ms app.highlight 3ms RepoModel.GetById 38ms app.codeStats 20ms

/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
 39#include "nsISupports.idl"
 40
 41interface nsIHistoryEntry;
 42interface nsISHistoryListener;
 43interface nsISimpleEnumerator;
 44/**
 45 * An interface to the primary properties of the Session History
 46 * component. In an embedded browser environment, the nsIWebBrowser
 47 * object creates an instance of session history for each open window.
 48 * A handle to the session history object can be obtained from
 49 * nsIWebNavigation. In a non-embedded situation, the  owner of the
 50 * session history component must create a instance of it and set
 51 * it in the nsIWebNavigation object.
 52 * This interface is accessible from javascript. 
 53 *
 54 * @status FROZEN
 55 */
 56 
 57
 58%{C++
 59#define NS_SHISTORY_CID \
 60{0x7294fe9c, 0x14d8, 0x11d5, {0x98, 0x82, 0x00, 0xC0, 0x4f, 0xa0, 0x2f, 0x40}}
 61
 62#define NS_SHISTORY_CONTRACTID "@mozilla.org/browser/shistory;1"
 63%}
 64
 65[scriptable, uuid(9883609F-CDD8-4d83-9B55-868FF08AD433)]
 66interface nsISHistory: nsISupports
 67{
 68  /**
 69   * A readonly property of the interface that returns 
 70   * the number of toplevel documents currently available
 71   * in session history.
 72   */
 73   readonly attribute long count;
 74
 75  /**
 76   * A readonly property of the interface that returns 
 77   * the index of the current document in session history.
 78   */
 79   readonly attribute long index;
 80
 81  /**
 82   * A readonly property of the interface that returns 
 83   * the index of the last document that started to load and
 84   * didn't finished yet. When document finishes the loading
 85   * value -1 is returned.
 86   */
 87   readonly attribute long requestedIndex;
 88
 89  /**
 90   * A read/write property of the interface, used to Get/Set
 91   * the maximum number of toplevel documents, session history 
 92   * can hold for each instance. 
 93   */
 94   attribute long maxLength;
 95
 96  /**
 97   * Called to obtain handle to the history entry at a
 98   * given index.
 99   *
100   * @param index             The index value whose entry is requested.
101   * @param modifyIndex       A boolean flag that indicates if the current
102   *                          index of session history should be modified 
103   *                          to the parameter index.
104   *
105   * @return                  <code>NS_OK</code> history entry for 
106   *                          the index is obtained successfully.
107   *                          <code>NS_ERROR_FAILURE</code> Error in obtaining
108   *                          history entry for the given index.
109   */
110   nsIHistoryEntry getEntryAtIndex(in long index, in boolean modifyIndex);
111
112
113  /**
114   * Called to purge older documents from history.
115   * Documents can be removed from session history for various 
116   * reasons. For example to  control memory usage of the browser, to 
117   * prevent users from loading documents from history, to erase evidence of
118   * prior page loads etc...
119   *
120   * @param numEntries        The number of toplevel documents to be
121   *                          purged from history. During purge operation,
122   *                          the latest documents are maintained and older 
123   *                          'numEntries' documents are removed from history.
124   * @throws                  <code>NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA</code> Purge was vetod.
125   * @throws                  <code>NS_ERROR_FAILURE</code> numEntries is
126   *                          invalid or out of bounds with the size of history.
127   *                          
128   */
129   void PurgeHistory(in long numEntries);
130
131  /**
132   * Called to register a listener for the session history component.
133   * Listeners are notified when pages are loaded or purged from history.
134   * 
135   * @param aListener         Listener object to be notified for all
136   *                          page loads that initiate in session history.
137   *
138   * @note                    A listener object must implement 
139   *                          nsISHistoryListener and nsSupportsWeakReference
140   *
141   * @see nsISHistoryListener
142   * @see nsSupportsWeakReference
143   */
144   void addSHistoryListener(in nsISHistoryListener aListener);
145
146  /**
147   * Called to remove a listener for the session history component.
148   * Listeners are notified when pages are loaded from history.
149   * 
150   * @param aListener         Listener object to be removed from 
151   *                          session history.
152   *
153   * @note                    A listener object must implement 
154   *                          nsISHistoryListener and nsSupportsWeakReference
155   * @see nsISHistoryListener
156   * @see nsSupportsWeakReference
157   */ 
158   void removeSHistoryListener(in nsISHistoryListener aListener);
159
160  /**
161   * Called to obtain a enumerator for all the  documents stored in 
162   * session history. The enumerator object thus returned by this method
163   * can be traversed using nsISimpleEnumerator. 
164   *
165   * @note  To access individual history entries of the enumerator, perform the
166   *        following steps:
167   *        1) Call nsISHistory->GetSHistoryEnumerator() to obtain handle 
168   *           the nsISimpleEnumerator object.
169   *        2) Use nsISimpleEnumerator->GetNext() on the object returned
170   *           by step #1 to obtain handle to the next object in the list. 
171   *           The object returned by this step is of type nsISupports.
172   *        3) Perform a QueryInterface on the object returned by step #2 
173   *           to nsIHistoryEntry.
174   *        4) Use nsIHistoryEntry to access properties of each history entry. 
175   *
176   * @see nsISimpleEnumerator
177   * @see nsIHistoryEntry
178   * @see QueryInterface()
179   * @see do_QueryInterface()
180   */
181   readonly attribute nsISimpleEnumerator SHistoryEnumerator;
182};