Commit f1136772 authored by Tim Judkins's avatar Tim Judkins Committed by Commit Bot

[Extensions] Enable promise support on the action API

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

Note: action.setIcon does not yet support promises as it uses a custom
hook. Promise support for APIs using custom hooks will be added at a
later time.

Bug: 328932
Change-Id: I3271db95514a5410ae4e361b514c8932dad1d85f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2514745Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Tim Judkins <tjudkins@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826841}
parent 726227d8
...@@ -37,12 +37,12 @@ ...@@ -37,12 +37,12 @@
"description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed." "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed."
} }
} }
}, { }],
"type": "function", "returns_async": {
"name": "callback", "name": "callback",
"parameters": [], "parameters": [],
"optional": true "optional": true
}] }
}, { }, {
"name": "getTitle", "name": "getTitle",
"type": "function", "type": "function",
...@@ -50,14 +50,14 @@ ...@@ -50,14 +50,14 @@
"parameters": [{ "parameters": [{
"name": "details", "name": "details",
"$ref": "TabDetails" "$ref": "TabDetails"
}, { }],
"type": "function", "returns_async": {
"name": "callback", "name": "callback",
"parameters": [{ "parameters": [{
"name": "result", "name": "result",
"type": "string" "type": "string"
}] }]
}] }
}, { }, {
"name": "setIcon", "name": "setIcon",
"type": "function", "type": "function",
...@@ -103,29 +103,27 @@ ...@@ -103,29 +103,27 @@
"name": "setPopup", "name": "setPopup",
"type": "function", "type": "function",
"description": "Sets the html document to be opened as a popup when the user clicks on the action's icon.", "description": "Sets the html document to be opened as a popup when the user clicks on the action's icon.",
"parameters": [ "parameters": [{
{ "name": "details",
"name": "details", "type": "object",
"type": "object", "properties": {
"properties": { "tabId": {
"tabId": { "type": "integer",
"type": "integer", "optional": true,
"optional": true, "minimum": 0,
"minimum": 0, "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed."
"description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed." },
}, "popup": {
"popup": { "type": "string",
"type": "string", "description": "The html file to show in a popup. If set to the empty string (''), no popup is shown."
"description": "The html file to show in a popup. If set to the empty string (''), no popup is shown."
}
} }
}, {
"type": "function",
"name": "callback",
"parameters": [],
"optional": true
} }
] }],
"returns_async": {
"name": "callback",
"parameters": [],
"optional": true
}
}, { }, {
"name": "getPopup", "name": "getPopup",
"type": "function", "type": "function",
...@@ -134,18 +132,17 @@ ...@@ -134,18 +132,17 @@
{ {
"name": "details", "name": "details",
"$ref": "TabDetails" "$ref": "TabDetails"
},
{
"type": "function",
"name": "callback",
"parameters": [
{
"name": "result",
"type": "string"
}
]
} }
] ],
"returns_async": {
"name": "callback",
"parameters": [
{
"name": "result",
"type": "string"
}
]
}
}, { }, {
"name": "setBadgeText", "name": "setBadgeText",
"type": "function", "type": "function",
...@@ -165,12 +162,12 @@ ...@@ -165,12 +162,12 @@
"description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed." "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed."
} }
} }
}, { }],
"type": "function", "returns_async": {
"name": "callback", "name": "callback",
"parameters": [], "parameters": [],
"optional": true "optional": true
}] }
}, { }, {
"name": "getBadgeText", "name": "getBadgeText",
"type": "function", "type": "function",
...@@ -178,14 +175,14 @@ ...@@ -178,14 +175,14 @@
"parameters": [{ "parameters": [{
"name": "details", "name": "details",
"$ref": "TabDetails" "$ref": "TabDetails"
}, { }],
"type": "function", "returns_async": {
"name": "callback", "name": "callback",
"parameters": [{ "parameters": [{
"name": "result", "name": "result",
"type": "string" "type": "string"
}] }]
}] }
}, { }, {
"name": "setBadgeBackgroundColor", "name": "setBadgeBackgroundColor",
"type": "function", "type": "function",
...@@ -208,12 +205,12 @@ ...@@ -208,12 +205,12 @@
"description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed." "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed."
} }
} }
}, { }],
"type": "function", "returns_async": {
"name": "callback", "name": "callback",
"parameters": [], "parameters": [],
"optional": true "optional": true
}] }
}, { }, {
"name": "getBadgeBackgroundColor", "name": "getBadgeBackgroundColor",
"type": "function", "type": "function",
...@@ -221,14 +218,14 @@ ...@@ -221,14 +218,14 @@
"parameters": [{ "parameters": [{
"name": "details", "name": "details",
"$ref": "TabDetails" "$ref": "TabDetails"
}, { }],
"type": "function", "returns_async": {
"name": "callback", "name": "callback",
"parameters": [{ "parameters": [{
"name": "result", "name": "result",
"$ref": "browserAction.ColorArray" "$ref": "browserAction.ColorArray"
}] }]
}] }
}, { }, {
"name": "enable", "name": "enable",
"type": "function", "type": "function",
...@@ -239,12 +236,12 @@ ...@@ -239,12 +236,12 @@
"name": "tabId", "name": "tabId",
"minimum": 0, "minimum": 0,
"description": "The id of the tab for which you want to modify the action." "description": "The id of the tab for which you want to modify the action."
}, { }],
"type": "function", "returns_async": {
"name": "callback", "name": "callback",
"parameters": [], "parameters": [],
"optional": true "optional": true
}] }
}, { }, {
"name": "disable", "name": "disable",
"type": "function", "type": "function",
...@@ -255,12 +252,12 @@ ...@@ -255,12 +252,12 @@
"name": "tabId", "name": "tabId",
"minimum": 0, "minimum": 0,
"description": "The id of the tab for which you want to modify the action." "description": "The id of the tab for which you want to modify the action."
}, { }],
"type": "function", "returns_async": {
"name": "callback", "name": "callback",
"parameters": [], "parameters": [],
"optional": true "optional": true
}] }
}], }],
"events": [{ "events": [{
"name": "onClicked", "name": "onClicked",
......
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