1[
2  {
3    "namespace": "windows",
4    "description": "The windows API.",
5    "types": [
6      {
7        "id": "Window",
8        "type": "object",
9        "properties": {
10          "id": {"type": "integer", "minimum": 0, "description": "The ID of the window. Window IDs are unique within a browser session."},
11          "focused": {"type": "boolean", "description": "Whether the window is currently the focused window."},
12          "top": {"type": "integer", "description": "The offset of the window from the top edge of the screen in pixels."},
13          "left": {"type": "integer", "description": "The offset of the window from the left edge of the screen in pixels."},
14          "width": {"type": "integer", "description": "The width of the window in pixels."},
15          "height": {"type": "integer", "description": "The height of the window in pixels."},
16          "tabs": {"type": "array", "items": { "$ref": "tabs.Tab" }, "optional": true, "description": "Array of $ref:Tab objects representing the current tabs in the window."},
17          "incognito": {"type": "boolean", "description": "Whether the window is incognito."},
18          "type": {
19            "type": "string",
20            "description": "The type of browser window this is.",
21            "enum": ["normal", "popup", "panel", "app"]
22          },
23          "state": {
24            "type": "string",
25            "description": "The state of this browser window.",
26            "enum": ["normal", "minimized", "maximized"]
27            }
28        }
29      }
30    ],
31    "properties": {
32      "WINDOW_ID_NONE": {
33        "type": "integer",
34        "value": "-1",
35        "description": "The windowId value that represents the absence of a chrome browser window."
36      }
37    },
38    "functions": [
39      {
40        "name": "get",
41        "type": "function",
42        "description": "Gets details about a window.",
43        "parameters": [
44          {"type": "integer", "name": "windowId", "minimum": 0},
45          {
46            "type": "object",
47            "name": "getInfo",
48            "optional": true,
49            "description": "",
50            "properties": {
51              "populate": {"type": "boolean", "optional": true, "description": "If true, the window object will have a <var>tabs</var> property that contains a list of the $ref:Tab objects" }
52            }
53          },
54          {
55            "type": "function",
56            "name": "callback",
57            "parameters": [
58              {
59                "name": "window", "$ref": "Window"
60              }
61            ]
62          }
63        ]
64      },
65      {
66        "name": "getCurrent",
67        "type": "function",
68        "description": "Gets the <a href='#current-window'>current window</a>.",
69        "parameters": [
70          {
71            "type": "object",
72            "name": "getInfo",
73            "optional": true,
74            "description": "",
75            "properties": {
76              "populate": {"type": "boolean", "optional": true, "description": "If true, the window object will have a <var>tabs</var> property that contains a list of the $ref:Tab objects" }
77            }
78          },
79          {
80            "type": "function",
81            "name": "callback",
82            "parameters": [
83              {
84                "name": "window", "$ref": "Window"
85              }
86            ]
87          }
88        ]
89      },
90      {
91        "name": "getLastFocused",
92        "type": "function",
93        "description": "Gets the window that was most recently focused &mdash; typically the window 'on top'.",
94        "parameters": [
95          {
96            "type": "object",
97            "name": "getInfo",
98            "optional": true,
99            "description": "",
100            "properties": {
101              "populate": {"type": "boolean", "optional": true, "description": "If true, the window object will have a <var>tabs</var> property that contains a list of the $ref:Tab objects" }
102            }
103          },
104          {
105            "type": "function",
106            "name": "callback",
107            "parameters": [
108              {
109                "name": "window", "$ref": "Window"
110              }
111            ]
112          }
113        ]
114      },
115      {
116        "name": "getAll",
117        "type": "function",
118        "description": "Gets all windows.",
119        "parameters": [
120          {
121            "type": "object",
122            "name": "getInfo",
123            "optional": true,
124            "description": "",
125            "properties": {
126              "populate": {"type": "boolean", "optional": true, "description": "If true, each window object will have a <var>tabs</var> property that contains a list of the $ref:Tab objects for that window." }
127            }
128          },
129          {
130            "type": "function",
131            "name": "callback",
132            "parameters": [
133              {
134                "name": "windows", "type": "array", "items": { "$ref": "Window" }
135              }
136            ]
137          }
138        ]
139      },
140      {
141        "name": "create",
142        "nocompile": true,
143        "type": "function",
144        "description": "Creates (opens) a new browser with any optional sizing, position or default URL provided.",
145        "parameters": [
146          {
147            "type": "object",
148            "name": "createData",
149            "properties": {
150              "url": {
151                "type": "string",
152                "description": "A URL or list of URLs to open as tabs in the window. Fully-qualified URLs must include a scheme (i.e. 'http://www.google.com', not 'www.google.com'). Relative URLs will be relative to the current page within the extension. Defaults to the New Tab Page.",
153                "optional": true,
154                "choices": [
155                  {"type": "string"},
156                  {"type": "array", "items": {"type": "string"}}
157                ]
158              },
159              "tabId": {"type": "integer", "minimum": 0, "optional": true, "description": "The id of the tab for which you want to adopt to the new window."},
160              "left": {"type": "integer", "optional": true, "description": "The number of pixels to position the new window from the left edge of the screen. If not specified, the new window is offset naturally from the last focusd window. This value is ignored for panels."},
161              "top": {"type": "integer", "optional": true, "description": "The number of pixels to position the new window from the top edge of the screen. If not specified, the new window is offset naturally from the last focusd window. This value is ignored for panels."},
162              "width": {"type": "integer", "minimum": 0, "optional": true, "description": "The width in pixels of the new window. If not specified defaults to a natural width."},
163              "height": {"type": "integer", "minimum": 0, "optional": true, "description": "The height in pixels of the new window. If not specified defaults to a natural height."},
164              "focused": {"type": "boolean", "optional": true, "description": "If true, opens an active window. If false, opens an inactive window."},
165              "incognito": {"type": "boolean", "optional": true, "description": "Whether the new window should be an incognito window."},
166              "type": {
167                "type": "string",
168                "optional": true,
169                "description": "Specifies what type of browser window to create. The 'panel' type creates a popup unless the '--enable-panels' flag is set.",
170                "enum": ["normal", "popup", "panel"]
171              }
172            },
173            "optional": true
174          },
175          {
176            "type": "function",
177            "name": "callback",
178            "optional": true,
179            "parameters": [
180              {
181                "name": "window", "$ref": "Window", "description": "Contains details about the created window.",
182                "optional": true
183              }
184            ]
185          }
186        ]
187      },
188      {
189        "name": "update",
190        "type": "function",
191        "description": "Updates the properties of a window. Specify only the properties that you want to change; unspecified properties will be left unchanged.",
192        "parameters": [
193          {"type": "integer", "name": "windowId", "minimum": 0},
194          {
195            "type": "object",
196            "name": "updateInfo",
197            "properties": {
198              "left": {"type": "integer", "optional": true, "description": "The offset from the left edge of the screen to move the window to in pixels. This value is ignored for panels."},
199              "top": {"type": "integer", "optional": true, "description": "The offset from the top edge of the screen to move the window to in pixels. This value is ignored for panels."},
200              "width": {"type": "integer", "minimum": 0, "optional": true, "description": "The width to resize the window to in pixels. This value is ignored for panels."},
201              "height": {"type": "integer", "minimum": 0, "optional": true, "description": "The height to resize the window to in pixels. This value is ignored for panels."},
202              "focused": {"type": "boolean", "optional": true, "description": "If true, brings the window to the front. If false, brings the next window in the z-order to the front."},
203              "drawAttention": {"type": "boolean", "optional": true, "description": "If true, causes the window to be displayed in a manner that draws the user's attention to the window, without changing the focused window. The effect lasts until the user changes focus to the window. This option has no effect if set to false or if the window already has focus."},
204              "state": {
205                "type": "string",
206                "optional": true,
207                "description": "The new state of the window. The 'minimized' and 'maximized' states cannot be combined with 'left', 'top', 'width' or 'height'.",
208                "enum": ["normal", "minimized", "maximized"]
209              }
210            }
211          },
212          {
213            "type": "function",
214            "name": "callback",
215            "optional": true,
216            "parameters": [
217              {
218                "name": "window", "$ref": "Window"
219              }
220            ]
221          }
222        ]
223      },
224      {
225        "name": "remove",
226        "type": "function",
227        "description": "Removes (closes) a window, and all the tabs inside it.",
228        "parameters": [
229          {"type": "integer", "name": "windowId", "minimum": 0},
230          {"type": "function", "name": "callback", "optional": true, "parameters": []}
231        ]
232      }
233    ],
234    "events": [
235      {
236        "name": "onCreated",
237        "type": "function",
238        "description": "Fired when a window is created.",
239        "parameters": [
240          {
241            "$ref": "Window",
242            "name": "window",
243            "description": "Details of the window that was created."
244          }
245        ]
246      },
247      {
248        "name": "onRemoved",
249        "type": "function",
250        "description": "Fired when a window is removed (closed).",
251        "parameters": [
252          {"type": "integer", "name": "windowId", "minimum": 0, "description": "ID of the removed window."}
253        ]
254      },
255      {
256        "name": "onFocusChanged",
257        "type": "function",
258        "description": "Fired when the currently focused window changes. Will be chrome.windows.WINDOW_ID_NONE if all chrome windows have lost focus. Note: On some Linux window managers, WINDOW_ID_NONE will always be sent immediately preceding a switch from one chrome window to another.",
259        "parameters": [
260          {"type": "integer", "name": "windowId", "minimum": -1, "description": "ID of the newly focused window."}
261        ]
262      }
263    ]
264  }
265]
266