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