Commit 0533f99a authored by Tim Judkins's avatar Tim Judkins Committed by Commit Bot

[Extensions] Enable promise support on the management 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: I13caaf4f9eff77db7cb0afc1516ed485e1908556
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2515142Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Tim Judkins <tjudkins@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826848}
parent 3475c040
...@@ -178,22 +178,20 @@ ...@@ -178,22 +178,20 @@
{ {
"name": "getAll", "name": "getAll",
"description": "Returns a list of information about installed extensions and apps.", "description": "Returns a list of information about installed extensions and apps.",
"parameters": [ "parameters": [],
{ "returns_async": {
"type": "function", "name": "callback",
"name": "callback", "optional": true,
"optional": true, "parameters": [
"parameters": [ {
{ "type": "array",
"type": "array", "name": "result",
"name": "result", "items": {
"items": { "$ref": "ExtensionInfo"
"$ref": "ExtensionInfo"
}
} }
] }
} ]
] }
}, },
{ {
"name": "get", "name": "get",
...@@ -203,36 +201,33 @@ ...@@ -203,36 +201,33 @@
"name": "id", "name": "id",
"type": "string", "type": "string",
"description": "The ID from an item of $(ref:management.ExtensionInfo)." "description": "The ID from an item of $(ref:management.ExtensionInfo)."
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": [
{
"name": "result",
"$ref": "ExtensionInfo"
}
]
} }
] ],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": [
{
"name": "result",
"$ref": "ExtensionInfo"
}
]
}
}, },
{ {
"name": "getSelf", "name": "getSelf",
"description": "Returns information about the calling extension, app, or theme. Note: This function can be used without requesting the 'management' permission in the manifest.", "description": "Returns information about the calling extension, app, or theme. Note: This function can be used without requesting the 'management' permission in the manifest.",
"parameters": [ "parameters": [],
{ "returns_async": {
"type": "function", "name": "callback",
"name": "callback", "optional": true,
"optional": true, "parameters": [
"parameters": [ {
{ "name": "result",
"name": "result", "$ref": "ExtensionInfo"
"$ref": "ExtensionInfo" }
} ]
] }
}
]
}, },
{ {
"name": "getPermissionWarningsById", "name": "getPermissionWarningsById",
...@@ -241,20 +236,19 @@ ...@@ -241,20 +236,19 @@
{ "name": "id", { "name": "id",
"type": "string", "type": "string",
"description": "The ID of an already installed extension." "description": "The ID of an already installed extension."
},
{
"name": "callback",
"type": "function",
"optional": true,
"parameters": [
{
"name": "permissionWarnings",
"type": "array",
"items": { "type": "string" }
}
]
} }
] ],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": [
{
"name": "permissionWarnings",
"type": "array",
"items": { "type": "string" }
}
]
}
}, },
{ {
"name": "getPermissionWarningsByManifest", "name": "getPermissionWarningsByManifest",
...@@ -264,20 +258,19 @@ ...@@ -264,20 +258,19 @@
"name": "manifestStr", "name": "manifestStr",
"type": "string", "type": "string",
"description": "Extension manifest JSON string." "description": "Extension manifest JSON string."
},
{
"name": "callback",
"type": "function",
"optional": true,
"parameters": [
{
"name": "permissionWarnings",
"type": "array",
"items": { "type": "string" }
}
]
} }
] ],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": [
{
"name": "permissionWarnings",
"type": "array",
"items": { "type": "string" }
}
]
}
}, },
{ {
"name": "setEnabled", "name": "setEnabled",
...@@ -292,14 +285,13 @@ ...@@ -292,14 +285,13 @@
"name": "enabled", "name": "enabled",
"type": "boolean", "type": "boolean",
"description": "Whether this item should be enabled or disabled." "description": "Whether this item should be enabled or disabled."
},
{
"name": "callback",
"type": "function",
"optional": true,
"parameters": []
} }
] ],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": []
}
}, },
{ {
"name": "uninstall", "name": "uninstall",
...@@ -314,14 +306,13 @@ ...@@ -314,14 +306,13 @@
"name": "options", "name": "options",
"$ref": "UninstallOptions", "$ref": "UninstallOptions",
"optional": true "optional": true
},
{
"name": "callback",
"type": "function",
"optional": true,
"parameters": []
} }
] ],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": []
}
}, },
{ {
"name": "uninstallSelf", "name": "uninstallSelf",
...@@ -331,14 +322,13 @@ ...@@ -331,14 +322,13 @@
"name": "options", "name": "options",
"$ref": "UninstallOptions", "$ref": "UninstallOptions",
"optional": true "optional": true
},
{
"name": "callback",
"type": "function",
"optional": true,
"parameters": []
} }
] ],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": []
}
}, },
{ {
"name": "launchApp", "name": "launchApp",
...@@ -348,14 +338,13 @@ ...@@ -348,14 +338,13 @@
"name": "id", "name": "id",
"type": "string", "type": "string",
"description": "The extension id of the application." "description": "The extension id of the application."
},
{
"name": "callback",
"type": "function",
"optional": true,
"parameters": []
} }
] ],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": []
}
}, },
{ {
"name": "createAppShortcut", "name": "createAppShortcut",
...@@ -365,14 +354,13 @@ ...@@ -365,14 +354,13 @@
"name": "id", "name": "id",
"type": "string", "type": "string",
"description": "This should be the id from an app item of $(ref:management.ExtensionInfo)." "description": "This should be the id from an app item of $(ref:management.ExtensionInfo)."
},
{
"name": "callback",
"type": "function",
"optional": true,
"parameters": []
} }
] ],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": []
}
}, },
{ {
"name": "setLaunchType", "name": "setLaunchType",
...@@ -387,14 +375,14 @@ ...@@ -387,14 +375,14 @@
"name": "launchType", "name": "launchType",
"$ref": "LaunchType", "$ref": "LaunchType",
"description": "The target launch type. Always check and make sure this launch type is in $(ref:ExtensionInfo.availableLaunchTypes), because the available launch types vary on different platforms and configurations." "description": "The target launch type. Always check and make sure this launch type is in $(ref:ExtensionInfo.availableLaunchTypes), because the available launch types vary on different platforms and configurations."
},
{
"name": "callback",
"type": "function",
"optional": true,
"parameters": []
} }
] ],
"returns_async": {
"name": "callback",
"type": "function",
"optional": true,
"parameters": []
}
}, },
{ {
"name": "generateAppForLink", "name": "generateAppForLink",
...@@ -409,59 +397,52 @@ ...@@ -409,59 +397,52 @@
"name": "title", "name": "title",
"type": "string", "type": "string",
"description": "The title of the generated app." "description": "The title of the generated app."
},
{
"name": "callback",
"type": "function",
"optional": true,
"parameters": [
{
"name": "result",
"$ref": "ExtensionInfo"
}
]
} }
] ],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": [
{
"name": "result",
"$ref": "ExtensionInfo"
}
]
}
}, },
{ {
"name": "canInstallReplacementAndroidApp", "name": "canInstallReplacementAndroidApp",
"description": "Checks if the replacement android app can be installed. Errors generated by this API are reported by setting $(ref:runtime.lastError) and executing the function's regular callback.", "description": "Checks if the replacement android app can be installed. Errors generated by this API are reported by setting $(ref:runtime.lastError) and executing the function's regular callback.",
"parameters": [ "parameters": [],
{ "returns_async": {
"name": "callback", "name": "callback",
"type": "function", "parameters": [
"parameters": [ {
{ "name": "result",
"name": "result", "type": "boolean"
"type": "boolean" }
} ]
] }
}
]
}, },
{ {
"name": "installReplacementAndroidApp", "name": "installReplacementAndroidApp",
"description": "Prompts the user to install the replacement Android app from the manifest. Errors generated by this API are reported by setting $(ref:runtime.lastError) and executing the function's regular callback.", "description": "Prompts the user to install the replacement Android app from the manifest. Errors generated by this API are reported by setting $(ref:runtime.lastError) and executing the function's regular callback.",
"parameters": [ "parameters": [],
{ "returns_async": {
"name": "callback", "name": "callback",
"type": "function", "optional": true,
"optional": true, "parameters": []
"parameters": [] }
}
]
}, },
{ {
"name": "installReplacementWebApp", "name": "installReplacementWebApp",
"description": "Launches the replacement_web_app specified in the manifest. Prompts the user to install if not already installed.", "description": "Launches the replacement_web_app specified in the manifest. Prompts the user to install if not already installed.",
"parameters": [ "parameters": [],
{ "returns_async": {
"name": "callback", "name": "callback",
"type": "function", "optional": true,
"optional": true, "parameters": []
"parameters": [] }
}
]
} }
], ],
"events": [ "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