| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 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 | 
|  | 3        across api docs and should be edited only with knowledge of the | 
|  | 4        templating mechanism. | 
|  | 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 | 
|  | 7        authored overview content. | 
|  | 8     4) The <body>.innerHTML is also generated by an offline step so that this | 
|  | 9        page may easily be indexed by search engines. | 
|  | 10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> | 
|  | 11     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | 
|  | 12     <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css"> | 
|  | 13     <link href="css/print.css" rel="stylesheet" type="text/css" media="print"> | 
|  | 14     <script type="text/javascript" src="../../../third_party/jstemplate/jstempla
     te_compiled.js"> | 
|  | 15     </script> | 
|  | 16     <script type="text/javascript" src="js/api_page_generator.js"></script> | 
|  | 17     <script type="text/javascript" src="js/bootstrap.js"></script> | 
|  | 18     <script type="text/javascript" src="js/sidebar.js"></script> | 
|  | 19   <meta name="description" content="Documentation for the chrome.experimental.ke
     ybinding module, which is part of the Google Chrome  extension APIs."><title>chr
     ome.experimental.keybinding - Google Chrome Extensions - Google Code</title></he
     ad> | 
|  | 20   <body>  <div id="devModeWarning" class="displayModeWarning"> | 
|  | 21     You are viewing extension docs in chrome via the 'file:' scheme: are you exp
     ecting to see local changes when you refresh? You'll need run chrome with --allo
     w-file-access-from-files. | 
|  | 22   </div> | 
|  | 23   <div id="branchWarning" class="displayModeWarning"> | 
|  | 24     <span>WARNING: This is the <span id="branchName">BETA</span> documentation. | 
|  | 25     It may not work with the stable release of Chrome.</span> | 
|  | 26     <select id="branchChooser"> | 
|  | 27       <option>Choose a different version... | 
|  | 28       </option><option value="">Stable | 
|  | 29       </option><option value="beta">Beta | 
|  | 30       </option><option value="dev">Dev | 
|  | 31       </option><option value="trunk">Trunk | 
|  | 32     </option></select> | 
|  | 33   </div> | 
|  | 34   <div id="unofficialWarning" class="displayModeWarning"> | 
|  | 35     <span>WARNING: This is unofficial documentation. It may not work with the | 
|  | 36     current release of Chrome.</span> | 
|  | 37     <button id="goToOfficialDocs">Go to the official docs</button> | 
|  | 38   </div> | 
|  | 39   <div id="gc-container" class="labs"> | 
|  | 40       <!-- SUBTEMPLATES: DO NOT MOVE FROM THIS LOCATION --> | 
|  | 41       <!-- In particular, sub-templates that recurse, must be used by allowing | 
|  | 42            jstemplate to make a copy of the template in this section which | 
|  | 43            are not operated on by way of the jsskip="true" --> | 
|  | 44        <!-- /SUBTEMPLATES --> | 
|  | 45   <a id="top"></a> | 
|  | 46     <div id="skipto"> | 
|  | 47       <a href="#gc-pagecontent">Skip to page content</a> | 
|  | 48       <a href="#gc-toc">Skip to main navigation</a> | 
|  | 49     </div> | 
|  | 50     <!-- API HEADER --> | 
|  | 51     <table id="header" width="100%" cellspacing="0" border="0"> | 
|  | 52       <tbody><tr> | 
|  | 53         <td valign="middle"><a href="http://code.google.com/"><img src="images/c
     ode_labs_logo.gif" height="43" width="161" alt="Google Code Labs" style="border:
     0; margin:0;"></a></td> | 
|  | 54         <td valign="middle" width="100%" style="padding-left:0.6em;"> | 
|  | 55           <form action="http://www.google.com/cse" id="cse" style="margin-top:0.
     5em"> | 
|  | 56             <div id="gsc-search-box"> | 
|  | 57               <input type="hidden" name="cx" value="002967670403910741006:61_cvz
     fqtno"> | 
|  | 58               <input type="hidden" name="ie" value="UTF-8"> | 
|  | 59               <input type="text" name="q" value="" size="55"> | 
|  | 60               <input class="gsc-search-button" type="submit" name="sa" value="Se
     arch"> | 
