1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/webidl/MozPowerManager.webidl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,76 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +interface MozWakeLockListener; 1.10 + 1.11 +/** 1.12 + * This interface implements navigator.mozPower 1.13 + */ 1.14 +interface MozPowerManager 1.15 +{ 1.16 + [Throws] 1.17 + void powerOff(); 1.18 + [Throws] 1.19 + void reboot(); 1.20 + void factoryReset(); 1.21 + 1.22 + /** 1.23 + * The listeners are notified when a resource changes its lock state to: 1.24 + * - unlocked 1.25 + * - locked but not visible 1.26 + * - locked and visible 1.27 + */ 1.28 + void addWakeLockListener(MozWakeLockListener aListener); 1.29 + void removeWakeLockListener(MozWakeLockListener aListener); 1.30 + 1.31 + /** 1.32 + * Query the wake lock state of the topic. 1.33 + * 1.34 + * Possible states are: 1.35 + * 1.36 + * - "unlocked" - nobody holds the wake lock. 1.37 + * 1.38 + * - "locked-foreground" - at least one window holds the wake lock, 1.39 + * and it is visible. 1.40 + * 1.41 + * - "locked-background" - at least one window holds the wake lock, 1.42 + * but all of them are hidden. 1.43 + * 1.44 + * @param aTopic The resource name related to the wake lock. 1.45 + */ 1.46 + [Throws] 1.47 + DOMString getWakeLockState(DOMString aTopic); 1.48 + 1.49 + /** 1.50 + * Is the device's screen currently enabled? This attribute controls the 1.51 + * device's screen, so setting it to false will turn off the screen. 1.52 + */ 1.53 + attribute boolean screenEnabled; 1.54 + 1.55 + /** 1.56 + * How bright is the screen's backlight, on a scale from 0 (very dim) to 1 1.57 + * (full brightness)? Setting this attribute modifies the screen's 1.58 + * brightness. 1.59 + * 1.60 + * You can read and write this attribute even when the screen is disabled, 1.61 + * but the backlight is off while the screen is disabled. 1.62 + * 1.63 + * If you write a value of X into this attribute, the attribute may not have 1.64 + * the same value X when you later read it. Most screens don't support as 1.65 + * many different brightness levels as there are doubles between 0 and 1, so 1.66 + * we may reduce the value's precision before storing it. 1.67 + * 1.68 + * @throw NS_ERROR_INVALID_ARG if brightness is not in the range [0, 1]. 1.69 + */ 1.70 + [SetterThrows] 1.71 + attribute double screenBrightness; 1.72 + 1.73 + /** 1.74 + * Is it possible that the device's CPU will sleep after the screen is 1.75 + * disabled? Setting this attribute to false will prevent the device 1.76 + * entering suspend state. 1.77 + */ 1.78 + attribute boolean cpuSleepAllowed; 1.79 +};