Disable partial flat closures pending scope chain reconstruction on trace (554572...
[mozilla-central.git] / widget / public / nsIIdleService.idl
blob70e8d3a3f7a48df67923aa17ebbe2e3137a3e0e5
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
16 * The Original Code is mozilla.org code.
18 * The Initial Developer of the Original Code is
19 * Gijs Kruitbosch <gijskruitbosch@gmail.com>
20 * Portions created by the Initial Developer are Copyright (C) 2007
21 * the Initial Developer. All Rights Reserved.
23 * Contributor(s):
24 * Gijs Kruitbosch <gijskruitbosch@gmail.com>
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
40 #include "nsISupports.idl"
41 interface nsIObserver;
43 /**
44 * This interface lets you monitor how long the user has been 'idle',
45 * i.e. not used their mouse or keyboard. You can get the idle time directly,
46 * but in most cases you will want to register an observer for a predefined
47 * interval. The observer will get an 'idle' notification when the user is idle
48 * for that interval (or longer), and receive a 'back' notification when the
49 * user starts using their computer again.
52 [scriptable, uuid(cc52f19a-63ae-4a1c-9cc3-e79eace0b471)]
53 interface nsIIdleService : nsISupports
55 /**
56 * The amount of time in milliseconds that has passed
57 * since the last user activity.
59 readonly attribute unsigned long idleTime;
61 /**
62 * Add an observer to be notified when the user idles for some period of
63 * time, and when they get back from that.
65 * @param observer the observer to be notified
66 * @param time the amount of time in seconds the user should be idle before
67 * the observer should be notified.
69 * @note
70 * The subject of the notification the observer will get is always the
71 * nsIIdleService itself.
72 * When the user goes idle, the observer topic is "idle" and when they get
73 * back, the observer topic is "back".
74 * The data param for the notification contains the current user idle time.
76 * @note
77 * You can add the same observer twice.
78 * @note
79 * Most implementations need to poll the OS for idle info themselves,
80 * meaning your notifications could arrive with a delay up to the length
81 * of the polling interval in that implementation.
82 * Current implementations use a delay of 5 seconds.
84 void addIdleObserver(in nsIObserver observer, in unsigned long time);
86 /**
87 * Remove an observer registered with addIdleObserver.
88 * @param observer the observer that needs to be removed.
89 * @param time the amount of time they were listening for.
90 * @note
91 * Removing an observer will remove it once, for the idle time you specify.
92 * If you have added an observer multiple times, you will need to remove it
93 * just as many times.
95 void removeIdleObserver(in nsIObserver observer, in unsigned long time);