|  | 61               <br> | 
|  | 62               <span class="greytext">e.g. "page action" or "tabs"</span> | 
|  | 63             </div> | 
|  | 64           </form> | 
|  | 65           <script type="text/javascript" src="https://www.google.com/jsapi"></sc
     ript> | 
|  | 66           <script type="text/javascript">google.load("elements", "1", {packages:
      "transliteration"});</script> | 
|  | 67           <script type="text/javascript" src="https://www.google.com/coop/cse/t1
     3n?form=cse&t13n_langs=en"></script> | 
|  | 68           <script type="text/javascript" src="https://www.google.com/coop/cse/br
     and?form=cse&lang=en"></script> | 
|  | 69         </td> | 
|  | 70       </tr> | 
|  | 71     </tbody></table> | 
|  | 72     <div id="codesiteContent" class=""> | 
|  | 73       <a id="gc-topnav-anchor"></a> | 
|  | 74       <div id="gc-topnav"> | 
|  | 75         <h1>Google Chrome Extensions (<a href="http://code.google.com/labs/">Lab
     s</a>)</h1> | 
|  | 76         <ul id="home" class="gc-topnav-tabs"> | 
|  | 77           <li id="home_link"> | 
|  | 78             <a href="index.html" title="Google Chrome Extensions home page">Home
     </a> | 
|  | 79           </li> | 
|  | 80           <li id="docs_link"> | 
|  | 81             <a href="docs.html" title="Official Google Chrome Extensions documen
     tation">Docs</a> | 
|  | 82           </li> | 
|  | 83           <li id="faq_link"> | 
|  | 84             <a href="faq.html" title="Answers to frequently asked questions abou
     t Google Chrome Extensions">FAQ</a> | 
|  | 85           </li> | 
|  | 86           <li id="samples_link"> | 
|  | 87             <a href="samples.html" title="Sample extensions (with source code)">
     Samples</a> | 
|  | 88           </li> | 
|  | 89           <li id="group_link"> | 
|  | 90             <a href="http://groups.google.com/a/chromium.org/group/chromium-exte
     nsions" title="Google Chrome Extensions developer forum">Group</a> | 
|  | 91           </li> | 
|  | 92           <li id="so_link"> | 
|  | 93             <a href="http://stackoverflow.com/questions/tagged/google-chrome-ext
     ension" title="[google-chrome-extension] tag on Stack Overflow">Questions?</a> | 
|  | 94           </li> | 
|  | 95         </ul> | 
|  | 96       </div> <!-- end gc-topnav --> | 
|  | 97     <div class="g-section g-tpl-170"> | 
|  | 98       <!-- SIDENAV --> | 
|  | 99       <div class="g-unit g-first" id="gc-toc"> | 
|  | 100         <ul> | 
|  | 101           <li><a href="getstarted.html">Getting Started</a></li> | 
|  | 102           <li><a href="overview.html">Overview</a></li> | 
|  | 103           <li><a href="whats_new.html">What's New?</a></li> | 
|  | 104           <li><h2><a href="devguide.html">Developer's Guide</a></h2> | 
|  | 105             <ul> | 
|  | 106               <li>Browser UI | 
|  | 107                 <ul> | 
|  | 108                   <li><a href="browserAction.html">Browser Actions</a></li> | 
|  | 109                   <li><a href="contextMenus.html">Context Menus</a></li> | 
|  | 110                   <li><a href="notifications.html">Desktop Notifications</a></li
     > | 
