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

Unified Diff: chrome/common/extensions/docs/server2/templates/private/experimental_keybinding_intro.html

Issue 10700118: Extensions Docs Server: First doc conversions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added all APIs Created 8 years, 5 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
Index: chrome/common/extensions/docs/server2/templates/private/experimental_keybinding_intro.html
diff --git a/chrome/common/extensions/docs/server2/templates/private/experimental_keybinding_intro.html b/chrome/common/extensions/docs/server2/templates/private/experimental_keybinding_intro.html
new file mode 100644
index 0000000000000000000000000000000000000000..5d6141a871b6a9ae4f6f38fef88aacd02465ab06
--- /dev/null
+++ b/chrome/common/extensions/docs/server2/templates/private/experimental_keybinding_intro.html
@@ -0,0 +1,71 @@
+<!-- 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 and set manifest_version
+to (at least) 2.
+</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": {
+ "suggested_key": {
+ "default": "Ctrl+Shift+Y",
+ "mac": "Command+Shift+Y"
+ },
+ "description": "Toggle feature foo"
+ },
+ "_execute_browser_action": {
+ "suggested_key": {
+ "windows": "Ctrl+Shift+Y",
+ "mac": "Command+Shift+Y",
+ "chromeos": "Ctrl+Shift+U",
+ "linux": "Ctrl+Shift+J"
+ }
+ },
+ "_execute_page_action": {
+ "suggested_key": {
+ "default": "Ctrl+E"
+ "windows": "Alt+P",
+ "mac": "Option+P",
+ }
+ }
+ }</b>,
+ ...
+}</pre>
+<p>In your background page, you can bind a handler to each of the commands
+defined in the manifest (except for '_execute_browser_action' and
+'_execute_page_action') via onCommand.addListener. For example:</p>
+<pre>
+chrome.experimental.keybinding.onCommand.addListener(function(command) {
+ console.log('Command:', command);
+});
+</pre>
+<p>The '_execute_browser_action' and '_execute_page_action' 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 -->

Powered by Google App Engine
This is Rietveld 408576698