Chromium Code Reviews| Index: chrome/common/extensions/docs/static/experimental.keybinding.html |
| =================================================================== |
| --- chrome/common/extensions/docs/static/experimental.keybinding.html (revision 0) |
| +++ chrome/common/extensions/docs/static/experimental.keybinding.html (revision 0) |
| @@ -0,0 +1,50 @@ |
| +<!-- BEGIN AUTHORED CONTENT --> |
| +<p> |
| +The keybinding API allows you to add keyboard shortcuts that trigger actions in |
| +your extension. An action can be opening the browser action or page action popup |
| +or sending a command to the extension. |
|
Mike West
2012/02/24 14:24:24
Can you add a link here to the experimental docs?
Finnur
2012/02/24 15:09:16
This is generated automatically when you build the
|
| +</p> |
| + |
| +<h2 id="manifest">Manifest</h2> |
| + |
| +<p> |
| +You must declare the "keybinding" permission in your extension's manifest |
| +to use this API. Also note that "pageAction" and "browserAction" are reserved |
|
Mike West
2012/02/24 14:24:24
I'd recommend separating this into two parts: `per
|
| +commands, which, if specified, open the popup for the pageAction (if visible) |
| +and browserAction, respectively. All other commands are sent to the extension in |
| +the form of a javascript event. |
| +</p> |
| + |
| +<pre>{ |
| + "name": "My extension", |
| + ... |
| +<b> "commands": { |
| + "toggle-feature-foo": { |
| + "key": "Ctrl+Shift+Y", |
| + "description": "Toggle feature foo" |
| + }, |
| + "browserAction": { |
| + "key": "Ctrl+Shift+B" |
|
Mike West
2012/02/24 14:24:24
Probably also worth mentioning that `Ctrl+Alt` isn
|
| + }, |
| + "pageAction": { |
| + "key": "Alt+P" |
| + } |
| + |
| + }</b>, |
| + ... |
| +<b> "permissions": [ |
| + "keybinding", |
| + ]</b>, |
| + ... |
| +}</pre> |
| + |
| +<h2>Examples</h2> |
| +<p>The following example adds a handler for the onCommand event: |
| +</p> |
| + |
| +<pre> |
| +chrome.experimental.keybinding.onCommand.addListener(function(command) { |
| + console.log('Command:', command); |
| +}); |
| +</pre> |
| +<!-- END AUTHORED CONTENT --> |
| Property changes on: chrome\common\extensions\docs\static\experimental.keybinding.html |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |