Bug 1812348 [wpt PR 38171] - wake lock: Move tests in web_tests/wake-lock to either...
[gecko.git] / widget / android / AndroidAlerts.h
blobf4a9822dc1a7bf38270cb479f2c0141332b94ddf
1 /* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_widget_AndroidAlerts_h__
7 #define mozilla_widget_AndroidAlerts_h__
9 #include "nsTHashMap.h"
10 #include "nsInterfaceHashtable.h"
11 #include "nsCOMPtr.h"
12 #include "nsHashKeys.h"
13 #include "nsIAlertsService.h"
14 #include "nsIObserver.h"
16 #include "mozilla/java/WebNotificationWrappers.h"
18 #include "mozilla/StaticPtr.h"
20 namespace mozilla {
21 namespace widget {
23 class AndroidAlerts : public nsIAlertsService {
24 public:
25 NS_DECL_ISUPPORTS
26 NS_DECL_NSIALERTSSERVICE
28 AndroidAlerts() {}
30 static void NotifyListener(const nsAString& aName, const char* aTopic,
31 const char16_t* aCookie);
33 static nsTHashMap<nsStringHashKey, mozilla::java::WebNotification::GlobalRef>
34 mNotificationsMap;
36 protected:
37 virtual ~AndroidAlerts() { sListenerMap = nullptr; }
39 using ListenerMap = nsInterfaceHashtable<nsStringHashKey, nsIObserver>;
40 static StaticAutoPtr<ListenerMap> sListenerMap;
43 } // namespace widget
44 } // namespace mozilla
46 #endif // nsAndroidAlerts_h__