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

Side by Side Diff: chrome/common/extensions/docs/templates/intros/commands.html

Issue 197783005: Enable the Commands API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/command.cc ('k') | extensions/common/feature_switch.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <h2 id="manifest">Manifest</h2> 1 <h2 id="manifest">Manifest</h2>
2 <p> 2 <p>
3 You must set manifest_version to (at least) 2 to use this API. 3 You must set manifest_version to (at least) 2 to use this API.
4 </p> 4 </p>
5 5
6 <h2 id="usage">Usage</h2> 6 <h2 id="usage">Usage</h2>
7 <p>The commands API allows you to define specific commands, and bind them to a 7 <p>The commands API allows you to define specific commands, and bind them to a
8 default key combination. Each command your extension accepts must be listed in 8 default key combination. Each command your extension accepts must be listed in
9 the manifest as an attribute of the 'commands' manifest key. An extension can 9 the manifest as an attribute of the 'commands' manifest key. An extension can
10 have many commands but only 4 suggested keys can be specified. The user can 10 have many commands but only 4 suggested keys can be specified. The user can
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 console.log('Command:', command); 67 console.log('Command:', command);
68 }); 68 });
69 </pre> 69 </pre>
70 70
71 <p>The '_execute_browser_action' and '_execute_page_action' commands are 71 <p>The '_execute_browser_action' and '_execute_page_action' commands are
72 reserved for the action of opening your extension's popups. They won't normally 72 reserved for the action of opening your extension's popups. They won't normally
73 generate events that you can handle. If you need to take action based on your 73 generate events that you can handle. If you need to take action based on your
74 popup opening, consider listening for an 'onDomReady' event inside your popup's 74 popup opening, consider listening for an 'onDomReady' event inside your popup's
75 code. 75 code.
76 </p> 76 </p>
77
78 <h2 id="usage">Scope</h2>
79 <p>By default, Commands are scoped to the Chrome browser, which means that while
80 the browser does not have focus, the shortcut will be inactive. On desktop
81 Chrome, Commands can instead have global scope and will then also work while
82 Chrome does *not* have focus. NOTE: The exception here is ChromeOS, where global
83 commands are not allowed at the moment.</p>
84
85 <p>The user is free to designate any shortcut as global using the UI in
86 chrome://extensions \ Keyboard Shortcuts, but the extension developer is limited
87 to specifying only Ctrl+Shift+[0..9] as global shortcuts. This is to minimize
88 the risk of overriding shortcuts in other applications since if, for example,
89 Alt+P were to be allowed as global, the printing shortcut might not work in
90 other applications.</p>
91
92 <p>Example:</p>
93
94 <pre data-filename="manifest.json">
95 {
96 "name": "My extension",
97 ...
98 "commands": {
99 "toggle-feature-foo": {
100 "suggested_key": {
101 "default": "Ctrl+Shift+5"
102 },
103 "description": "Toggle feature foo",
104 <b>"global": true</b>
105 }
106 },
107 ...
108 }</pre>
OLDNEW
« no previous file with comments | « chrome/common/extensions/command.cc ('k') | extensions/common/feature_switch.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698