Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #include "nsISupports.idl" |
michael@0 | 6 | |
michael@0 | 7 | interface nsIDOMWindow; |
michael@0 | 8 | interface nsIDOMNode; |
michael@0 | 9 | |
michael@0 | 10 | /** |
michael@0 | 11 | * nsISessionStore keeps track of the current browsing state. |
michael@0 | 12 | * |
michael@0 | 13 | * The nsISessionStore API operates mostly on browser windows and the browser |
michael@0 | 14 | * tabs contained in them. |
michael@0 | 15 | */ |
michael@0 | 16 | |
michael@0 | 17 | [scriptable, uuid(766a09c1-d21b-4bf8-9fe3-8b34b716251a)] |
michael@0 | 18 | interface nsISessionStore : nsISupports |
michael@0 | 19 | { |
michael@0 | 20 | /** |
michael@0 | 21 | * Get the current browsing state. |
michael@0 | 22 | * @returns a JSON string representing the session state. |
michael@0 | 23 | */ |
michael@0 | 24 | AString getBrowserState(); |
michael@0 | 25 | |
michael@0 | 26 | /** |
michael@0 | 27 | * Get the number of restore-able tabs for a browser window |
michael@0 | 28 | */ |
michael@0 | 29 | unsigned long getClosedTabCount(in nsIDOMWindow aWindow); |
michael@0 | 30 | |
michael@0 | 31 | /** |
michael@0 | 32 | * Get closed tab data |
michael@0 | 33 | * |
michael@0 | 34 | * @param aWindow is the browser window for which to get closed tab data |
michael@0 | 35 | * @returns a JSON string representing the list of closed tabs. |
michael@0 | 36 | */ |
michael@0 | 37 | AString getClosedTabData(in nsIDOMWindow aWindow); |
michael@0 | 38 | |
michael@0 | 39 | /** |
michael@0 | 40 | * @param aWindow is the browser window to reopen a closed tab in. |
michael@0 | 41 | * @param aIndex is the index of the tab to be restored (FIFO ordered). |
michael@0 | 42 | * @returns a reference to the reopened tab. |
michael@0 | 43 | */ |
michael@0 | 44 | nsIDOMNode undoCloseTab(in nsIDOMWindow aWindow, in unsigned long aIndex); |
michael@0 | 45 | |
michael@0 | 46 | /** |
michael@0 | 47 | * @param aWindow is the browser window associated with the closed tab. |
michael@0 | 48 | * @param aIndex is the index of the closed tab to be removed (FIFO ordered). |
michael@0 | 49 | */ |
michael@0 | 50 | nsIDOMNode forgetClosedTab(in nsIDOMWindow aWindow, in unsigned long aIndex); |
michael@0 | 51 | |
michael@0 | 52 | /** |
michael@0 | 53 | * @param aTab is the browser tab to get the value for. |
michael@0 | 54 | * @param aKey is the value's name. |
michael@0 | 55 | * |
michael@0 | 56 | * @returns A string value or an empty string if none is set. |
michael@0 | 57 | */ |
michael@0 | 58 | AString getTabValue(in nsIDOMNode aTab, in AString aKey); |
michael@0 | 59 | |
michael@0 | 60 | /** |
michael@0 | 61 | * @param aTab is the browser tab to set the value for. |
michael@0 | 62 | * @param aKey is the value's name. |
michael@0 | 63 | * @param aStringValue is the value itself (use JSON.stringify/parse before setting JS objects). |
michael@0 | 64 | */ |
michael@0 | 65 | void setTabValue(in nsIDOMNode aTab, in AString aKey, in AString aStringValue); |
michael@0 | 66 | |
michael@0 | 67 | /** |
michael@0 | 68 | * @param aTab is the browser tab to get the value for. |
michael@0 | 69 | * @param aKey is the value's name. |
michael@0 | 70 | */ |
michael@0 | 71 | void deleteTabValue(in nsIDOMNode aTab, in AString aKey); |
michael@0 | 72 | |
michael@0 | 73 | /** |
michael@0 | 74 | * @returns A boolean indicating we should restore previous browser session |
michael@0 | 75 | */ |
michael@0 | 76 | boolean shouldRestore(); |
michael@0 | 77 | |
michael@0 | 78 | /** |
michael@0 | 79 | * Restores the previous browser session using a fast, lightweight strategy |
michael@0 | 80 | * @param aBringToFront should a restored tab be brought to the foreground? |
michael@0 | 81 | */ |
michael@0 | 82 | void restoreLastSession(in boolean aBringToFront); |
michael@0 | 83 | }; |