michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIDOMWindow; michael@0: interface nsIDOMNode; michael@0: michael@0: /** michael@0: * nsISessionStore keeps track of the current browsing state. michael@0: * michael@0: * The nsISessionStore API operates mostly on browser windows and the browser michael@0: * tabs contained in them. michael@0: */ michael@0: michael@0: [scriptable, uuid(766a09c1-d21b-4bf8-9fe3-8b34b716251a)] michael@0: interface nsISessionStore : nsISupports michael@0: { michael@0: /** michael@0: * Get the current browsing state. michael@0: * @returns a JSON string representing the session state. michael@0: */ michael@0: AString getBrowserState(); michael@0: michael@0: /** michael@0: * Get the number of restore-able tabs for a browser window michael@0: */ michael@0: unsigned long getClosedTabCount(in nsIDOMWindow aWindow); michael@0: michael@0: /** michael@0: * Get closed tab data michael@0: * michael@0: * @param aWindow is the browser window for which to get closed tab data michael@0: * @returns a JSON string representing the list of closed tabs. michael@0: */ michael@0: AString getClosedTabData(in nsIDOMWindow aWindow); michael@0: michael@0: /** michael@0: * @param aWindow is the browser window to reopen a closed tab in. michael@0: * @param aIndex is the index of the tab to be restored (FIFO ordered). michael@0: * @returns a reference to the reopened tab. michael@0: */ michael@0: nsIDOMNode undoCloseTab(in nsIDOMWindow aWindow, in unsigned long aIndex); michael@0: michael@0: /** michael@0: * @param aWindow is the browser window associated with the closed tab. michael@0: * @param aIndex is the index of the closed tab to be removed (FIFO ordered). michael@0: */ michael@0: nsIDOMNode forgetClosedTab(in nsIDOMWindow aWindow, in unsigned long aIndex); michael@0: michael@0: /** michael@0: * @param aTab is the browser tab to get the value for. michael@0: * @param aKey is the value's name. michael@0: * michael@0: * @returns A string value or an empty string if none is set. michael@0: */ michael@0: AString getTabValue(in nsIDOMNode aTab, in AString aKey); michael@0: michael@0: /** michael@0: * @param aTab is the browser tab to set the value for. michael@0: * @param aKey is the value's name. michael@0: * @param aStringValue is the value itself (use JSON.stringify/parse before setting JS objects). michael@0: */ michael@0: void setTabValue(in nsIDOMNode aTab, in AString aKey, in AString aStringValue); michael@0: michael@0: /** michael@0: * @param aTab is the browser tab to get the value for. michael@0: * @param aKey is the value's name. michael@0: */ michael@0: void deleteTabValue(in nsIDOMNode aTab, in AString aKey); michael@0: michael@0: /** michael@0: * @returns A boolean indicating we should restore previous browser session michael@0: */ michael@0: boolean shouldRestore(); michael@0: michael@0: /** michael@0: * Restores the previous browser session using a fast, lightweight strategy michael@0: * @param aBringToFront should a restored tab be brought to the foreground? michael@0: */ michael@0: void restoreLastSession(in boolean aBringToFront); michael@0: };