- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / api / sessions.json
1 // Copyright 2013 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": "sessions",
8     "description": "Use the <code>chrome.sessions</code> API to query and restore tabs and windows from a browsing session.",
9     "types": [
10       {
11         "id": "Filter",
12         "type": "object",
13         "properties": {
14           "maxResults": {
15             "type": "integer",
16             "minimum": 0,
17             "maximum": 25,
18             "optional": true,
19             "description": "The maximum number of entries to be fetched in the requested list. Omit this parameter to fetch the maximum number of entries ($ref:MAX_SESSION_RESULTS)."
20           }
21         }
22       },
23       {
24         "id": "Session",
25         "type": "object",
26         "properties": {
27           "lastModified": {"type": "integer", "description": "The time when the window or tab was closed or modified, represented in milliseconds since the epoch."},
28           "tab": {"$ref": "tabs.Tab", "optional": true, "description": "The $ref:tabs.Tab, if this entry describes a tab. Either this or $ref:Session.window will be set."},
29           "window": {"$ref": "windows.Window", "optional": true, "description": "The $ref:windows.Window, if this entry describes a window. Either this or $ref:Session.tab will be set."}
30         }
31       },
32       {
33         "id": "Device",
34         "type": "object",
35         "properties": {
36           "info": {"type": "string", "description": "Represents all information about a foreign device."},
37           "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."}
38         }
39       }
40     ],
41     "functions": [
42       {
43         "name": "getRecentlyClosed",
44         "type": "function",
45         "description": "Gets the list of recently closed tabs and/or windows.",
46         "parameters": [
47           {
48             "$ref": "Filter",
49             "name": "filter",
50             "optional": true
51           },
52           {
53             "type": "function",
54             "name": "callback",
55             "parameters": [
56               {
57                 "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."
58               }
59             ]
60           }
61         ]
62       },
63       {
64         "name": "getDevices",
65         "type": "function",
66         "description": "Retrieves all devices with synced sessions.",
67         "parameters": [
68           {
69             "$ref": "Filter",
70             "name": "filter",
71             "optional": true
72           },
73           {
74             "type": "function",
75             "name": "callback",
76             "parameters": [
77               {
78                 "name": "devices", "type": "array", "items": { "$ref": "Device" }, "description": "The list of $ref: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:Session objects."
79               }
80             ]
81           }
82         ]
83       },
84       {
85         "name": "restore",
86         "type": "function",
87         "description": "Reopens a $ref:windows.Window or $ref:tabs.Tab, with an optional callback to run when the entry has been restored.",
88         "parameters": [
89           {
90             "type": "string",
91             "name": "sessionId",
92             "optional": true,
93             "description": "The $ref:windows.Window.sessionId, or $ref:tabs.Tab.sessionId to restore."
94           },
95           {
96             "type": "function",
97             "name": "callback",
98             "optional": true,
99             "parameters": [
100               {
101                 "$ref": "Session",
102                 "name": "restoredSession",
103                 "description": "A $ref:Session containing the restored $ref:windows.Window or $ref:tabs.Tab object."
104               }
105             ]
106           }
107         ]
108       }
109     ],
110     "properties": {
111       "MAX_SESSION_RESULTS": {
112         "value": 25,
113         "description": "The maximum number of $ref:Session that will be included in a requested list."
114       }
115     }
116   }
117 ]