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/. */ 5 6 #ifndef mozilla_widget_AndroidAlerts_h__ 7 #define mozilla_widget_AndroidAlerts_h__ 8 9 #include "nsTHashMap.h" 10 #include "nsInterfaceHashtable.h" 11 #include "nsCOMPtr.h" 12 #include "nsHashKeys.h" 13 #include "nsIAlertsService.h" 14 #include "nsIObserver.h" 15 16 #include "mozilla/java/WebNotificationWrappers.h" 17 18 #include "mozilla/StaticPtr.h" 19 20 namespace mozilla { 21 namespace widget { 22 23 class AndroidAlerts : public nsIAlertsService { 24 public: 25 NS_DECL_ISUPPORTS 26 NS_DECL_NSIALERTSSERVICE 27 AndroidAlerts()28 AndroidAlerts() {} 29 30 static void NotifyListener(const nsAString& aName, const char* aTopic, 31 const char16_t* aCookie); 32 33 static nsTHashMap<nsStringHashKey, mozilla::java::WebNotification::GlobalRef> 34 mNotificationsMap; 35 36 protected: ~AndroidAlerts()37 virtual ~AndroidAlerts() { sListenerMap = nullptr; } 38 39 using ListenerMap = nsInterfaceHashtable<nsStringHashKey, nsIObserver>; 40 static StaticAutoPtr<ListenerMap> sListenerMap; 41 }; 42 43 } // namespace widget 44 } // namespace mozilla 45 46 #endif // nsAndroidAlerts_h__ 47