Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "WakeLockListener.h"
6 #include "MetroUtils.h"
8 using namespace mozilla::widget::winrt;
10 NS_IMPL_ISUPPORTS(WakeLockListener, nsIDOMMozWakeLockListener)
12 NS_IMETHODIMP
13 WakeLockListener::Callback(const nsAString& aTopic, const nsAString& aState)
14 {
15 if (!mDisplayRequest) {
16 if (FAILED(ActivateGenericInstance(RuntimeClass_Windows_System_Display_DisplayRequest, mDisplayRequest))) {
17 NS_WARNING("Failed to instantiate IDisplayRequest, wakelocks will be broken!");
18 return NS_OK;
19 }
20 }
22 if (aState.Equals(NS_LITERAL_STRING("locked-foreground"))) {
23 mDisplayRequest->RequestActive();
24 } else {
25 mDisplayRequest->RequestRelease();
26 }
28 return NS_OK;
29 }