summaryrefslogtreecommitdiffstats
path: root/browser/components/extensions/schemas/sessions.json
blob: 06b64e15250185b04193d9ba666b7a63881f3da8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
[
  {
    "namespace": "manifest",
    "types": [
      {
        "$extend": "OptionalPermission",
        "choices": [
          {
            "type": "string",
            "enum": ["sessions"]
          }
        ]
      }
    ]
  },
  {
    "namespace": "sessions",
    "description": "Use the <code>chrome.sessions</code> API to query and restore tabs and windows from a browsing session.",
    "permissions": ["sessions"],
    "types": [
      {
        "id": "Filter",
        "type": "object",
        "properties": {
          "maxResults": {
            "type": "integer",
            "minimum": 0,
            "maximum": 25,
            "optional": true,
            "description": "The maximum number of entries to be fetched in the requested list. Omit this parameter to fetch the maximum number of entries ($(ref:sessions.MAX_SESSION_RESULTS))."
          }
        }
      },
      {
        "id": "Session",
        "type": "object",
        "properties": {
          "lastModified": {
            "type": "integer",
            "description": "The time when the window or tab was closed or modified, represented in milliseconds since the epoch."
          },
          "tab": {
            "$ref": "tabs.Tab",
            "optional": true,
            "description": "The $(ref:tabs.Tab), if this entry describes a tab. Either this or $(ref:sessions.Session.window) will be set."
          },
          "window": {
            "$ref": "windows.Window",
            "optional": true,
            "description": "The $(ref:windows.Window), if this entry describes a window. Either this or $(ref:sessions.Session.tab) will be set."
          }
        }
      },
      {
        "id": "Device",
        "type": "object",
        "properties": {
          "info": { "type": "string" },
          "deviceName": {
            "type": "string",
            "description": "The name of the foreign device."
          },
          "sessions": {
            "type": "array",
            "items": { "$ref": "Session" },
            "description": "A list of open window sessions for the foreign device, sorted from most recently to least recently modified session."
          }
        }
      }
    ],
    "functions": [
      {
        "name": "forgetClosedTab",
        "type": "function",
        "description": "Forget a recently closed tab.",
        "async": true,
        "parameters": [
          {
            "name": "windowId",
            "type": "integer",
            "description": "The windowId of the window to which the recently closed tab to be forgotten belongs."
          },
          {
            "name": "sessionId",
            "type": "string",
            "description": "The sessionId (closedId) of the recently closed tab to be forgotten."
          }
        ]
      },
      {
        "name": "forgetClosedWindow",
        "type": "function",
        "description": "Forget a recently closed window.",
        "async": true,
        "parameters": [
          {
            "name": "sessionId",
            "type": "string",
            "description": "The sessionId (closedId) of the recently closed window to be forgotten."
          }
        ]
      },
      {
        "name": "getRecentlyClosed",
        "type": "function",
        "description": "Gets the list of recently closed tabs and/or windows.",
        "async": "callback",
        "parameters": [
          {
            "$ref": "Filter",
            "name": "filter",
            "optional": true,
            "default": {}
          },
          {
            "type": "function",
            "name": "callback",
            "parameters": [
              {
                "name": "sessions",
                "type": "array",
                "items": { "$ref": "Session" },
                "description": "The list of closed entries in reverse order that they were closed (the most recently closed tab or window will be at index <code>0</code>). The entries may contain either tabs or windows."
              }
            ]
          }
        ]
      },
      {
        "name": "getDevices",
        "unsupported": true,
        "type": "function",
        "description": "Retrieves all devices with synced sessions.",
        "async": "callback",
        "parameters": [
          {
            "$ref": "Filter",
            "name": "filter",
            "optional": true
          },
          {
            "type": "function",
            "name": "callback",
            "parameters": [
              {
                "name": "devices",
                "type": "array",
                "items": { "$ref": "Device" },
                "description": "The list of $(ref:sessions.Device) objects for each synced session, sorted in order from device with most recently modified session to device with least recently modified session. $(ref:tabs.Tab) objects are sorted by recency in the $(ref:windows.Window) of the $(ref:sessions.Session) objects."
              }
            ]
          }
        ]
      },
      {
        "name": "restore",
        "type": "function",
        "description": "Reopens a $(ref:windows.Window) or $(ref:tabs.Tab), with an optional callback to run when the entry has been restored.",
        "async": "callback",
        "parameters": [
          {
            "type": "string",
            "name": "sessionId",
            "optional": true,
            "description": "The $(ref:windows.Window.sessionId), or $(ref:tabs.Tab.sessionId) to restore. If this parameter is not specified, the most recently closed session is restored."
          },
          {
            "type": "function",
            "name": "callback",
            "optional": true,
            "parameters": [
              {
                "$ref": "Session",
                "name": "restoredSession",
                "description": "A $(ref:sessions.Session) containing the restored $(ref:windows.Window) or $(ref:tabs.Tab) object."
              }
            ]
          }
        ]
      },
      {
        "name": "setTabValue",
        "type": "function",
        "description": "Set a key/value pair on a given tab.",
        "async": true,
        "parameters": [
          {
            "type": "integer",
            "minimum": 0,
            "name": "tabId",
            "description": "The id of the tab that the key/value pair is being set on."
          },
          {
            "type": "string",
            "name": "key",
            "description": "The key which corresponds to the value being set."
          },
          {
            "type": "any",
            "name": "value",
            "description": "The value being set."
          }
        ]
      },
      {
        "name": "getTabValue",
        "type": "function",
        "description": "Retrieve a value that was set for a given key on a given tab.",
        "async": true,
        "parameters": [
          {
            "type": "integer",
            "minimum": 0,
            "name": "tabId",
            "description": "The id of the tab whose value is being retrieved from."
          },
          {
            "type": "string",
            "name": "key",
            "description": "The key which corresponds to the value."
          }
        ]
      },
      {
        "name": "removeTabValue",
        "type": "function",
        "description": "Remove a key/value pair that was set on a given tab.",
        "async": true,
        "parameters": [
          {
            "type": "integer",
            "minimum": 0,
            "name": "tabId",
            "description": "The id of the tab whose key/value pair is being removed."
          },
          {
            "type": "string",
            "name": "key",
            "description": "The key which corresponds to the value."
          }
        ]
      },
      {
        "name": "setWindowValue",
        "type": "function",
        "description": "Set a key/value pair on a given window.",
        "async": true,
        "parameters": [
          {
            "type": "integer",
            "minimum": -2,
            "name": "windowId",
            "description": "The id of the window that the key/value pair is being set on."
          },
          {
            "type": "string",
            "name": "key",
            "description": "The key which corresponds to the value being set."
          },
          {
            "type": "any",
            "name": "value",
            "description": "The value being set."
          }
        ]
      },
      {
        "name": "getWindowValue",
        "type": "function",
        "description": "Retrieve a value that was set for a given key on a given window.",
        "async": true,
        "parameters": [
          {
            "type": "integer",
            "minimum": -2,
            "name": "windowId",
            "description": "The id of the window whose value is being retrieved from."
          },
          {
            "type": "string",
            "name": "key",
            "description": "The key which corresponds to the value."
          }
        ]
      },
      {
        "name": "removeWindowValue",
        "type": "function",
        "description": "Remove a key/value pair that was set on a given window.",
        "async": true,
        "parameters": [
          {
            "type": "integer",
            "minimum": -2,
            "name": "windowId",
            "description": "The id of the window whose key/value pair is being removed."
          },
          {
            "type": "string",
            "name": "key",
            "description": "The key which corresponds to the value."
          }
        ]
      }
    ],
    "events": [
      {
        "name": "onChanged",
        "description": "Fired when recently closed tabs and/or windows are changed. This event does not monitor synced sessions changes.",
        "type": "function"
      }
    ],
    "properties": {
      "MAX_SESSION_RESULTS": {
        "value": 25,
        "description": "The maximum number of $(ref:sessions.Session) that will be included in a requested list."
      }
    }
  }
]