Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
1 /* -*- Mode: C++; tab-width: 4; 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 #pragma once
8 #include <windows.ui.notifications.h>
9 #include <windows.data.xml.dom.h>
10 #include "mozwrlbase.h"
11 #include "nsString.h"
14 class ToastNotificationHandler {
15 typedef ABI::Windows::UI::Notifications::IToastNotification IToastNotification;
16 typedef ABI::Windows::UI::Notifications::IToastDismissedEventArgs IToastDismissedEventArgs;
17 typedef ABI::Windows::UI::Notifications::IToastNotificationManagerStatics IToastNotificationManagerStatics;
18 typedef ABI::Windows::UI::Notifications::ToastTemplateType ToastTemplateType;
19 typedef ABI::Windows::Data::Xml::Dom::IXmlNode IXmlNode;
20 typedef ABI::Windows::Data::Xml::Dom::IXmlDocument IXmlDocument;
22 void SetNodeValueString(HSTRING inputString,Microsoft::WRL::ComPtr<IXmlNode> node,
23 Microsoft::WRL::ComPtr<IXmlDocument> xml);
24 public:
25 ToastNotificationHandler() {};
26 ~ToastNotificationHandler() {};
28 bool DisplayNotification(HSTRING title, HSTRING msg, HSTRING imagePath,
29 const nsAString& aCookie, const nsAString& aAppId);
30 bool DisplayTextNotification(HSTRING title, HSTRING msg,
31 const nsAString& aCookie,
32 const nsAString& aAppId);
33 HRESULT OnActivate(IToastNotification *notification, IInspectable *inspectable);
34 HRESULT OnDismiss(IToastNotification *notification,
35 IToastDismissedEventArgs* aArgs);
37 private:
38 nsString mCookie;
39 Microsoft::WRL::ComPtr<IToastNotificationManagerStatics> mToastNotificationManagerStatics;
41 bool CreateWindowsNotificationFromXml(IXmlDocument *toastXml,
42 const nsAString& aAppId);
43 Microsoft::WRL::ComPtr<IXmlDocument> InitializeXmlForTemplate(ToastTemplateType templateType);
44 };