browser/metro/components/SessionStore.idl

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

mercurial