idle.html revision 731df977c0511bca2206b5f333555b1205ff1f43
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/jstemplate_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  <title>Idle - Google Chrome Extensions - Google Code</title></head>
19  <body>  <div id="gc-container" class="labs">
20      <div id="devModeWarning">
21        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.
22      </div>
23      <!-- SUBTEMPLATES: DO NOT MOVE FROM THIS LOCATION -->
24      <!-- In particular, sub-templates that recurse, must be used by allowing
25           jstemplate to make a copy of the template in this section which
26           are not operated on by way of the jsskip="true" -->
27      <div style="display:none">
28
29        <!-- VALUE -->
30        <div id="valueTemplate">
31          <dt>
32            <var>paramName</var>
33              <em>
34
35                <!-- TYPE -->
36                <div style="display:inline">
37                  (
38                    <span class="optional">optional</span>
39                    <span class="enum">enumerated</span>
40                    <span id="typeTemplate">
41                      <span>
42                        <a> Type</a>
43                      </span>
44                      <span>
45                        <span>
46                          array of <span><span></span></span>
47                        </span>
48                        <span>paramType</span>
49                        <span></span>
50                      </span>
51                    </span>
52                  )
53                </div>
54
55              </em>
56          </dt>
57          <dd class="todo">
58            Undocumented.
59          </dd>
60          <dd>
61            Description of this parameter from the json schema.
62          </dd>
63          <dd>
64            This parameter was added in version
65            <b><span></span></b>.
66            You must omit this parameter in earlier versions,
67            and you may omit it in any version.  If you require this
68            parameter, the manifest key
69            <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a>
70            can ensure that your extension won't be run in an earlier browser version.
71          </dd>
72
73          <!-- OBJECT PROPERTIES -->
74          <dd>
75            <dl>
76              <div>
77                <div>
78                </div>
79              </div>
80            </dl>
81          </dd>
82
83          <!-- FUNCTION PARAMETERS -->
84          <dd>
85            <div></div>
86          </dd>
87
88        </div> <!-- /VALUE -->
89
90        <div id="functionParametersTemplate">
91          <h5>Parameters</h5>
92          <dl>
93            <div>
94              <div>
95              </div>
96            </div>
97          </dl>         
98        </div>
99      </div> <!-- /SUBTEMPLATES -->
100
101  <a id="top"></a>
102    <div id="skipto">
103      <a href="#gc-pagecontent">Skip to page content</a>
104      <a href="#gc-toc">Skip to main navigation</a>
105    </div>
106    <!-- API HEADER -->
107    <table id="header" width="100%" cellspacing="0" border="0">
108      <tbody><tr>
109        <td valign="middle"><a href="http://code.google.com/"><img src="images/code_labs_logo.gif" height="43" width="161" alt="Google Code Labs" style="border:0; margin:0;"></a></td>
110        <td valign="middle" width="100%" style="padding-left:0.6em;">
111          <form action="http://www.google.com/cse" id="cse" style="margin-top:0.5em">
112            <div id="gsc-search-box">
113              <input type="hidden" name="cx" value="002967670403910741006:61_cvzfqtno">
114              <input type="hidden" name="ie" value="UTF-8">
115              <input type="text" name="q" value="" size="55">
116              <input class="gsc-search-button" type="submit" name="sa" value="Search">
117              <br>
118              <span class="greytext">e.g. "page action" or "tabs"</span>
119            </div>
120          </form>
121
122          <script type="text/javascript" src="http://www.google.com/jsapi"></script>
123          <script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script>
124          <script type="text/javascript" src="http://www.google.com/coop/cse/t13n?form=cse&t13n_langs=en"></script>
125          <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse&lang=en"></script>
126        </td>
127      </tr>
128    </tbody></table>
129
130    <div id="codesiteContent" class="">
131
132      <a id="gc-topnav-anchor"></a>
133      <div id="gc-topnav">
134        <h1>Google Chrome Extensions (<a href="http://code.google.com/labs/">Labs</a>)</h1>
135        <ul id="home" class="gc-topnav-tabs">
136          <li id="home_link">
137            <a href="index.html" title="Google Chrome Extensions home page">Home</a>
138          </li>
139          <li id="docs_link">
140            <a href="docs.html" title="Official Google Chrome Extensions documentation">Docs</a>
141          </li>
142          <li id="faq_link">
143            <a href="faq.html" title="Answers to frequently asked questions about Google Chrome Extensions">FAQ</a>
144          </li>
145          <li id="samples_link">
146            <a href="samples.html" title="Sample extensions (with source code)">Samples</a>
147          </li>
148          <li id="group_link">
149            <a href="http://groups.google.com/a/chromium.org/group/chromium-extensions" title="Google Chrome Extensions developer forum">Group</a>
150          </li>
151        </ul>
152      </div> <!-- end gc-topnav -->
153
154    <div class="g-section g-tpl-170">
155      <!-- SIDENAV -->
156      <div class="g-unit g-first" id="gc-toc">
157        <ul>
158          <li><a href="getstarted.html">Getting Started</a></li>
159          <li><a href="overview.html">Overview</a></li>
160          <li><a href="whats_new.html">What's New?</a></li>
161          <li><h2><a href="devguide.html">Developer's Guide</a></h2>
162            <ul>
163              <li>Browser UI
164                <ul>
165                  <li><a href="browserAction.html">Browser Actions</a></li>
166                  <li><a href="contextMenus.html">Context Menus</a></li>
167                  <li><a href="notifications.html">Desktop Notifications</a></li>
168                  <li><a href="options.html">Options Pages</a></li>
169                  <li><a href="override.html">Override Pages</a></li>
170                  <li><a href="pageAction.html">Page Actions</a></li>
171                  <li><a href="themes.html">Themes</a></li>
172                </ul>
173              </li>
174              <li>Browser Interaction
175                <ul>
176                  <li><a href="bookmarks.html">Bookmarks</a></li>
177                  <li><a href="cookies.html">Cookies</a></li>
178                  <li><a href="events.html">Events</a></li>
179                  <li><a href="history.html">History</a></li>
180                  <li><a href="management.html">Management</a></li>
181                  <li><a href="tabs.html">Tabs</a></li>
182                  <li><a href="windows.html">Windows</a></li>
183                </ul>
184              </li>
185              <li>Implementation
186                <ul>
187                  <li><a href="a11y.html">Accessibility</a></li>
188                  <li><a href="background_pages.html">Background Pages</a></li>
189                  <li><a href="content_scripts.html">Content Scripts</a></li>
190                  <li><a href="xhr.html">Cross-Origin XHR</a></li>
191                  <li class="leftNavSelected">Idle</li>
192                  <li><a href="i18n.html">Internationalization</a></li>
193                  <li><a href="messaging.html">Message Passing</a></li>
194                  <li><a href="npapi.html">NPAPI Plugins</a></li>
195                </ul>
196              </li>
197              <li>Finishing
198                <ul>
199                  <li><a href="hosting.html">Hosting</a></li>
200                  <li><a href="external_extensions.html">Other Deployment Options</a></li>
201                </ul>
202              </li>
203            </ul>
204          </li>
205          <li><h2><a href="tutorials.html">Tutorials</a></h2>
206            <ul>
207              <li><a href="tut_debugging.html">Debugging</a></li>
208              <li><a href="tut_analytics.html">Google Analytics</a></li>
209              <li><a href="tut_oauth.html">OAuth</a></li>
210            </ul>
211          </li>
212          <li><h2>Reference</h2>
213            <ul>
214              <li>Formats
215                <ul>
216                  <li><a href="manifest.html">Manifest Files</a></li>
217                  <li><a href="match_patterns.html">Match Patterns</a></li>
218                  <!-- <li>Packages (.crx)</li> -->
219                </ul>
220              </li>
221              <li><a href="api_index.html">chrome.* APIs</a></li>
222              <li><a href="api_other.html">Other APIs</a></li>
223            </ul>
224          </li>
225         <li><h2><a href="samples.html">Samples</a></h2></li>
226        </ul>
227      </div>
228
229    <div class="g-unit" id="gc-pagecontent">
230      <div id="pageTitle">
231        <h1 class="page_title">Idle</h1>
232      </div>
233        <!-- TABLE OF CONTENTS -->
234        <div id="toc">
235          <h2>Contents</h2>
236          <ol>
237            <li>
238              <a href="#manifest">Manifest</a>
239              <ol>
240                <li style="display: none; ">
241                  <a>h3Name</a>
242                </li>
243              </ol>
244            </li>
245              <li>
246                <a href="#apiReference">API reference: chrome.idle</a>
247                <ol>
248                  <li style="display: none; ">
249                    <a href="#properties">Properties</a>
250                    <ol>
251                      <li>
252                        <a href="#property-anchor">propertyName</a>
253                      </li>
254                    </ol>
255                  </li>
256                  <li>
257                    <a href="#methods">Methods</a>
258                    <ol>
259                      <li>
260                        <a href="#method-queryState">queryState</a>
261                      </li>
262                    </ol>
263                  </li>
264                  <li>
265                    <a href="#events">Events</a>
266                    <ol>
267                      <li>
268                        <a href="#event-onStateChanged">onStateChanged</a>
269                      </li>
270                    </ol>
271                  </li>
272                  <li style="display: none; ">
273                    <a href="#types">Types</a>
274                    <ol>
275                      <li>
276                        <a href="#id-anchor">id</a>
277                      </li>
278                    </ol>
279                  </li>
280                </ol>
281              </li>
282          </ol>
283        </div>
284        <!-- /TABLE OF CONTENTS -->
285
286        <!-- Standard content lead-in for experimental API pages -->
287        <p id="classSummary" style="display: none; ">
288          For information on how to use experimental APIs, see the <a href="experimental.html">chrome.experimental.* APIs</a> page.
289        </p>
290
291        <!-- STATIC CONTENT PLACEHOLDER -->
292        <div id="static"><div id="pageData-name" class="pageData">Idle</div>
293
294<!-- BEGIN AUTHORED CONTENT -->
295<h2 id="manifest">Manifest</h2>
296<p>You must declare the "idle" permission in your extension's manifest to use the idle API.
297For example:
298</p>
299
300<pre>{
301  "name": "My extension",
302  ...
303  <b>"permissions": [
304    "idle"
305  ]</b>,
306  ...
307}</pre>
308
309<!-- END AUTHORED CONTENT -->
310</div>
311
312        <!-- API PAGE -->
313        <div class="apiPage">
314        <a name="apiReference"></a>
315        <h2>API reference: chrome.idle</h2>
316
317          <!-- PROPERTIES -->
318          <div class="apiGroup" style="display: none; ">
319            <a name="properties"></a>
320            <h3 id="properties">Properties</h3>
321
322            <div>
323              <a></a>
324              <h4>getLastError</h4>
325              <div class="summary">
326                <!-- Note: intentionally longer 80 columns -->
327                <span>chrome.extension</span><span>lastError</span>
328              </div>
329              <div>
330              </div>
331            </div>
332
333          </div> <!-- /apiGroup -->
334
335          <!-- METHODS -->
336          <div class="apiGroup" id="methods">
337            <a name="methods"></a>
338            <h3>Methods</h3>
339
340            <!-- iterates over all functions -->
341            <div class="apiItem">
342              <a name="method-queryState"></a> <!-- method-anchor -->
343              <h4>queryState</h4>
344
345              <div class="summary"><span style="display: none; ">void</span>
346                  <!-- Note: intentionally longer 80 columns -->
347                  <span>chrome.idle.queryState</span>(<span class="null"><span style="display: none; ">, </span><span>integer</span>
348                      <var><span>thresholdSeconds</span></var></span><span class="null"><span>, </span><span>function</span>
349                      <var><span>callback</span></var></span>)</div>
350
351              <div class="description">
352                <p class="todo" style="display: none; ">Undocumented.</p>
353                <p>Returns the current state of the browser.</p>
354
355                <!-- PARAMETERS -->
356                <h4>Parameters</h4>
357                <dl>
358                  <div>
359                    <div>
360          <dt>
361            <var>thresholdSeconds</var>
362              <em>
363
364                <!-- TYPE -->
365                <div style="display:inline">
366                  (
367                    <span class="optional" style="display: none; ">optional</span>
368                    <span class="enum" style="display: none; ">enumerated</span>
369                    <span id="typeTemplate">
370                      <span style="display: none; ">
371                        <a> Type</a>
372                      </span>
373                      <span>
374                        <span style="display: none; ">
375                          array of <span><span></span></span>
376                        </span>
377                        <span>integer</span>
378                        <span style="display: none; "></span>
379                      </span>
380                    </span>
381                  )
382                </div>
383
384              </em>
385          </dt>
386          <dd class="todo" style="display: none; ">
387            Undocumented.
388          </dd>
389          <dd>Threshold, in seconds, used to determine when a machine is in the idle state.</dd>
390          <dd style="display: none; ">
391            This parameter was added in version
392            <b><span></span></b>.
393            You must omit this parameter in earlier versions,
394            and you may omit it in any version.  If you require this
395            parameter, 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          </dd>
399
400          <!-- OBJECT PROPERTIES -->
401          <dd style="display: none; ">
402            <dl>
403              <div>
404                <div>
405                </div>
406              </div>
407            </dl>
408          </dd>
409
410          <!-- FUNCTION PARAMETERS -->
411          <dd style="display: none; ">
412            <div></div>
413          </dd>
414
415        </div>
416                  </div><div>
417                    <div>
418          <dt>
419            <var>callback</var>
420              <em>
421
422                <!-- TYPE -->
423                <div style="display:inline">
424                  (
425                    <span class="optional" style="display: none; ">optional</span>
426                    <span class="enum" style="display: none; ">enumerated</span>
427                    <span id="typeTemplate">
428                      <span style="display: none; ">
429                        <a> Type</a>
430                      </span>
431                      <span>
432                        <span style="display: none; ">
433                          array of <span><span></span></span>
434                        </span>
435                        <span>function</span>
436                        <span style="display: none; "></span>
437                      </span>
438                    </span>
439                  )
440                </div>
441
442              </em>
443          </dt>
444          <dd class="todo">
445            Undocumented.
446          </dd>
447          <dd style="display: none; ">
448            Description of this parameter from the json schema.
449          </dd>
450          <dd style="display: none; ">
451            This parameter was added in version
452            <b><span></span></b>.
453            You must omit this parameter in earlier versions,
454            and you may omit it in any version.  If you require this
455            parameter, the manifest key
456            <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a>
457            can ensure that your extension won't be run in an earlier browser version.
458          </dd>
459
460          <!-- OBJECT PROPERTIES -->
461          <dd style="display: none; ">
462            <dl>
463              <div>
464                <div>
465                </div>
466              </div>
467            </dl>
468          </dd>
469
470          <!-- FUNCTION PARAMETERS -->
471          <dd style="display: none; ">
472            <div></div>
473          </dd>
474
475        </div>
476                  </div>
477                </dl>
478
479                <!-- RETURNS -->
480                <h4 style="display: none; ">Returns</h4>
481                <dl>
482                  <div style="display: none; ">
483                    <div>
484                    </div>
485                  </div>
486                </dl>
487
488                <!-- CALLBACK -->
489                <div>
490                  <div>
491                  <h4>Callback function</h4>
492                  <p>
493                    The callback <em>parameter</em> should specify a function
494                    that looks like this:
495                  </p>
496                  <p style="display: none; ">
497                    If you specify the <em>callback</em> parameter, it should
498                    specify a function that looks like this:
499                  </p>
500
501                  <!-- Note: intentionally longer 80 columns -->
502                  <pre>function(<span>string newState</span>) <span class="subdued">{...}</span>;</pre>
503                  <dl>
504                    <div>
505                      <div>
506          <dt>
507            <var>newState</var>
508              <em>
509
510                <!-- TYPE -->
511                <div style="display:inline">
512                  (
513                    <span class="optional" style="display: none; ">optional</span>
514                    <span class="enum">enumerated</span>
515                    <span id="typeTemplate">
516                      <span style="display: none; ">
517                        <a> Type</a>
518                      </span>
519                      <span>
520                        <span style="display: none; ">
521                          array of <span><span></span></span>
522                        </span>
523                        <span>string</span>
524                        <span>["active", "idle", "locked"]</span>
525                      </span>
526                    </span>
527                  )
528                </div>
529
530              </em>
531          </dt>
532          <dd class="todo">
533            Undocumented.
534          </dd>
535          <dd style="display: none; ">
536            Description of this parameter from the json schema.
537          </dd>
538          <dd style="display: none; ">
539            This parameter was added in version
540            <b><span></span></b>.
541            You must omit this parameter in earlier versions,
542            and you may omit it in any version.  If you require this
543            parameter, the manifest key
544            <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a>
545            can ensure that your extension won't be run in an earlier browser version.
546          </dd>
547
548          <!-- OBJECT PROPERTIES -->
549          <dd style="display: none; ">
550            <dl>
551              <div>
552                <div>
553                </div>
554              </div>
555            </dl>
556          </dd>
557
558          <!-- FUNCTION PARAMETERS -->
559          <dd style="display: none; ">
560            <div></div>
561          </dd>
562
563        </div>
564                    </div>
565                  </dl>
566                  </div>
567                </div>
568
569                <!-- MIN_VERSION -->
570                <p style="display: none; ">
571                  This function was added in version <b><span></span></b>.
572                  If you require this function, the manifest key
573                  <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a>
574                  can ensure that your extension won't be run in an earlier browser version.
575                </p>
576              </div> <!-- /description -->
577
578            </div>  <!-- /apiItem -->
579
580          </div>  <!-- /apiGroup -->
581
582          <!-- EVENTS -->
583          <div class="apiGroup">
584            <a name="events"></a>
585            <h3 id="events">Events</h3>
586
587            <!-- iterates over all events -->
588            <div class="apiItem">
589              <a name="event-onStateChanged"></a>
590              <h4>onStateChanged</h4>
591
592              <div class="summary">
593                <!-- Note: intentionally longer 80 columns -->
594                <span class="subdued">chrome.idle.</span><span>onStateChanged</span><span class="subdued">.addListener</span>(function(<span>string newState</span>) <span class="subdued">{...}</span>);
595              </div>
596
597              <div class="description">
598                <p class="todo" style="display: none; ">Undocumented.</p>
599                <p>Fired when the browser changes to an active state.  Currently only reports the transition from idle to active.</p>
600
601                <!-- PARAMETERS -->
602                <h4>Parameters</h4>
603                <dl>
604                  <div>
605                    <div>
606          <dt>
607            <var>newState</var>
608              <em>
609
610                <!-- TYPE -->
611                <div style="display:inline">
612                  (
613                    <span class="optional" style="display: none; ">optional</span>
614                    <span class="enum">enumerated</span>
615                    <span id="typeTemplate">
616                      <span style="display: none; ">
617                        <a> Type</a>
618                      </span>
619                      <span>
620                        <span style="display: none; ">
621                          array of <span><span></span></span>
622                        </span>
623                        <span>string</span>
624                        <span>["active"]</span>
625                      </span>
626                    </span>
627                  )
628                </div>
629
630              </em>
631          </dt>
632          <dd class="todo">
633            Undocumented.
634          </dd>
635          <dd style="display: none; ">
636            Description of this parameter from the json schema.
637          </dd>
638          <dd style="display: none; ">
639            This parameter was added in version
640            <b><span></span></b>.
641            You must omit this parameter in earlier versions,
642            and you may omit it in any version.  If you require this
643            parameter, the manifest key
644            <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a>
645            can ensure that your extension won't be run in an earlier browser version.
646          </dd>
647
648          <!-- OBJECT PROPERTIES -->
649          <dd style="display: none; ">
650            <dl>
651              <div>
652                <div>
653                </div>
654              </div>
655            </dl>
656          </dd>
657
658          <!-- FUNCTION PARAMETERS -->
659          <dd style="display: none; ">
660            <div></div>
661          </dd>
662
663        </div>
664                  </div>
665                </dl>
666
667              </div> <!-- /decription -->
668
669            </div> <!-- /apiItem -->
670
671          </div> <!-- /apiGroup -->
672
673          <!-- TYPES -->
674          <div class="apiGroup" style="display: none; ">
675            <a name="types"></a>
676            <h3 id="types">Types</h3>
677
678            <!-- iterates over all types -->
679            <div class="apiItem">
680              <a></a>
681              <h4>type name</h4>
682
683              <div>
684              </div>
685
686            </div> <!-- /apiItem -->
687
688          </div> <!-- /apiGroup -->
689
690        </div> <!-- /apiPage -->
691      </div> <!-- /gc-pagecontent -->
692    </div> <!-- /g-section -->
693  </div> <!-- /codesiteContent -->
694    <div id="gc-footer" --="">
695      <div class="text">
696  <p>
697  Except as otherwise <a href="http://code.google.com/policies.html#restrictions">noted</a>,
698  the content of this page is licensed under the <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons
699  Attribution 3.0 License</a>, and code samples are licensed under the
700  <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
701  </p>
702  <p>
703  ©2010 Google
704  </p>
705
706<!-- begin analytics -->
707<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
708<script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script>
709
710<script type="text/javascript">
711  // chrome doc tracking
712  try {
713    var engdocs = _gat._getTracker("YT-10763712-2");
714    engdocs._trackPageview();
715  } catch(err) {}
716
717  // code.google.com site-wide tracking
718  try {
719    _uacct="UA-18071-1";
720    _uanchor=1;
721    _uff=0;
722    urchinTracker();
723  }
724  catch(e) {/* urchinTracker not available. */}
725</script>
726<!-- end analytics -->
727      </div>
728    </div> <!-- /gc-footer -->
729  </div> <!-- /gc-container -->
730</body></html>
731