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

[Extensions] Enable promise support on the browserAction 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: browserAction.setIcon and browserAction.openPopus do not yet
support promises. setIcon uses a custom hook and openPopup uses a custom
callback, which will have promise support added at a later time.

Bug: 328932
Change-Id: Ie51b28bfe18f3bf5e427a59a1e5e2d04ee5116f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2515139Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Tim Judkins <tjudkins@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826563}
parent 87e4b574
...@@ -56,9 +56,9 @@ ...@@ -56,9 +56,9 @@
"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", "name": "callback", "parameters": [], "optional": true} ],
] "returns_async": {"name": "callback", "parameters": [], "optional": true}
}, },
{ {
"name": "getTitle", "name": "getTitle",
...@@ -68,18 +68,17 @@ ...@@ -68,18 +68,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": "setIcon", "name": "setIcon",
...@@ -147,9 +146,9 @@ ...@@ -147,9 +146,9 @@
"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",
...@@ -159,18 +158,17 @@ ...@@ -159,18 +158,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",
...@@ -192,9 +190,9 @@ ...@@ -192,9 +190,9 @@
"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", "name": "callback", "parameters": [], "optional": true} ],
] "returns_async": {"name": "callback", "parameters": [], "optional": true}
}, },
{ {
"name": "getBadgeText", "name": "getBadgeText",
...@@ -204,18 +202,17 @@ ...@@ -204,18 +202,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": "setBadgeBackgroundColor", "name": "setBadgeBackgroundColor",
...@@ -239,9 +236,9 @@ ...@@ -239,9 +236,9 @@
"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", "name": "callback", "parameters": [], "optional": true} ],
] "returns_async": {"name": "callback", "parameters": [], "optional": true}
}, },
{ {
"name": "getBadgeBackgroundColor", "name": "getBadgeBackgroundColor",
...@@ -251,18 +248,17 @@ ...@@ -251,18 +248,17 @@
{ {
"name": "details", "name": "details",
"$ref": "TabDetails" "$ref": "TabDetails"
},
{
"type": "function",
"name": "callback",
"parameters": [
{
"name": "result",
"$ref": "ColorArray"
}
]
} }
] ],
"returns_async": {
"name": "callback",
"parameters": [
{
"name": "result",
"$ref": "ColorArray"
}
]
}
}, },
{ {
"name": "enable", "name": "enable",
...@@ -275,9 +271,9 @@ ...@@ -275,9 +271,9 @@
"name": "tabId", "name": "tabId",
"minimum": 0, "minimum": 0,
"description": "The ID of the tab for which to modify the browser action." "description": "The ID of the tab for which to modify the browser action."
}, }
{"type": "function", "name": "callback", "parameters": [], "optional": true} ],
] "returns_async": {"name": "callback", "parameters": [], "optional": true}
}, },
{ {
"name": "disable", "name": "disable",
...@@ -290,9 +286,9 @@ ...@@ -290,9 +286,9 @@
"name": "tabId", "name": "tabId",
"minimum": 0, "minimum": 0,
"description": "The ID of the tab for which to modify the browser action." "description": "The ID of the tab for which to modify the browser action."
}, }
{"type": "function", "name": "callback", "parameters": [], "optional": true} ],
] "returns_async": {"name": "callback", "parameters": [], "optional": true}
}, },
{ {
"name": "openPopup", "name": "openPopup",
......
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