|  | 111                   <li><a href="omnibox.html">Omnibox</a></li> | 
|  | 112                   <li><a href="options.html">Options Pages</a></li> | 
|  | 113                   <li><a href="override.html">Override Pages</a></li> | 
|  | 114                   <li><a href="pageAction.html">Page Actions</a></li> | 
|  | 115                 </ul> | 
|  | 116               </li> | 
|  | 117               <li>Browser Interaction | 
|  | 118                 <ul> | 
|  | 119                   <li><a href="bookmarks.html">Bookmarks</a></li> | 
|  | 120                   <li><a href="cookies.html">Cookies</a></li> | 
|  | 121                   <li><a href="devtools.html">Developer Tools</a></li> | 
|  | 122                   <li><a href="events.html">Events</a></li> | 
|  | 123                   <li><a href="history.html">History</a></li> | 
|  | 124                   <li><a href="management.html">Management</a></li> | 
|  | 125                   <li><a href="tabs.html">Tabs</a></li> | 
|  | 126                   <li><a href="windows.html">Windows</a></li> | 
|  | 127                 </ul> | 
|  | 128               </li> | 
|  | 129               <li>Implementation | 
|  | 130                 <ul> | 
|  | 131                   <li><a href="a11y.html">Accessibility</a></li> | 
|  | 132                   <li><a href="background_pages.html">Background Pages</a></li> | 
|  | 133                   <li><a href="content_scripts.html">Content Scripts</a></li> | 
|  | 134                   <li><a href="xhr.html">Cross-Origin XHR</a></li> | 
|  | 135                   <li><a href="i18n.html">Internationalization</a></li> | 
|  | 136                   <li><a href="messaging.html">Message Passing</a></li> | 
|  | 137                   <li><a href="permissions.html">Optional Permissions</a></li> | 
|  | 138                   <li><a href="npapi.html">NPAPI Plugins</a></li> | 
|  | 139                 </ul> | 
|  | 140               </li> | 
|  | 141               <li>Finishing | 
|  | 142                 <ul> | 
|  | 143                   <li><a href="hosting.html">Hosting</a></li> | 
|  | 144                   <li><a href="external_extensions.html">Other Deployment Option
     s</a></li> | 
|  | 145                 </ul> | 
|  | 146               </li> | 
|  | 147             </ul> | 
|  | 148           </li> | 
|  | 149           <li><h2><a href="apps.html">Packaged Apps</a></h2></li> | 
|  | 150           <li><h2><a href="tutorials.html">Tutorials</a></h2> | 
|  | 151             <ul> | 
|  | 152               <li><a href="tut_debugging.html">Debugging</a></li> | 
|  | 153               <li><a href="tut_analytics.html">Google Analytics</a></li> | 
|  | 154               <li><a href="tut_oauth.html">OAuth</a></li> | 
|  | 155             </ul> | 
|  | 156           </li> | 
|  | 157           <li><h2>Reference</h2> | 
|  | 158             <ul> | 
|  | 159               <li>Formats | 
|  | 160                 <ul> | 
|  | 161                   <li><a href="manifest.html">Manifest Files</a></li> | 
|  | 162                   <li><a href="match_patterns.html">Match Patterns</a></li> | 
|  | 163                 </ul> | 
|  | 164               </li> | 
|  | 165               <li><a href="permission_warnings.html">Permission Warnings</a></li
     > | 
|  | 166               <li><a href="api_index.html">chrome.* APIs</a></li> | 
|  | 167               <li><a href="api_other.html">Other APIs</a></li> | 
|  | 168             </ul> | 
|  | 169           </li> | 
|  | 170           <li><h2><a href="samples.html">Samples</a></h2></li> | 
|  | 171           <div class="line"> </div> | 
|  | 172           <li><h2>More</h2> | 
|  | 173             <ul> | 
|  | 174               <li><a href="http://code.google.com/chrome/webstore/docs/index.htm
     l">Chrome Web Store</a></li> | 
|  | 175               <li><a href="http://code.google.com/chrome/apps/docs/developers_gu
     ide.html">Hosted Apps</a></li> | 
|  | 176               <li><a href="themes.html">Themes</a></li> | 
|  | 177             </ul> | 
|  | 178           </li> | 
|  | 179         </ul> | 
|  | 180       </div> | 
|  | 181       <script> | 
|  | 182         initToggles(); | 
|  | 183       </script> | 
|  | 184     <div class="g-unit" id="gc-pagecontent"> | 
|  | 185       <div id="pageTitle"> | 
|  | 186         <h1 class="page_title">chrome.experimental.keybinding</h1> | 
|  | 187       </div> | 
|  | 188         <!-- TABLE OF CONTENTS --> | 
|  | 189         <div id="toc"> | 
|  | 190           <h2>Contents</h2> | 
|  | 191           <ol> | 
|  | 192             <li> | 
|  | 193               <a href="#manifest">Manifest</a> | 
|  | 194               <ol> | 
|  | 195               </ol> | 
|  | 196             </li><li> | 
|  | 197               <a href="#H2-1">Examples</a> | 
|  | 198               <ol> | 
|  | 199               </ol> | 
|  | 200             </li> | 
|  | 201               <li> | 
|  | 202                 <a href="#apiReference">API reference: chrome.experimental.keybi
     nding</a> | 
