Revision control

Copy as Markdown

Other Tools

// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
{
"namespace": "manifest",
"types": [
{
"id": "KeyName",
"type": "string",
"format": "manifestShortcutKey",
"description": "Definition of a shortcut, for example <value>Alt+F5</value>. The string must match the shortcut format as defined by the `MDN page of the commands API <|link-commands-shortcuts|>`__."
},
{
"$extend": "WebExtensionManifest",
"properties": {
"commands": {
"optional": true,
"choices": [
{
"type": "object",
"max_manifest_version": 2,
"description": "A <em>dictionary object</em> defining one or more commands as <em>name-value</em> pairs, the <em>name</em> being the name of the command and the <em>value</em> being a :ref:`commands.CommandsShortcut`. The <em>name</em> may also be one of the following built-in special shortcuts: \n * <value>_execute_browser_action</value> \n * <value>_execute_compose_action</value> \n * <value>_execute_message_display_action</value>\nExample: <literalinclude>includes/commands/manifest.json<lang>JSON</lang></literalinclude>",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"$ref": "UnrecognizedProperty"
},
"properties": {
"suggested_key": {
"type": "object",
"optional": true,
"properties": {
"default": {
"$ref": "KeyName",
"optional": true
},
"mac": {
"$ref": "KeyName",
"optional": true
},
"linux": {
"$ref": "KeyName",
"optional": true
},
"windows": {
"$ref": "KeyName",
"optional": true
},
"chromeos": {
"type": "string",
"optional": true
},
"android": {
"type": "string",
"optional": true
},
"ios": {
"type": "string",
"optional": true
},
"additionalProperties": {
"type": "string",
"deprecated": "Unknown platform name",
"optional": true
}
}
},
"description": {
"type": "string",
"preprocess": "localize",
"optional": true
}
}
}
},
{
"type": "object",
"min_manifest_version": 3,
"description": "A <em>dictionary object</em> defining one or more commands as <em>name-value</em> pairs, the <em>name</em> being the name of the command and the <em>value</em> being a :ref:`commands.CommandsShortcut`. The <em>name</em> may also be one of the following built-in special shortcuts: \n * <value>_execute_action</value> \n * <value>_execute_compose_action</value> \n * <value>_execute_message_display_action</value>\nExample: <literalinclude>includes/commands/manifest.json<lang>JSON</lang></literalinclude>",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"$ref": "UnrecognizedProperty"
},
"properties": {
"suggested_key": {
"type": "object",
"optional": true,
"properties": {
"default": {
"$ref": "KeyName",
"optional": true
},
"mac": {
"$ref": "KeyName",
"optional": true
},
"linux": {
"$ref": "KeyName",
"optional": true
},
"windows": {
"$ref": "KeyName",
"optional": true
},
"chromeos": {
"type": "string",
"optional": true
},
"android": {
"type": "string",
"optional": true
},
"ios": {
"type": "string",
"optional": true
},
"additionalProperties": {
"type": "string",
"deprecated": "Unknown platform name",
"optional": true
}
}
},
"description": {
"type": "string",
"preprocess": "localize",
"optional": true
}
}
}
}
]
}
}
}
]
},
{
"namespace": "commands",
"description": "Use the commands API to add keyboard shortcuts that trigger actions in your extension, for example opening one of the action popups or sending a command to the extension.",
"permissions": ["manifest:commands"],
"types": [
{
"id": "Command",
"type": "object",
"properties": {
"name": {
"type": "string",
"optional": true,
"description": "The name of the Extension Command"
},
"description": {
"type": "string",
"optional": true,
"description": "The Extension Command description"
},
"shortcut": {
"type": "string",
"optional": true,
"description": "The shortcut active for this command, or blank if not active."
}
}
}
],
"events": [
{
"name": "onCommand",
"description": "Fired when a registered command is activated using a keyboard shortcut. This is a user input event handler. For asynchronous listeners some `restrictions <|link-user-input-restrictions|>`__ apply.",
"type": "function",
"parameters": [
{
"name": "command",
"type": "string"
},
{
"name": "tab",
"$ref": "tabs.Tab",
"description": "The details of the active tab while the command occurred."
}
]
},
{
"name": "onChanged",
"description": "Fired when a registered command's shortcut is changed.",
"type": "function",
"parameters": [
{
"type": "object",
"name": "changeInfo",
"properties": {
"name": {
"type": "string",
"description": "The name of the shortcut."
},
"newShortcut": {
"type": "string",
"description": "The new shortcut active for this command, or blank if not active."
},
"oldShortcut": {
"type": "string",
"description": "The old shortcut which is no longer active for this command, or blank if the shortcut was previously inactive."
}
}
}
]
}
],
"functions": [
{
"name": "update",
"type": "function",
"async": true,
"description": "Update the details of an already defined command.",
"parameters": [
{
"type": "object",
"name": "detail",
"description": "The new details for the command.",
"properties": {
"name": {
"type": "string",
"description": "The name of the command."
},
"description": {
"type": "string",
"optional": true,
"description": "The description for the command."
},
"shortcut": {
"type": "string",
"format": "manifestShortcutKeyOrEmpty",
"optional": true,
"description": "An empty string to clear the shortcut, or a string matching the format defined by the `MDN page of the commands API <|link-commands-shortcuts|>`__ to set a new shortcut key. If the string does not match this format, the function throws an error."
}
}
}
]
},
{
"name": "reset",
"type": "function",
"async": true,
"description": "Reset a command's details to what is specified in the manifest.",
"parameters": [
{
"type": "string",
"name": "name",
"description": "The name of the command."
}
]
},
{
"name": "getAll",
"type": "function",
"async": "callback",
"description": "Returns all the registered extension commands for this extension and their shortcut (if active).",
"parameters": [
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": [
{
"name": "commands",
"type": "array",
"items": {
"$ref": "Command"
}
}
],
"description": "Called to return the registered commands."
}
]
}
]
}
]