Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / common / extensions / api / commands.json
blobc02008e75a8f22194dfe47400a5a2425aedafe77
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6   {
7     "namespace": "commands",
8     "description": "Use the commands API to add keyboard shortcuts that trigger actions in your extension, for example, an action to open the browser action or send a command to the extension.",
9     "types": [
10       {
11         "id": "Command",
12         "type": "object",
13         "properties": {
14           "name":        {
15             "type": "string",
16             "optional": true,
17             "description": "The name of the Extension Command"
18           },
19           "description": {
20             "type": "string",
21             "optional": true,
22             "description": "The Extension Command description"
23           },
24           "shortcut": {
25             "type": "string",
26             "optional": true,
27             "description": "The shortcut active for this command, or blank if not active."
28           }
29         }
30       }
31     ],
32     "events": [
33       {
34         "name": "onCommand",
35         "description": "Fired when a registered command is activated using a keyboard shortcut.",
36         "type": "function",
37         "parameters": [
38           {
39             "name": "command",
40             "type": "string"
41           }
42         ]
43       }
44     ],
45     "functions": [
46       {
47         "name": "getAll",
48         "type": "function",
49         "description": "Returns all the registered extension commands for this extension and their shortcut (if active).",
50         "parameters": [
51           {
52             "type": "function",
53             "name": "callback",
54             "optional": true,
55             "parameters": [
56               {
57                 "name": "commands",
58                 "type": "array",
59                 "items": {
60                   "$ref": "Command"
61                 }
62               }
63             ],
64             "description": "Called to return the registered commands."
65           }
66         ]
67       }
68     ]
69   }