|  | 203                 <ol> | 
|  | 204                   <li> | 
|  | 205             <a href="#global-events">Events</a> | 
|  | 206             <ol> | 
|  | 207               <li> | 
|  | 208                 <a href="#event-onCommand">onCommand</a> | 
|  | 209               </li> | 
|  | 210             </ol> | 
|  | 211           </li> | 
|  | 212                 </ol> | 
|  | 213               </li> | 
|  | 214           </ol> | 
|  | 215         </div> | 
|  | 216         <!-- /TABLE OF CONTENTS --> | 
|  | 217         <!-- Standard content lead-in for experimental API pages --> | 
|  | 218         <p id="classSummary"> | 
|  | 219           For information on how to use experimental APIs, see the <a href="expe
     rimental.html">chrome.experimental.* APIs</a> page. | 
|  | 220         </p> | 
|  | 221         <!-- STATIC CONTENT PLACEHOLDER --> | 
|  | 222         <div id="static"><!-- BEGIN AUTHORED CONTENT --> | 
|  | 223 <p> | 
|  | 224 The keybinding API allows you to add keyboard shortcuts that trigger actions in | 
|  | 225 your extension. An action can be opening the browser action or page action popup | 
|  | 226 or sending a command to the extension. | 
|  | 227 </p> | 
|  | 228 <h2 id="manifest">Manifest</h2> | 
|  | 229 <p> | 
|  | 230 You must declare the "keybinding" permission in your extension's manifest | 
|  | 231 to use this API. Also note that "pageAction" and "browserAction" are reserved | 
|  | 232 commands, which, if specified, open the popup for the pageAction (if visible) | 
|  | 233 and browserAction, respectively. All other commands are sent to the extension in | 
|  | 234 the form of a javascript event. | 
|  | 235 </p> | 
|  | 236 <pre>{ | 
|  | 237   "name": "My extension", | 
|  | 238   ... | 
|  | 239 <b>  "commands": { | 
|  | 240     "toggle-feature-foo": { | 
|  | 241       "key": "Ctrl+Shift+Y", | 
|  | 242       "description": "Toggle feature foo" | 
|  | 243     }, | 
|  | 244     "browserAction": { | 
|  | 245       "key": "Ctrl+Shift+B" | 
|  | 246     }, | 
|  | 247     "pageAction": { | 
|  | 248       "key": "Alt+P" | 
|  | 249     } | 
|  | 250   }</b>, | 
|  | 251   ... | 
|  | 252 <b>  "permissions": [ | 
|  | 253     "keybinding", | 
|  | 254   ]</b>, | 
|  | 255   ... | 
|  | 256 }</pre> | 
|  | 257 <a name="H2-1"></a><h2>Examples</h2> | 
|  | 258 <p>The following example adds a handler for the onCommand event: | 
|  | 259 </p> | 
|  | 260 <pre>chrome.experimental.keybinding.onCommand.addListener(function(command) { | 
|  | 261   console.log('Command:', command); | 
|  | 262 }); | 
|  | 263 </pre> | 
|  | 264 <!-- END AUTHORED CONTENT --> | 
|  | 265 </div> | 
|  | 266         <!-- API PAGE --> | 
|  | 267         <div class="apiPage"> | 
|  | 268         <a name="apiReference"></a> | 
|  | 269         <h2>API reference: chrome.experimental.keybinding</h2> | 
|  | 270           <!-- PROPERTIES --> | 
|  | 271            <!-- /apiGroup --> | 
|  | 272           <!-- METHODS --> | 
|  | 273             <!-- /apiGroup --> | 
|  | 274           <!-- EVENTS --> | 
|  | 275           <div id="eventsTemplate" class="apiGroup"> | 
|  | 276             <a name="global-events"></a> | 
|  | 277             <h3>Events</h3> | 
|  | 278             <!-- iterates over all events --> | 
|  | 279             <div class="apiItem"> | 
|  | 280               <a name="event-onCommand"></a> | 
|  | 281               <h4>onCommand</h4> | 
|  | 282               <div class="summary"> | 
|  | 283                 <!-- Note: intentionally longer 80 columns --> | 
|  | 284                 <span class="subdued">chrome.experimental.keybinding.</span><spa
     n>onCommand</span><span class="subdued">.addListener</span>(function(<span>strin
     g command</span>) <span class="subdued">{...}</span><span></span>); | 
