1 <div id="gc-container" class="labs"> 2 <div id="devModeWarning"> 3 You are viewing extension docs in chrome via the 'file:' scheme: are you expecting to see local changes when you refresh? You'll need run chrome with --allow-file-access-from-files. 4 </div> 5 <!-- SUBTEMPLATES: DO NOT MOVE FROM THIS LOCATION --> 6 <!-- In particular, sub-templates that recurse, must be used by allowing 7 jstemplate to make a copy of the template in this section which 8 are not operated on by way of the jsskip="true" --> 9 <div jsskip="true" style="display:none"> 10 11 <!-- VALUE --> 12 <div id="valueTemplate"> 13 <dt> 14 <var jsdisplay="$this.name" jscontent="$this.name">paramName</var> 15 <em> 16 17 <!-- TYPE --> 18 <div style="display:inline"> 19 ( 20 <span class="optional" jsdisplay="optional">optional</span> 21 <span class="enum" jsdisplay="enum">enumerated</span> 22 <span id="typeTemplate"> 23 <span jsdisplay="getTypeRef($this)"> 24 <a jsvalues=".href: getTypeRefPage($this) + '#type-' + getTypeRef($this)" 25 jscontent="getTypeRef($this)"> Type</a> 26 </span> 27 <span jsdisplay="!getTypeRef($this)"> 28 <span jsdisplay="isArray($this)"> 29 array of <span jsselect="items"><span transclude="typeTemplate"></span></span> 30 </span> 31 <span jsdisplay="!isArray($this)" jscontent="getTypeName($this)">paramType</span> 32 <span jsdisplay="!isArray($this) && enum" jscontent="getEnumValues(enum, type);"></span> 33 </span> 34 </span> 35 ) 36 </div> 37 38 </em> 39 </dt> 40 <dd class="todo" jsdisplay="!$this.description"> 41 Undocumented. 42 </dd> 43 <dd jsdisplay="$this.description" 44 jsvalues=".innerHTML:substituteTypeRefs($this.description)"> 45 Description of this parameter from the json schema. 46 </dd> 47 <dd jsdisplay="$this.min_version"> 48 This parameter was added in version 49 <b><span jscontent="$this.min_version"></span></b>. 50 You must omit this parameter in earlier versions, 51 and you may omit it in any version. If you require this 52 parameter, the manifest key 53 <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> 54 can ensure that your extension won't be run in an earlier browser version. 55 </dd> 56 57 <!-- OBJECT PROPERTIES --> 58 <dd jsdisplay="shouldExpandObject($this)"> 59 <dl> 60 <div jsselect="getPropertyListFromObject($this)"> 61 <div transclude="valueTemplate"> 62 </div> 63 </div> 64 </dl> 65 </dd> 66 67 <!-- OBJECT METHODS --> 68 <dd jsdisplay="$this.type === 'object' && 69 $this.functions && $this.functions.length > 0" 70 jsvalues="$scope:id"> 71 <div transclude="methodsTemplate"></div> 72 </dd> 73 74 <!-- OBJECT EVENT FIELDS --> 75 <dd jsdisplay="$this.type === 'object' && 76 $this.events && $this.events.length > 0" 77 jsvalues="$scope:id"> 78 <div transclude="eventsTemplate"></div> 79 </dd> 80 81 <!-- FUNCTION PARAMETERS --> 82 <dd jsdisplay="isFunction($this) && $this.parameters && 83 $this.name != 'callback'"> 84 <div transclude="functionParametersTemplate"></div> 85 </dd> 86 87 </div> <!-- /VALUE --> 88 89 <div id="functionParametersTemplate"> 90 <h5>Parameters</h5> 91 <dl> 92 <div jsselect="$this.parameters"> 93 <div transclude="valueTemplate"> 94 </div> 95 </div> 96 </dl> 97 </div> 98 </div> <!-- /SUBTEMPLATES --> 99 100 <a id="top"></a> 101 <div id="skipto"> 102 <a href="#gc-pagecontent">Skip to page content</a> 103 <a href="#gc-toc">Skip to main navigation</a> 104 </div> 105 <!-- API HEADER --> 106 <table id="header" width="100%" cellspacing="0" border="0"> 107 <tr> 108 <td valign="middle" 109 ><a href="http://code.google.com/"><img src="images/code_labs_logo.gif" height="43" width="161" alt="Google Code Labs" 110 style="border:0; margin:0;" 111 ></a></td> 112 <td valign="middle" width="100%" style="padding-left:0.6em;"> 113 <form action="http://www.google.com/cse" id="cse" style="margin-top:0.5em"> 114 <div id="gsc-search-box"> 115 <input type="hidden" name="cx" value="002967670403910741006:61_cvzfqtno" /> 116 <input type="hidden" name="ie" value="UTF-8" /> 117 <input type="text" name="q" value="" size="55" /> 118 <input class="gsc-search-button" type="submit" name="sa" value="Search" /> 119 <br> 120 <span class="greytext">e.g. "page action" or "tabs"</span> 121 </div> 122 </form> 123 124 <script type="text/javascript" src="http://www.google.com/jsapi"></script> 125 <script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script> 126 <script type="text/javascript" src="http://www.google.com/coop/cse/t13n?form=cse&t13n_langs=en"></script> 127 <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse&lang=en"></script> 128 </td> 129 </tr> 130 </table> 131 132 <div id="codesiteContent" jsvalues=".className: showSideNav() ? '' : 'hideSideNav'"> 133 134 <a id="gc-topnav-anchor"></a> 135 <div id="gc-topnav"> 136 <h1>Google Chrome Extensions (<a href="http://code.google.com/labs/">Labs</a>)</h1> 137 <ul id="home" class="gc-topnav-tabs"> 138 <li id="home_link"> 139 <a href="index.html" title="Google Chrome Extensions home page">Home</a> 140 </li> 141 <li id="docs_link"> 142 <a href="docs.html" title="Official Google Chrome Extensions documentation">Docs</a> 143 </li> 144 <li id="faq_link"> 145 <a href="faq.html" title="Answers to frequently asked questions about Google Chrome Extensions">FAQ</a> 146 </li> 147 <li id="samples_link"> 148 <a href="samples.html" title="Sample extensions (with source code)">Samples</a> 149 </li> 150 <li id="group_link"> 151 <a href="http://groups.google.com/a/chromium.org/group/chromium-extensions" title="Google Chrome Extensions developer forum">Group</a> 152 </li> 153 </ul> 154 </div> <!-- end gc-topnav --> 155 156 <div class="g-section g-tpl-170"> 157 <!-- SIDENAV --> 158 <div class="g-unit g-first" id="gc-toc" jsdisplay="showSideNav()"> 159 <ul> 160 <li><a href="getstarted.html">Getting Started</a></li> 161 <li><a href="overview.html">Overview</a></li> 162 <li><a href="whats_new.html">What's New?</a></li> 163 <li><h2><a href="devguide.html">Developer's Guide</a></h2> 164 <ul> 165 <li>Browser UI 166 <ul> 167 <li><a href="browserAction.html">Browser Actions</a></li> 168 <li><a href="contextMenus.html">Context Menus</a></li> 169 <li><a href="notifications.html">Desktop Notifications</a></li> 170 <li><a href="omnibox.html">Omnibox</a></li> 171 <li><a href="options.html">Options Pages</a></li> 172 <li><a href="override.html">Override Pages</a></li> 173 <li><a href="pageAction.html">Page Actions</a></li> 174 </ul> 175 </li> 176 <li>Browser Interaction 177 <ul> 178 <li><a href="bookmarks.html">Bookmarks</a></li> 179 <li><a href="cookies.html">Cookies</a></li> 180 <li><a href="events.html">Events</a></li> 181 <li><a href="history.html">History</a></li> 182 <li><a href="management.html">Management</a></li> 183 <li><a href="tabs.html">Tabs</a></li> 184 <li><a href="windows.html">Windows</a></li> 185 </ul> 186 </li> 187 <li>Implementation 188 <ul> 189 <li><a href="a11y.html">Accessibility</a></li> 190 <li><a href="background_pages.html">Background Pages</a></li> 191 <li><a href="content_scripts.html">Content Scripts</a></li> 192 <li><a href="xhr.html">Cross-Origin XHR</a></li> 193 <li><a href="idle.html">Idle</a></li> 194 <li><a href="i18n.html">Internationalization</a></li> 195 <li><a href="messaging.html">Message Passing</a></li> 196 <li><a href="npapi.html">NPAPI Plugins</a></li> 197 </ul> 198 </li> 199 <li>Finishing 200 <ul> 201 <li><a href="hosting.html">Hosting</a></li> 202 <li><a href="external_extensions.html">Other Deployment Options</a></li> 203 </ul> 204 </li> 205 </ul> 206 </li> 207 <li><h2><a href="apps.html">Packaged Apps</a></h2></li> 208 <li><h2><a href="tutorials.html">Tutorials</a></h2> 209 <ul> 210 <li><a href="tut_debugging.html">Debugging</a></li> 211 <li><a href="tut_analytics.html">Google Analytics</a></li> 212 <li><a href="tut_oauth.html">OAuth</a></li> 213 </ul> 214 </li> 215 <li><h2>Reference</h2> 216 <ul> 217 <li>Formats 218 <ul> 219 <li><a href="manifest.html">Manifest Files</a></li> 220 <li><a href="match_patterns.html">Match Patterns</a></li> 221 </ul> 222 </li> 223 <li><a href="permission_warnings.html">Permission Warnings</a></li> 224 <li><a href="api_index.html">chrome.* APIs</a></li> 225 <li><a href="api_other.html">Other APIs</a></li> 226 </ul> 227 </li> 228 <li><h2><a href="samples.html">Samples</a></h2></li> 229 <div class="line"> </div> 230 <li><h2>More</h2> 231 <ul> 232 <li><a href="http://code.google.com/chrome/webstore/docs/index.html">Chrome Web Store</a></li> 233 <li><a href="http://code.google.com/chrome/apps/docs/developers_guide.html">Hosted Apps</a></li> 234 <li><a href="themes.html">Themes</a></li> 235 </ul> 236 </li> 237 </ul> 238 </div> 239 <script> 240 initToggles(); 241 </script> 242 243 <div class="g-unit" id="gc-pagecontent"> 244 <div id="pageTitle"> 245 <h1 class="page_title" jscontent="getPageName()">chrome.apiname</h1> 246 </div> 247 <!-- TABLE OF CONTENTS --> 248 <div id="toc" jsdisplay="showPageTOC()"> 249 <h2>Contents</h2> 250 <ol> 251 <li jsselect="getStaticTOC()"> 252 <a jscontent="name" 253 jsvalues=".href:'#' + href">h2Name</a> 254 <ol> 255 <li jsselect="$this.children"> 256 <a jscontent="name" 257 jsvalues=".href:'#' + href">h3Name</a> 258 </li> 259 </ol> 260 </li> 261 <li jsselect="apiDefinition"> 262 <a href="#apiReference" jscontent="'API reference: ' + getModuleName()">API reference</a> 263 <ol> 264 <li jsdisplay="$this.properties"> 265 <a href="#properties">Properties</a> 266 <ol> 267 <li jsselect="getPropertyListFromObject($this)"> 268 <a jscontent="name" 269 jsvalues=".href:'#property-' + name" 270 href="#property-anchor">propertyName</a> 271 </li> 272 </ol> 273 </li> 274 <li jsdisplay="functions && functions.length > 0"> 275 <a jsvalues=".href:'#' + getAnchorName('global', 'methods')">Methods</a> 276 <ol> 277 <li jsselect="functions.sort(sortByName)" 278 jsdisplay="!($this.nodoc)"> 279 <a jscontent="name" 280 jsvalues=".href:'#' + getAnchorName('method', name)" 281 href="#method-anchor">methodName</a> 282 </li> 283 </ol> 284 </li> 285 <li jsdisplay="events && events.length > 0"> 286 <a jsvalues=".href:'#' + getAnchorName('global', 'events')">Events</a> 287 <ol> 288 <li jsselect="events.sort(sortByName)" 289 jsdisplay="!($this.nodoc)"> 290 <a jscontent="name" 291 jsvalues=".href:'#' + getAnchorName('event', name)" 292 href="#event-anchor">eventName</a> 293 </li> 294 </ol> 295 </li> 296 <li jsdisplay="types && types.length > 0"> 297 <a href="#types">Types</a> 298 <ol> 299 <li jsselect="types.sort(sortByName)"> 300 <a jscontent="id" 301 jsvalues=".href:'#type-' + id" 302 href="#id-anchor">id</a> 303 </li> 304 </ol> 305 </li> 306 </ol> 307 </li> 308 </ol> 309 </div> 310 <!-- /TABLE OF CONTENTS --> 311 312 <!-- Standard content lead-in for experimental API pages --> 313 <p jsdisplay="isExperimentalAPIPage();" id="classSummary"> 314 For information on how to use experimental APIs, see the <a href="experimental.html">chrome.experimental.* APIs</a> page. 315 </p> 316 317 <!-- STATIC CONTENT PLACEHOLDER --> 318 <div id="static"></div> 319 320 <!-- API PAGE --> 321 <div class="apiPage" jsselect="apiDefinition" jsvalues="$scope:''"> 322 <a name="apiReference"></a> 323 <h2 jscontent="'API reference: ' + getModuleName()">API reference: chrome.apiname </h2> 324 325 <!-- PROPERTIES --> 326 <div jsdisplay="$this.properties" class="apiGroup"> 327 <a name="properties"></a> 328 <h3 id="properties">Properties</h3> 329 330 <div jsselect="getPropertyListFromObject($this)"> 331 <a jsvalues=".name:'property-' + name"></a> 332 <h4 jscontent="name">getLastError</h4> 333 <div class="summary"> 334 <!-- Note: intentionally longer 80 columns --> 335 <span jscontent="getModuleName() + '.'">chrome.extension</span><span jscontent="$this.name">lastError</span> 336 </div> 337 <div transclude="valueTemplate"> 338 </div> 339 </div> 340 341 </div> <!-- /apiGroup --> 342 343 <!-- METHODS --> 344 <div id="methodsTemplate" class="apiGroup" 345 jsdisplay="$this.functions && $this.functions.length > 0"> 346 <a jsvalues=".name:getAnchorName('global', 'methods', $scope)"></a> 347 <h3 jscontent="$scope ? 'Methods of ' + $scope : 'Methods'">Methods</h3> 348 349 <!-- iterates over all functions --> 350 <div class="apiItem" jsselect="functions.sort(sortByName)" 351 jsdisplay="!($this.nodoc)"> 352 <a jsvalues=".name:getAnchorName('method', name, $scope)"></a> <!-- method-anchor --> 353 <h4 jscontent="name">method name</h4> 354 355 <div class="summary"><span jsdisplay="returns" jscontent="getTypeName(returns)">void</span> 356 <!-- Note: intentionally longer 80 columns --> 357 <span jscontent="getFullyQualifiedFunctionName($scope, $this)">chrome.module.methodName</span>(<span jsselect="parameters" jsvalues="class:optional ? 'optional' : ''"><span jsdisplay="$index">, </span><span jscontent="getTypeName($this)"></span> 358 <var><span jscontent="$this.name"></span></var></span>)</div> 359 360 <div class="description"> 361 <p class="todo" jsdisplay="!description">Undocumented.</p> 362 <p jsdisplay="description" jsvalues=".innerHTML:description"> 363 A description from the json schema def of the function goes here. 364 </p> 365 366 <!-- PARAMETERS --> 367 <h4 jsdisplay="$this.parameters && $this.parameters.length > 0">Parameters</h4> 368 <dl> 369 <div jsselect="parameters"> 370 <div transclude="valueTemplate"> 371 </div> 372 </div> 373 </dl> 374 375 <!-- RETURNS --> 376 <h4 jsdisplay="returns">Returns</h4> 377 <dl> 378 <div jsselect="returns"> 379 <div transclude="valueTemplate"> 380 </div> 381 </div> 382 </dl> 383 384 <!-- CALLBACK --> 385 <div jsdisplay="hasCallback(parameters)"> 386 <div jsselect="getCallbackParameters(parameters)"> 387 <h4>Callback function</h4> 388 <p jsdisplay="!$this.optional"> 389 The callback <em>parameter</em> should specify a function 390 that looks like this: 391 </p> 392 <p jsdisplay="$this.optional"> 393 If you specify the <em>callback</em> parameter, it should 394 specify a function that looks like this: 395 </p> 396 397 <!-- Note: intentionally longer 80 columns --> 398 <pre>function(<span jscontent="getSignatureString(parameters)">Type param1, Type param2</span>) <span class="subdued">{...}</span>;</pre> 399 <dl> 400 <div jsselect="parameters"> 401 <div transclude="valueTemplate"> 402 </div> 403 </div> 404 </dl> 405 </div> 406 </div> 407 408 <!-- MIN_VERSION --> 409 <p jsdisplay="min_version" > 410 This function was added in version <b><span jscontent="$this.min_version"></span></b>. 411 If you require this function, the manifest key 412 <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> 413 can ensure that your extension won't be run in an earlier browser version. 414 </p> 415 </div> <!-- /description --> 416 417 </div> <!-- /apiItem --> 418 419 </div> <!-- /apiGroup --> 420 421 <!-- EVENTS --> 422 <div id="eventsTemplate" class="apiGroup" 423 jsdisplay="$this.events && $this.events.length > 0"> 424 <a jsvalues=".name:getAnchorName('global', 'events', $scope)"></a> 425 <h3 jscontent="$scope ? 'Events of ' + $scope : 'Events'">Events</h3> 426 <!-- iterates over all events --> 427 <div class="apiItem" jsselect="$this.events.sort(sortByName)" 428 jsdisplay="!($this.nodoc)"> 429 <a jsvalues=".name:getAnchorName('event', name, $scope)"></a> 430 <h4 jscontent="name">event name</h4> 431 432 <div class="summary"> 433 <!-- Note: intentionally longer 80 columns --> 434 <span jscontent="(getObjectName($scope) || getModuleName()) + '.'" class="subdued">chrome.bookmarks</span><span jscontent="name">onEvent</span><span class="subdued">.addListener</span>(function(<span jscontent="getSignatureString($this.parameters)">Type param1, Type param2</span>) <span class="subdued">{...}</span>); 435 </div> 436 437 <div class="description"> 438 <p class="todo" jsdisplay="!description">Undocumented.</p> 439 <p jsdisplay="description" jsvalues=".innerHTML:description"> 440 A description from the json schema def of the event goes here. 441 </p> 442 443 <!-- PARAMETERS --> 444 <div jsdisplay="parameters && parameters.length > 0"> 445 <h4>Parameters</h4> 446 <dl> 447 <div jsselect="parameters"> 448 <div transclude="valueTemplate"> 449 </div> 450 </div> 451 </dl> 452 </div> 453 </div> <!-- /decription --> 454 455 </div> <!-- /apiItem --> 456 457 </div> <!-- /apiGroup --> 458 459 <!-- TYPES --> 460 <div jsdisplay="types && types.length > 0" class="apiGroup"> 461 <a name="types"></a> 462 <h3 id="types">Types</h3> 463 464 <!-- iterates over all types --> 465 <div jsselect="types.sort(sortByName)" class="apiItem"> 466 <a jsvalues=".name:'type-' + id"></a> 467 <h4 jscontent="id">type name</h4> 468 469 <div transclude="valueTemplate"> 470 </div> 471 472 </div> <!-- /apiItem --> 473 474 </div> <!-- /apiGroup --> 475 476 </div> <!-- /apiPage --> 477 </div> <!-- /gc-pagecontent --> 478 </div> <!-- /g-section --> 479 </div> <!-- /codesiteContent --> 480 <div id="gc-footer" --> 481 <div class="text"> 482 <p> 483 Except as otherwise <a 484 href="http://code.google.com/policies.html#restrictions">noted</a>, 485 the content of this page is licensed under the <a rel="license" 486 href="http://creativecommons.org/licenses/by/3.0/">Creative Commons 487 Attribution 3.0 License</a>, and code samples are licensed under the 488 <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. 489 </p> 490 <p> 491 ©2011 Google 492 </p> 493 494 <!-- begin analytics --> 495 <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script> 496 <script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script> 497 498 <script type="text/javascript"> 499 // chrome doc tracking 500 try { 501 var engdocs = _gat._getTracker("YT-10763712-2"); 502 engdocs._trackPageview(); 503 } catch(err) {} 504 505 // code.google.com site-wide tracking 506 try { 507 _uacct="UA-18071-1"; 508 _uanchor=1; 509 _uff=0; 510 urchinTracker(); 511 } 512 catch(e) {/* urchinTracker not available. */} 513 </script> 514 <!-- end analytics --> 515 </div> 516 </div> <!-- /gc-footer --> 517 </div> <!-- /gc-container --> 518