Bug 1931425 - Limit how often moz-label's #setStyles runs r=reusable-components-revie...
[gecko.git] / widget / gtk / WakeLockListener.h
blob1c587d2302c816d7bea2458e807862a756e943b3
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:expandtab:shiftwidth=2:tabstop=2:
3 */
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"
16 class WakeLockTopic;
18 /**
19 * Receives WakeLock events and simply passes it on to the right WakeLockTopic
20 * to inhibit the screensaver.
22 class WakeLockListener final : public nsIDOMMozWakeLockListener {
23 public:
24 NS_DECL_ISUPPORTS;
26 nsresult Callback(const nsAString& topic, const nsAString& state) override;
28 WakeLockListener();
30 private:
31 ~WakeLockListener();
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__