OLD | NEW |
1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc.
Note: | 1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc.
Note: |
2 1) The <head> information in this page is significant, should be uniform | 2 1) The <head> information in this page is significant, should be uniform |
3 across api docs and should be edited only with knowledge of the | 3 across api docs and should be edited only with knowledge of the |
4 templating mechanism. | 4 templating mechanism. |
5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a | 5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a |
6 browser, it will be re-generated from the template, json schema and | 6 browser, it will be re-generated from the template, json schema and |
7 authored overview content. | 7 authored overview content. |
8 4) The <body>.innerHTML is also generated by an offline step so that this | 8 4) The <body>.innerHTML is also generated by an offline step so that this |
9 page may easily be indexed by search engines. | 9 page may easily be indexed by search engines. |
10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> | 10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 <!-- STATIC CONTENT PLACEHOLDER --> | 223 <!-- STATIC CONTENT PLACEHOLDER --> |
224 <div id="static"><!-- BEGIN AUTHORED CONTENT --> | 224 <div id="static"><!-- BEGIN AUTHORED CONTENT --> |
225 <p> | 225 <p> |
226 The keybinding API allows you to add keyboard shortcuts that trigger actions in | 226 The keybinding API allows you to add keyboard shortcuts that trigger actions in |
227 your extension. An action can be opening the browser action or page action popup | 227 your extension. An action can be opening the browser action or page action popup |
228 or sending a command to the extension. | 228 or sending a command to the extension. |
229 </p> | 229 </p> |
230 <h2 id="manifest">Manifest</h2> | 230 <h2 id="manifest">Manifest</h2> |
231 <p> | 231 <p> |
232 In addition to the "experimental" permission you must declare the "keybinding" | 232 In addition to the "experimental" permission you must declare the "keybinding" |
233 permission in your extension's manifest to use this API. | 233 permission in your extension's manifest to use this API and set manifest_version |
| 234 to (at least) 2. |
234 </p> | 235 </p> |
235 <pre>{ | 236 <pre>{ |
236 "name": "My extension", | 237 "name": "My extension", |
237 ... | 238 ... |
238 <b> "permissions": [ | 239 <b> "permissions": [ |
239 "experimental", | 240 "experimental", |
240 "keybinding", | 241 "keybinding", |
241 ]</b>, | 242 ]</b>, |
242 ... | 243 ... |
243 }</pre> | 244 }</pre> |
244 <h2 id="usage">Usage</h2> | 245 <h2 id="usage">Usage</h2> |
245 <p>The keybinding API allows you to define specific commands, and bind them to a | 246 <p>The keybinding API allows you to define specific commands, and bind them to a |
246 default key combination. Each command your extension accepts must be listed in | 247 default key combination. Each command your extension accepts must be listed in |
247 the manifest as an attribute of the 'commands' manifest key. Note: Combinations | 248 the manifest as an attribute of the 'commands' manifest key. Note: Combinations |
248 that involve Ctrl+Alt are not permitted in order to avoid conflicts with the | 249 that involve Ctrl+Alt are not permitted in order to avoid conflicts with the |
249 AltGr key.</p> | 250 AltGr key.</p> |
250 <pre>{ | 251 <pre>{ |
251 "name": "My extension", | 252 "name": "My extension", |
252 ... | 253 ... |
253 <b> "commands": { | 254 <b> "commands": { |
254 "toggle-feature-foo": { | 255 "toggle-feature-foo": { |
255 "key": "Ctrl+Shift+Y", | 256 "suggested_key": { |
| 257 "default": "Ctrl+Shift+Y", |
| 258 "mac": "Command+Shift+Y" |
| 259 }, |
256 "description": "Toggle feature foo" | 260 "description": "Toggle feature foo" |
257 }, | 261 }, |
258 "browserAction": { | 262 "_execute_browser_action": { |
259 "key": "Ctrl+Shift+B" | 263 "suggested_key": { |
| 264 "windows": "Ctrl+Shift+Y", |
| 265 "mac": "Command+Shift+Y", |
| 266 "chromeos": "Ctrl+Shift+U", |
| 267 "linux": "Ctrl+Shift+J" |
| 268 } |
260 }, | 269 }, |
261 "pageAction": { | 270 "_execute_page_action": { |
262 "key": "Alt+P" | 271 "suggested_key": { |
| 272 "default": "Ctrl+E" |
| 273 "windows": "Alt+P", |
| 274 "mac": "Option+P", |
| 275 } |
263 } | 276 } |
264 }</b>, | 277 }</b>, |
265 ... | 278 ... |
266 }</pre> | 279 }</pre> |
267 <p>In your background page, you can bind a handler to each of the commands | 280 <p>In your background page, you can bind a handler to each of the commands |
268 defined in the manifest (except for 'browserAction' and 'pageAction') via | 281 defined in the manifest (except for '_execute_browser_action' and |
269 onCommand.addListener. For example:</p> | 282 '_execute_page_action') via onCommand.addListener. For example:</p> |
270 <pre>chrome.experimental.keybinding.onCommand.addListener(function(command) { | 283 <pre>chrome.experimental.keybinding.onCommand.addListener(function(command) { |
271 console.log('Command:', command); | 284 console.log('Command:', command); |
272 }); | 285 }); |
273 </pre> | 286 </pre> |
274 <p>The 'browserAction' and 'pageAction' commands are reserved for the action of | 287 <p>The '_execute_browser_action' and '_execute_page_action' commands are |
275 opening your extension's popups. They won't normally generate events that you | 288 reserved for the action of opening your extension's popups. They won't normally |
276 can handle. If you need to take action based on your popup opening, consider | 289 generate events that you can handle. If you need to take action based on your |
277 listening for an 'onDomReady' event inside your popup's code. | 290 popup opening, consider listening for an 'onDomReady' event inside your popup's |
| 291 code. |
278 </p> | 292 </p> |
279 <!-- END AUTHORED CONTENT --> | 293 <!-- END AUTHORED CONTENT --> |
280 </div> | 294 </div> |
281 <!-- API PAGE --> | 295 <!-- API PAGE --> |
282 <div class="apiPage"> | 296 <div class="apiPage"> |
283 <a name="apiReference"></a> | 297 <a name="apiReference"></a> |
284 <h2>API reference: chrome.experimental.keybinding</h2> | 298 <h2>API reference: chrome.experimental.keybinding</h2> |
285 <!-- PROPERTIES --> | 299 <!-- PROPERTIES --> |
286 <!-- /apiGroup --> | 300 <!-- /apiGroup --> |
287 <!-- METHODS --> | 301 <!-- METHODS --> |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 _uff=0; | 386 _uff=0; |
373 urchinTracker(); | 387 urchinTracker(); |
374 } | 388 } |
375 catch(e) {/* urchinTracker not available. */} | 389 catch(e) {/* urchinTracker not available. */} |
376 </script> | 390 </script> |
377 <!-- end analytics --> | 391 <!-- end analytics --> |
378 </div> | 392 </div> |
379 </div> <!-- /gc-footer --> | 393 </div> <!-- /gc-footer --> |
380 </div> <!-- /gc-container --> | 394 </div> <!-- /gc-container --> |
381 </body></html> | 395 </body></html> |
OLD | NEW |