// 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 Alt+F5. The string must match the shortcut format as defined by the $(url:commands-shortcuts)[MDN page of the commands API]." }, { "$extend": "WebExtensionManifest", "properties": { "commands": { "optional": true, "type": "object", "description": "A dictionary object defining one or more commands as name-value pairs, the name being the name of the command and the value being a $(ref:CommandsShortcut).", "additionalProperties": { "$ref": "CommandsShortcut" } } } }, { "id": "CommandsShortcut", "type": "object", "properties": { "suggested_key": { "type": "object", "optional": true, "properties": { "default": { "$ref": "KeyName", "description": "Default key combination.", "optional": true }, "mac": { "$ref": "KeyName", "description": "Key combination on Mac.", "optional": true }, "linux": { "$ref": "KeyName", "description": "Key combination on Linux.", "optional": true }, "windows": { "$ref": "KeyName", "description": "Key combination on Windows.", "optional": true } }, "additionalProperties": { "type": "string", "deprecated": "Unknown platform name" } }, "description": { "type": "string", "preprocess": "localize", "optional": true } }, "additionalProperties": { "$ref": "UnrecognizedProperty" } } ] }, { "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 description of the Extension Command" }, "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 $(url:user-input-restrictions)[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": "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." } ] }, { "name": "openShortcutSettings", "type": "function", "async": true, "description": "Open extension shortcuts configuration page.", "parameters": [] }, { "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": "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 $(url:commands-shortcuts)[MDN page of the commands API] to set a new shortcut key. If the string does not match this format, the function throws an error." } } } ] } ] } ]