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,9 +178,8 @@ ...@@ -178,9 +178,8 @@
{ {
"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": [
...@@ -193,7 +192,6 @@ ...@@ -193,7 +192,6 @@
} }
] ]
} }
]
}, },
{ {
"name": "get", "name": "get",
...@@ -203,9 +201,9 @@ ...@@ -203,9 +201,9 @@
"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", "returns_async": {
"name": "callback", "name": "callback",
"optional": true, "optional": true,
"parameters": [ "parameters": [
...@@ -215,14 +213,12 @@ ...@@ -215,14 +213,12 @@
} }
] ]
} }
]
}, },
{ {
"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": [
...@@ -232,7 +228,6 @@ ...@@ -232,7 +228,6 @@
} }
] ]
} }
]
}, },
{ {
"name": "getPermissionWarningsById", "name": "getPermissionWarningsById",
...@@ -241,10 +236,10 @@ ...@@ -241,10 +236,10 @@
{ "name": "id", { "name": "id",
"type": "string", "type": "string",
"description": "The ID of an already installed extension." "description": "The ID of an already installed extension."
}, }
{ ],
"returns_async": {
"name": "callback", "name": "callback",
"type": "function",
"optional": true, "optional": true,
"parameters": [ "parameters": [
{ {
...@@ -254,7 +249,6 @@ ...@@ -254,7 +249,6 @@
} }
] ]
} }
]
}, },
{ {
"name": "getPermissionWarningsByManifest", "name": "getPermissionWarningsByManifest",
...@@ -264,10 +258,10 @@ ...@@ -264,10 +258,10 @@
"name": "manifestStr", "name": "manifestStr",
"type": "string", "type": "string",
"description": "Extension manifest JSON string." "description": "Extension manifest JSON string."
}, }
{ ],
"returns_async": {
"name": "callback", "name": "callback",
"type": "function",
"optional": true, "optional": true,
"parameters": [ "parameters": [
{ {
...@@ -277,7 +271,6 @@ ...@@ -277,7 +271,6 @@
} }
] ]
} }
]
}, },
{ {
"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."
}, }
{ ],
"returns_async": {
"name": "callback", "name": "callback",
"type": "function",
"optional": true, "optional": true,
"parameters": [] "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
}, }
{ ],
"returns_async": {
"name": "callback", "name": "callback",
"type": "function",
"optional": true, "optional": true,
"parameters": [] "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
}, }
{ ],
"returns_async": {
"name": "callback", "name": "callback",
"type": "function",
"optional": true, "optional": true,
"parameters": [] "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."
}, }
{ ],
"returns_async": {
"name": "callback", "name": "callback",
"type": "function",
"optional": true, "optional": true,
"parameters": [] "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)."
}, }
{ ],
"returns_async": {
"name": "callback", "name": "callback",
"type": "function",
"optional": true, "optional": true,
"parameters": [] "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."
}, }
{ ],
"returns_async": {
"name": "callback", "name": "callback",
"type": "function", "type": "function",
"optional": true, "optional": true,
"parameters": [] "parameters": []
} }
]
}, },
{ {
"name": "generateAppForLink", "name": "generateAppForLink",
...@@ -409,10 +397,10 @@ ...@@ -409,10 +397,10 @@
"name": "title", "name": "title",
"type": "string", "type": "string",
"description": "The title of the generated app." "description": "The title of the generated app."
}, }
{ ],
"returns_async": {
"name": "callback", "name": "callback",
"type": "function",
"optional": true, "optional": true,
"parameters": [ "parameters": [
{ {
...@@ -421,15 +409,13 @@ ...@@ -421,15 +409,13 @@
} }
] ]
} }
]
}, },
{ {
"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",
...@@ -437,31 +423,26 @@ ...@@ -437,31 +423,26 @@
} }
] ]
} }
]
}, },
{ {
"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