summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/docs/static
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-27 10:34:27 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-27 10:34:27 +0000
commit97ad50db916b312eb89b0b76517ce85d2084328d (patch)
tree273a2c3d8e399116dea68c52b222230ccddb01fc /chrome/common/extensions/docs/static
parent8004948ade035d8c402f0074ad92d7c07f28c583 (diff)
downloadchromium_src-97ad50db916b312eb89b0b76517ce85d2084328d.zip
chromium_src-97ad50db916b312eb89b0b76517ce85d2084328d.tar.gz
chromium_src-97ad50db916b312eb89b0b76517ce85d2084328d.tar.bz2
Updating the doc to reflect the new experimental.keybinding API.
Adding missing elements from previous API updates (someone forgot to run build.py). Tiny code-change in extension.cc which was suggested during review, but I forgot to do. BUG=27702 TEST=None (doc change) Review URL: https://chromiumcodereview.appspot.com/9465005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123724 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/docs/static')
-rw-r--r--chrome/common/extensions/docs/static/experimental.keybinding.html65
1 files changed, 65 insertions, 0 deletions
diff --git a/chrome/common/extensions/docs/static/experimental.keybinding.html b/chrome/common/extensions/docs/static/experimental.keybinding.html
new file mode 100644
index 0000000..1148018
--- /dev/null
+++ b/chrome/common/extensions/docs/static/experimental.keybinding.html
@@ -0,0 +1,65 @@
+<!-- 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.
+</p>
+
+<h2 id="manifest">Manifest</h2>
+<p>
+In addition to the "experimental" permission you must declare the "keybinding"
+permission in your extension's manifest to use this API.
+</p>
+
+<pre>{
+ "name": "My extension",
+ ...
+<b> "permissions": [
+ "experimental",
+ "keybinding",
+ ]</b>,
+ ...
+}</pre>
+
+<h2 id="usage">Usage</h2>
+<p>The keybinding API allows you to define specific commands, and bind them to a
+default key combination. Each command your extension accepts must be listed in
+the manifest as an attribute of the 'commands' manifest key. Note: Combinations
+that involve Ctrl+Alt are not permitted in order to avoid conflicts with the
+AltGr key.</p>
+
+<pre>{
+ "name": "My extension",
+ ...
+<b> "commands": {
+ "toggle-feature-foo": {
+ "key": "Ctrl+Shift+Y",
+ "description": "Toggle feature foo"
+ },
+ "browserAction": {
+ "key": "Ctrl+Shift+B"
+ },
+ "pageAction": {
+ "key": "Alt+P"
+ }
+
+ }</b>,
+ ...
+}</pre>
+
+<p>In your background page, you can bind a handler to each of the commands
+defined in the manifest (except for 'browserAction' and 'pageAction') via
+onCommand.addListener. For example:</p>
+
+<pre>
+chrome.experimental.keybinding.onCommand.addListener(function(command) {
+ console.log('Command:', command);
+});
+</pre>
+
+<p>The 'browserAction' and 'pageAction' commands are reserved for the action of
+opening your extension's popups. They won't normally generate events that you
+can handle. If you need to take action based on your popup opening, consider
+listening for an 'onDomReady' event inside your popup's code.
+</p>
+<!-- END AUTHORED CONTENT -->