Commit 83a34182 authored by Tim Judkins's avatar Tim Judkins Committed by Commit Bot

[Extensions] Enable promise support on the tabs API

This CL changes over the json schema to use the new returns_async format
to define callbacks, enabling promise support on those APIs.

Bug: 328932
Change-Id: Iab033c7cd7174d82be4740bcf1ee4fca5288665f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2514807Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Tim Judkins <tjudkins@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826846}
parent 84869dc2
......@@ -156,23 +156,21 @@
"type": "integer",
"name": "tabId",
"minimum": 0
},
{
"type": "function",
}
],
"returns_async": {
"name": "callback",
"parameters": [
{"name": "tab", "$ref": "Tab"}
]
}
]
},
{
"name": "getCurrent",
"type": "function",
"description": "Gets the tab that this script call is being made from. May be undefined if called from a non-tab context (for example, a background page or popup view).",
"parameters": [
{
"type": "function",
"parameters": [],
"returns_async": {
"name": "callback",
"parameters": [
{
......@@ -182,7 +180,6 @@
}
]
}
]
},
{
"name": "connect",
......@@ -300,15 +297,14 @@
"minimum": -2,
"optional": true,
"description": "Defaults to the <a href='windows#current-window'>current window</a>."
},
{
"type": "function",
}
],
"returns_async": {
"name": "callback",
"parameters": [
{"name": "tab", "$ref": "Tab"}
]
}
]
},
{
"name": "getAllInWindow",
......@@ -322,15 +318,14 @@
"minimum": -2,
"optional": true,
"description": "Defaults to the <a href='windows#current-window'>current window</a>."
},
{
"type": "function",
}
],
"returns_async": {
"name": "callback",
"parameters": [
{"name": "tabs", "type": "array", "items": { "$ref": "Tab" } }
]
}
]
},
{
"name": "create",
......@@ -554,9 +549,9 @@
]
}
}
},
{
"type": "function",
}
],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": [
......@@ -567,7 +562,6 @@
}
]
}
]
},
{
"name": "update",
......@@ -628,9 +622,9 @@
"description": "Whether the tab should be discarded automatically by the browser when resources are low."
}
}
},
{
"type": "function",
}
],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": [
......@@ -642,7 +636,6 @@
}
]
}
]
},
{
"name": "move",
......@@ -673,9 +666,9 @@
"description": "The position to move the window to. Use <code>-1</code> to place the tab at the end of the window."
}
}
},
{
"type": "function",
}
],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": [
......@@ -689,7 +682,6 @@
}
]
}
]
},
{
"name": "reload",
......@@ -708,9 +700,9 @@
"description": "Whether to bypass local caching. Defaults to <code>false</code>."
}
}
},
{"type": "function", "name": "callback", "optional": true, "parameters": []}
]
}
],
"returns_async": {"name": "callback", "optional": true, "parameters": []}
},
{
"name": "remove",
......@@ -724,9 +716,9 @@
{"type": "integer", "minimum": 0},
{"type": "array", "items": {"type": "integer", "minimum": 0}}
]
},
{"type": "function", "name": "callback", "optional": true, "parameters": []}
]
}
],
"returns_async": {"name": "callback", "optional": true, "parameters": []}
},
{
"name": "group",
......@@ -764,9 +756,9 @@
}
}
}
},
{
"type": "function",
}
],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": [
......@@ -778,7 +770,6 @@
}
]
}
]
},
{
"name": "ungroup",
......@@ -792,9 +783,9 @@
{"type": "integer", "minimum": 0},
{"type": "array", "items": {"type": "integer", "minimum": 0}, "minItems": 1}
]
},
{"type": "function", "name": "callback", "optional": true, "parameters": []}
]
}
],
"returns_async": {"name": "callback", "optional": true, "parameters": []}
},
{
"name": "detectLanguage",
......@@ -807,9 +798,9 @@
"minimum": 0,
"optional": true,
"description": "Defaults to the active tab of the <a href='windows#current-window'>current window</a>."
},
{
"type": "function",
}
],
"returns_async": {
"name": "callback",
"parameters": [
{
......@@ -819,7 +810,6 @@
}
]
}
]
},
{
"name": "captureVisibleTab",
......@@ -837,13 +827,18 @@
"$ref": "extensionTypes.ImageDetails",
"name": "options",
"optional": true
},
}
],
"returns_async": {
"name": "callback",
"parameters": [
{
"type": "function", "name": "callback", "parameters": [
{"type": "string", "name": "dataUrl", "description": "A data URL that encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML <code>img</code> element for display."}
]
"type": "string",
"name": "dataUrl",
"description": "A data URL that encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML <code>img</code> element for display."
}
]
}
},
{
"name": "executeScript",
......@@ -855,9 +850,9 @@
"$ref": "extensionTypes.InjectDetails",
"name": "details",
"description": "Details of the script to run. Either the code or the file property must be set, but both may not be set at the same time."
},
{
"type": "function",
}
],
"returns_async": {
"name": "callback",
"optional": true,
"description": "Called after all the JavaScript has been executed.",
......@@ -871,7 +866,6 @@
}
]
}
]
},
{
"name": "insertCSS",
......@@ -883,15 +877,14 @@
"$ref": "extensionTypes.InjectDetails",
"name": "details",
"description": "Details of the CSS text to insert. Either the code or the file property must be set, but both may not be set at the same time."
},
{
"type": "function",
}
],
"returns_async": {
"name": "callback",
"optional": true,
"description": "Called when all the CSS has been inserted.",
"parameters": []
}
]
},
{
"name": "removeCSS",
......@@ -909,15 +902,14 @@
"$ref": "extensionTypes.DeleteInjectionDetails",
"name": "details",
"description": "Details of the CSS text to remove. Either the code or the file property must be set, but both may not be set at the same time."
},
{
"type": "function",
}
],
"returns_async": {
"name": "callback",
"optional": true,
"description": "Called when all the CSS has been removed.",
"parameters": []
}
]
},
{
"name": "setZoom",
......@@ -935,15 +927,14 @@
"type": "number",
"name": "zoomFactor",
"description": "The new zoom factor. A value of <code>0</code> sets the tab to its current default zoom factor. Values greater than <code>0</code> specify a (possibly non-default) zoom factor for the tab."
},
{
"type": "function",
}
],
"returns_async": {
"name": "callback",
"optional": true,
"description": "Called after the zoom factor has been changed.",
"parameters": []
}
]
},
{
"name": "getZoom",
......@@ -956,9 +947,9 @@
"minimum": 0,
"optional": true,
"description": "The ID of the tab to get the current zoom factor from; defaults to the active tab of the current window."
},
{
"type": "function",
}
],
"returns_async": {
"name": "callback",
"description": "Called with the tab's current zoom factor after it has been fetched.",
"parameters": [
......@@ -969,7 +960,6 @@
}
]
}
]
},
{
"name": "setZoomSettings",
......@@ -987,15 +977,14 @@
"$ref": "ZoomSettings",
"name": "zoomSettings",
"description": "Defines how zoom changes are handled and at what scope."
},
{
"type": "function",
}
],
"returns_async": {
"name": "callback",
"optional": true,
"description": "Called after the zoom settings are changed.",
"parameters": []
}
]
},
{
"name": "getZoomSettings",
......@@ -1008,9 +997,9 @@
"optional": true,
"minimum": 0,
"description": "The ID of the tab to get the current zoom settings from; defaults to the active tab of the current window."
},
{
"type": "function",
}
],
"returns_async": {
"name": "callback",
"description": "Called with the tab's current zoom settings.",
"parameters": [
......@@ -1021,7 +1010,6 @@
}
]
}
]
},
{
"name": "discard",
......@@ -1034,9 +1022,9 @@
"optional": true,
"minimum": 0,
"description": "The ID of the tab to be discarded. If specified, the tab is discarded unless it is active or already discarded. If omitted, the browser discards the least important tab. This can fail if no discardable tabs exist."
},
{
"type": "function",
}
],
"returns_async": {
"name": "callback",
"optional": true,
"description": "Called after the operation is completed.",
......@@ -1049,7 +1037,6 @@
}
]
}
]
},
{
"name": "goForward",
......@@ -1062,14 +1049,13 @@
"optional": true,
"minimum": 0,
"description": "The ID of the tab to navigate forward; defaults to the selected tab of the current window."
},
{
"type": "function",
}
],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": []
}
]
},
{
"name": "goBack",
......@@ -1082,14 +1068,13 @@
"optional": true,
"minimum": 0,
"description": "The ID of the tab to navigate back; defaults to the selected tab of the current window."
},
{
"type": "function",
}
],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": []
}
]
}
],
"events": [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment