michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #pragma once michael@0: michael@0: #include michael@0: #include michael@0: #include "mozwrlbase.h" michael@0: #include "nsString.h" michael@0: michael@0: michael@0: class ToastNotificationHandler { michael@0: typedef ABI::Windows::UI::Notifications::IToastNotification IToastNotification; michael@0: typedef ABI::Windows::UI::Notifications::IToastDismissedEventArgs IToastDismissedEventArgs; michael@0: typedef ABI::Windows::UI::Notifications::IToastNotificationManagerStatics IToastNotificationManagerStatics; michael@0: typedef ABI::Windows::UI::Notifications::ToastTemplateType ToastTemplateType; michael@0: typedef ABI::Windows::Data::Xml::Dom::IXmlNode IXmlNode; michael@0: typedef ABI::Windows::Data::Xml::Dom::IXmlDocument IXmlDocument; michael@0: michael@0: void SetNodeValueString(HSTRING inputString,Microsoft::WRL::ComPtr node, michael@0: Microsoft::WRL::ComPtr xml); michael@0: public: michael@0: ToastNotificationHandler() {}; michael@0: ~ToastNotificationHandler() {}; michael@0: michael@0: bool DisplayNotification(HSTRING title, HSTRING msg, HSTRING imagePath, michael@0: const nsAString& aCookie, const nsAString& aAppId); michael@0: bool DisplayTextNotification(HSTRING title, HSTRING msg, michael@0: const nsAString& aCookie, michael@0: const nsAString& aAppId); michael@0: HRESULT OnActivate(IToastNotification *notification, IInspectable *inspectable); michael@0: HRESULT OnDismiss(IToastNotification *notification, michael@0: IToastDismissedEventArgs* aArgs); michael@0: michael@0: private: michael@0: nsString mCookie; michael@0: Microsoft::WRL::ComPtr mToastNotificationManagerStatics; michael@0: michael@0: bool CreateWindowsNotificationFromXml(IXmlDocument *toastXml, michael@0: const nsAString& aAppId); michael@0: Microsoft::WRL::ComPtr InitializeXmlForTemplate(ToastTemplateType templateType); michael@0: };