Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6429)

Unified Diff: chrome/common/extensions/docs/static/experimental.keybinding.html

Issue 9465005: Updating the doc to reflect the new experimental.keybinding API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/docs/js/api_page_generator.js ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,64 @@
+<!-- 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",
Mike West 2012/02/24 15:14:28 Nit: Separate lines for clarity.
+ ]</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 -->
Property changes on: chrome\common\extensions\docs\static\experimental.keybinding.html
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/common/extensions/docs/js/api_page_generator.js ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698