1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:expandtab:shiftwidth=2:tabstop=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/. */
8 #ifndef __WakeLockListener_h__
9 #define __WakeLockListener_h__
11 #include "nsHashKeys.h"
12 #include "nsRefPtrHashtable.h"
14 #include "nsIDOMWakeLockListener.h"
19 * Receives WakeLock events and simply passes it on to the right WakeLockTopic
20 * to inhibit the screensaver.
22 class WakeLockListener final
: public nsIDOMMozWakeLockListener
{
26 nsresult
Callback(const nsAString
& topic
, const nsAString
& state
) override
;
33 // Map of topic names to |WakeLockTopic|s.
34 // We assume a small, finite-sized set of topics.
35 nsRefPtrHashtable
<nsStringHashKey
, WakeLockTopic
> mTopics
;
38 #endif // __WakeLockListener_h__