1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
11 #include "mozilla/Attributes.h"
12 #include "nsIScreen.h"
14 class nsBaseScreen
: public nsIScreen
21 // nsIScreen interface
23 // These simply forward to the device-pixel versions;
24 // implementations where global display pixels may not correspond
25 // to per-screen device pixels must override.
26 NS_IMETHOD
GetRectDisplayPix(int32_t *outLeft
, int32_t *outTop
,
27 int32_t *outWidth
, int32_t *outHeight
);
28 NS_IMETHOD
GetAvailRectDisplayPix(int32_t *outLeft
, int32_t *outTop
,
29 int32_t *outWidth
, int32_t *outHeight
);
32 * Simple management of screen brightness locks. This abstract base class
33 * allows all widget implementations to share brightness locking code.
35 NS_IMETHOD
LockMinimumBrightness(uint32_t aBrightness
);
36 NS_IMETHOD
UnlockMinimumBrightness(uint32_t aBrightness
);
38 NS_IMETHOD
GetRotation(uint32_t* aRotation
) {
39 *aRotation
= nsIScreen::ROTATION_0_DEG
;
42 NS_IMETHOD
SetRotation(uint32_t aRotation
) { return NS_ERROR_NOT_AVAILABLE
; }
44 NS_IMETHOD
GetContentsScaleFactor(double* aContentsScaleFactor
);
47 virtual ~nsBaseScreen();
50 * Manually set the current level of brightness locking. This is called after
51 * we determine, based on the current active locks, what the strongest
52 * lock is. You should normally not call this function - it will be
53 * called automatically by this class.
55 * Each widget implementation should implement this in a way that
56 * makes sense there. This is normally the only function that
57 * contains widget-specific code.
59 * The default implementation does nothing.
61 * @param aBrightness The current brightness level to set. If this is
62 * nsIScreen::BRIGHTNESS_LEVELS
63 * (an impossible value for a brightness level to be),
64 * then that signifies that there is no current
65 * minimum brightness level, and the screen can shut off.
67 virtual void ApplyMinimumBrightness(uint32_t aBrightness
) { }
71 * Checks what the minimum brightness value is, and calls
72 * ApplyMinimumBrightness.
74 void CheckMinimumBrightness();
76 uint32_t mBrightnessLocks
[nsIScreen::BRIGHTNESS_LEVELS
];
79 #endif // nsBaseScreen_h