dom/webidl/MozPowerManager.webidl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 interface MozWakeLockListener;
michael@0 7
michael@0 8 /**
michael@0 9 * This interface implements navigator.mozPower
michael@0 10 */
michael@0 11 interface MozPowerManager
michael@0 12 {
michael@0 13 [Throws]
michael@0 14 void powerOff();
michael@0 15 [Throws]
michael@0 16 void reboot();
michael@0 17 void factoryReset();
michael@0 18
michael@0 19 /**
michael@0 20 * The listeners are notified when a resource changes its lock state to:
michael@0 21 * - unlocked
michael@0 22 * - locked but not visible
michael@0 23 * - locked and visible
michael@0 24 */
michael@0 25 void addWakeLockListener(MozWakeLockListener aListener);
michael@0 26 void removeWakeLockListener(MozWakeLockListener aListener);
michael@0 27
michael@0 28 /**
michael@0 29 * Query the wake lock state of the topic.
michael@0 30 *
michael@0 31 * Possible states are:
michael@0 32 *
michael@0 33 * - "unlocked" - nobody holds the wake lock.
michael@0 34 *
michael@0 35 * - "locked-foreground" - at least one window holds the wake lock,
michael@0 36 * and it is visible.
michael@0 37 *
michael@0 38 * - "locked-background" - at least one window holds the wake lock,
michael@0 39 * but all of them are hidden.
michael@0 40 *
michael@0 41 * @param aTopic The resource name related to the wake lock.
michael@0 42 */
michael@0 43 [Throws]
michael@0 44 DOMString getWakeLockState(DOMString aTopic);
michael@0 45
michael@0 46 /**
michael@0 47 * Is the device's screen currently enabled? This attribute controls the
michael@0 48 * device's screen, so setting it to false will turn off the screen.
michael@0 49 */
michael@0 50 attribute boolean screenEnabled;
michael@0 51
michael@0 52 /**
michael@0 53 * How bright is the screen's backlight, on a scale from 0 (very dim) to 1
michael@0 54 * (full brightness)? Setting this attribute modifies the screen's
michael@0 55 * brightness.
michael@0 56 *
michael@0 57 * You can read and write this attribute even when the screen is disabled,
michael@0 58 * but the backlight is off while the screen is disabled.
michael@0 59 *
michael@0 60 * If you write a value of X into this attribute, the attribute may not have
michael@0 61 * the same value X when you later read it. Most screens don't support as
michael@0 62 * many different brightness levels as there are doubles between 0 and 1, so
michael@0 63 * we may reduce the value's precision before storing it.
michael@0 64 *
michael@0 65 * @throw NS_ERROR_INVALID_ARG if brightness is not in the range [0, 1].
michael@0 66 */
michael@0 67 [SetterThrows]
michael@0 68 attribute double screenBrightness;
michael@0 69
michael@0 70 /**
michael@0 71 * Is it possible that the device's CPU will sleep after the screen is
michael@0 72 * disabled? Setting this attribute to false will prevent the device
michael@0 73 * entering suspend state.
michael@0 74 */
michael@0 75 attribute boolean cpuSleepAllowed;
michael@0 76 };

mercurial