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