1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/components/SessionStore.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,79 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "nsISupports.idl" 1.9 + 1.10 +interface nsIDOMWindow; 1.11 +interface nsIDOMNode; 1.12 + 1.13 +/** 1.14 + * nsISessionStore keeps track of the current browsing state. 1.15 + * 1.16 + * The nsISessionStore API operates mostly on browser windows and the browser 1.17 + * tabs contained in them. 1.18 + */ 1.19 + 1.20 +[scriptable, uuid(fe116b56-0226-4562-b52a-a623dad07ead)] 1.21 +interface nsISessionStore : nsISupports 1.22 +{ 1.23 + /** 1.24 + * Get the current browsing state. 1.25 + * @returns a JSON string representing the session state. 1.26 + */ 1.27 + AString getBrowserState(); 1.28 + 1.29 + /** 1.30 + * Get the number of restore-able tabs for a browser window 1.31 + */ 1.32 + unsigned long getClosedTabCount(in nsIDOMWindow aWindow); 1.33 + 1.34 + /** 1.35 + * Get closed tab data 1.36 + * 1.37 + * @param aWindow is the browser window for which to get closed tab data 1.38 + * @returns a JSON string representing the list of closed tabs. 1.39 + */ 1.40 + AString getClosedTabData(in nsIDOMWindow aWindow); 1.41 + 1.42 + /** 1.43 + * @param aWindow is the browser window to reopen a closed tab in. 1.44 + * @param aIndex is the index of the tab to be restored (FIFO ordered). 1.45 + * @returns a reference to the reopened tab. 1.46 + */ 1.47 + nsIDOMNode undoCloseTab(in nsIDOMWindow aWindow, in unsigned long aIndex); 1.48 + 1.49 + /** 1.50 + * @param aWindow is the browser window associated with the closed tab. 1.51 + * @param aIndex is the index of the closed tab to be removed (FIFO ordered). 1.52 + */ 1.53 + nsIDOMNode forgetClosedTab(in nsIDOMWindow aWindow, in unsigned long aIndex); 1.54 + 1.55 + /** 1.56 + * @param aTab is the browser tab to get the value for. 1.57 + * @param aKey is the value's name. 1.58 + * 1.59 + * @returns A string value or an empty string if none is set. 1.60 + */ 1.61 + AString getTabValue(in jsval aTab, in AString aKey); 1.62 + 1.63 + /** 1.64 + * @param aTab is the browser tab to set the value for. 1.65 + * @param aKey is the value's name. 1.66 + * @param aStringValue is the value itself (use JSON.stringify/parse before setting JS objects). 1.67 + */ 1.68 + void setTabValue(in jsval aTab, in AString aKey, in AString aStringValue); 1.69 + 1.70 + /** 1.71 + * @param aTab is the browser tab to get the value for. 1.72 + * @param aKey is the value's name. 1.73 + */ 1.74 + void deleteTabValue(in jsval aTab, in AString aKey); 1.75 + 1.76 + /** 1.77 + * Restores the previous browser session using a fast, lightweight strategy 1.78 + * @param aSessionString The session string to restore from. If null, the 1.79 + * backup session file is read from. 1.80 + */ 1.81 + void restoreLastSession(in AString aSessionString); 1.82 +};