// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
{
"namespace": "tabGroups",
"description": "Use the <code>chrome.tabGroups</code> API to interact with the browser's tab grouping system. You can use this API to modify and rearrange tab groups in the browser. To group and ungroup tabs, or to query what tabs are in groups, use the <code>chrome.tabs</code> API.",
"types": [
{
"id": "Color",
"type": "string",
"enum": ["grey", "blue", "red", "yellow", "green", "pink", "purple", "cyan", "orange"],
"description": "The group's color."
},
{
"id": "TabGroup",
"type": "object",
"properties": {
"id": {"type": "integer", "minimum": 0, "description": "The ID of the group. Group IDs are unique within a browser session."},
"collapsed": {"type": "boolean", "description": "Whether the group is collapsed. A collapsed group is one whose tabs are hidden."},
"color": {"$ref": "Color", "description": "The group's color."},
"title": {"type": "string", "optional": true, "description": "The title of the group."},
"windowId": {"type": "integer", "minimum": 0, "description": "The ID of the window that contains the group."}
}
}
],
"properties": {
"TAB_GROUP_ID_NONE": {
"value": -1,
"description": "An ID that represents the absence of a group."
}
},
"functions": [
{
"name": "get",
"type": "function",
"description": "Retrieves details about the specified group.",
"parameters": [
{
"type": "integer",
"name": "groupId",
"minimum": 0
}
],
"returns_async": {
"name": "callback",
"parameters": [
{"name": "group", "$ref": "TabGroup"}
]
}
},
{
"name": "query",
"type": "function",
"description": "Gets all groups that have the specified properties, or all groups if no properties are specified.",
"parameters": [
{
"type": "object",
"name": "queryInfo",
"properties": {
"collapsed": {
"type": "boolean",
"optional": true,
"description": "Whether the groups are collapsed."
},
"color": {
"$ref": "Color",
"optional": true,
"description": "The color of the groups."
},
"title": {
"type": "string",
"optional": true,
"description": "Match group titles against a pattern."
},
"windowId": {
"type": "integer",
"optional": true,
"minimum": -2,
"description": "The ID of the parent window, or $(ref:windows.WINDOW_ID_CURRENT) for the <a href='windows#current-window'>current window</a>."
}
}
}
],
"returns_async": {
"name": "callback",
"parameters": [
{
"name": "result",
"type": "array",
"items": {
"$ref": "TabGroup"
}
}
]
}
},
{
"name": "update",
"type": "function",
"description": "Modifies the properties of a group. Properties that are not specified in <var>updateProperties</var> are not modified.",
"parameters": [
{
"type": "integer",
"name": "groupId",
"minimum": 0,
"description": "The ID of the group to modify."
},
{
"type": "object",
"name": "updateProperties",
"properties": {
"collapsed": {
"type": "boolean",
"optional": true,
"description": "Whether the group should be collapsed."
},
"color": {
"$ref": "Color",
"optional": true,
"description": "The color of the group."
},
"title": {
"type": "string",
"optional": true,
"description": "The title of the group."
}
}
}
],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": [
{
"name": "group",
"$ref": "TabGroup",
"optional": true,
"description": "Details about the updated group."
}
]
}
},
{
"name": "move",
"type": "function",
"description": "Moves the group and all its tabs within its window, or to a new window.",
"parameters": [
{
"type": "integer",
"name": "groupId",
"minimum": 0,
"description": "The ID of the group to move."
},
{
"type": "object",
"name": "moveProperties",
"properties": {
"windowId": {
"type": "integer",
"minimum": -2,
"optional": true,
"description": "The window to move the group to. Defaults to the window the group is currently in. Note that groups can only be moved to and from windows with $(ref:windows.WindowType) type <code>\"normal\"</code>."
},
"index": {
"type": "integer",
"minimum": -1,
"description": "The position to move the group to. Use <code>-1</code> to place the group at the end of the window."
}
}
}
],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": [
{
"name": "group",
"$ref": "TabGroup",
"optional": true,
"description": "Details about the moved group."
}
]
}
}
],
"events": [
{
"name": "onCreated",
"type": "function",
"description": "Fired when a group is created.",
"parameters": [
{
"$ref": "TabGroup",
"name": "group",
"description": "Details of the group that was created."
}
]
},
{
"name": "onUpdated",
"type": "function",
"description": "Fired when a group is updated.",
"parameters": [
{
"$ref": "TabGroup",
"name": "group",
"description": "Details of the group that was updated."
}
]
},
{
"name": "onMoved",
"type": "function",
"description": "Fired when a group is moved within a window. Move events are still fired for the individual tabs within the group, as well as for the group itself. This event is not fired when a group is moved between windows; instead, it will be removed from one window and created in another.",
"parameters": [
{
"$ref": "TabGroup",
"name": "group",
"description": "Details of the group that was moved."
}
]
},
{
"name": "onRemoved",
"type": "function",
"description": "Fired when a group is closed, either directly by the user or automatically because it contained zero tabs.",
"parameters": [
{
"$ref": "TabGroup",
"name": "group",
"description": "Details of the group that was removed."
}
]
}
]
}
]