Home | History | Annotate | Download | only in api
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 [
      6   {
      7     "namespace": "sessionRestore",
      8     "description": "Use the <code>chrome.sessionRestore</code> API to query and restore tabs and windows from a browsing session.",
      9     "types": [
     10       {
     11         "id": "ClosedEntry",
     12         "type": "object",
     13         "properties": {
     14           "id": {"type": "integer", "minimum": 0, "description": "The ID of the browser session."},
     15           "timestamp": {"type": "integer", "description": "The time when the window or tab was closed, represented in milliseconds since the epoch"},
     16           "tab": {"$ref": "tabs.Tab", "optional": true, "description": "The closed $ref:tabs.Tab, if this entry describes a tab. Either this or $ref:ClosedEntry.window will be set."},
     17           "window": {"$ref": "windows.Window", "optional": true, "description": "The closed $ref:windows.Window, if this entry describes a window. Either this or $ref:ClosedEntry.tab will be set."}
     18         }
     19       }
     20     ],
     21     "functions": [
     22       {
     23         "name": "getRecentlyClosed",
     24         "type": "function",
     25         "description": "Gets the list of recently closed tabs and/or windows.",
     26         "parameters": [
     27           {
     28             "type": "object",
     29             "name": "options",
     30             "optional": true,
     31             "properties": {
     32               "maxResults": {
     33                 "type": "integer",
     34                 "minimum": 0,
     35                 "maximum": 25,
     36                 "optional": true,
     37                 "description": "The maximum number of entries to be fetched in the requested list. Omit to fetch the maximum number of entries (25)."
     38               },
     39               "entryType": {
     40                 "type": "string",
     41                 "enum": ["tab", "window"],
     42                 "optional": true,
     43                 "description": "The type of entry to fetch. Omit to fetch all types of entries."
     44               }
     45             }
     46           },
     47           {
     48             "type": "function",
     49             "name": "callback",
     50             "parameters": [
     51               {
     52                 "name": "entries", "type": "array", "items": { "$ref": "ClosedEntry" }, "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>). If <code>entryType</code> is specified the entries will be only of that type, otherwise the entries may contain either tabs or windows.List of $ref:ClosedEntry representing the closed tab/window for the session."
     53               }
     54             ]
     55           }
     56         ]
     57       },
     58       {
     59         "name": "restore",
     60         "type": "function",
     61         "description": "Reopens a $ref:ClosedEntry, with an optional callback to run when the entry has been restored.",
     62         "parameters": [
     63           {"type": "integer", "name": "id", "optional": true, "description": "The id of the $ref:ClosedEntry to restore."},
     64           {"type": "function", "name": "callback", "optional": true, "parameters": []}
     65         ]
     66       }
     67     ]
     68   }
     69 ]
     70