widget/windows/winrt/WakeLockListener.cpp

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     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 }

mercurial