|  | 285               </div> | 
|  | 286               <div class="description"> | 
|  | 287                 <p>Fired when a registered command is activated using a keyboard
      shortcut.</p> | 
|  | 288                 <!-- LISTENER PARAMETERS --> | 
|  | 289                 <div> | 
|  | 290                   <h4>Listener parameters</h4> | 
|  | 291                   <dl> | 
|  | 292                     <div> | 
|  | 293                       <div> | 
|  | 294           <dt> | 
|  | 295             <var>command</var> | 
|  | 296               <em> | 
|  | 297                 <!-- TYPE --> | 
|  | 298                 <div style="display:inline"> | 
|  | 299                   ( | 
|  | 300                     <span id="typeTemplate"> | 
|  | 301                       <span> | 
|  | 302                         <span>string</span> | 
|  | 303                       </span> | 
|  | 304                     </span> | 
|  | 305                   ) | 
|  | 306                 </div> | 
|  | 307               </em> | 
|  | 308           </dt> | 
|  | 309           <dd class="todo"> | 
|  | 310             Undocumented. | 
|  | 311           </dd> | 
|  | 312           <!-- OBJECT PROPERTIES --> | 
|  | 313           <!-- OBJECT METHODS --> | 
|  | 314           <!-- OBJECT EVENT FIELDS --> | 
|  | 315           <!-- FUNCTION PARAMETERS --> | 
|  | 316         </div> | 
|  | 317                     </div> | 
|  | 318                   </dl> | 
|  | 319                 </div> | 
|  | 320                 <!-- EXTRA PARAMETERS --> | 
|  | 321                 <!-- LISTENER RETURN VALUE --> | 
|  | 322                 <dl> | 
|  | 323                 </dl> | 
|  | 324               </div> <!-- /description --> | 
|  | 325             </div> <!-- /apiItem --> | 
|  | 326           </div> <!-- /apiGroup --> | 
|  | 327           <!-- TYPES --> | 
|  | 328            <!-- /apiGroup --> | 
|  | 329         </div> <!-- /apiPage --> | 
|  | 330       </div> <!-- /gc-pagecontent --> | 
|  | 331     </div> <!-- /g-section --> | 
|  | 332   </div> <!-- /codesiteContent --> | 
|  | 333     <div id="gc-footer" --=""> | 
|  | 334       <div class="text"> | 
|  | 335   <p> | 
|  | 336   Except as otherwise <a href="http://code.google.com/policies.html#restrictions
     ">noted</a>, | 
|  | 337   the content of this page is licensed under the <a rel="license" href="http://c
     reativecommons.org/licenses/by/3.0/">Creative Commons | 
|  | 338   Attribution 3.0 License</a>, and code samples are licensed under the | 
|  | 339   <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD Lic
     ense</a>. | 
|  | 340   </p> | 
|  | 341   <p> | 
|  | 342   ©2011 Google | 
|  | 343   </p> | 
|  | 344 <!-- begin analytics --> | 
|  | 345 <script src="https://www.google-analytics.com/urchin.js" type="text/javascript">
     </script> | 
|  | 346 <script src="https://www.google-analytics.com/ga.js" type="text/javascript"></sc
     ript> | 
|  | 347 <script type="text/javascript"> | 
|  | 348   // chrome doc tracking | 
|  | 349   try { | 
|  | 350     var engdocs = _gat._getTracker("YT-10763712-2"); | 
|  | 351     engdocs._trackPageview(); | 
|  | 352   } catch(err) {} | 
|  | 353   // code.google.com site-wide tracking | 
|  | 354   try { | 
|  | 355     _uacct="UA-18071-1"; | 
|  | 356     _uanchor=1; | 
|  | 357     _uff=0; | 
|  | 358     urchinTracker(); | 
|  | 359   } | 
|  | 360   catch(e) {/* urchinTracker not available. */} | 
|  | 361 </script> | 
|  | 362 <!-- end analytics --> | 
|  | 363       </div> | 
|  | 364     </div> <!-- /gc-footer --> | 
|  | 365   </div> <!-- /gc-container --> | 
|  | 366 </body></html> | 
| OLD | NEW | 
|---|