2013-08-07 13:57:06 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <windows.ui.notifications.h>
|
|
|
|
#include <windows.data.xml.dom.h>
|
|
|
|
#include "mozwrlbase.h"
|
2013-10-08 19:15:41 -07:00
|
|
|
#include "nsString.h"
|
2013-08-07 13:57:06 -07:00
|
|
|
|
|
|
|
|
|
|
|
class ToastNotificationHandler {
|
|
|
|
typedef ABI::Windows::UI::Notifications::IToastNotification IToastNotification;
|
2013-10-08 19:15:41 -07:00
|
|
|
typedef ABI::Windows::UI::Notifications::IToastDismissedEventArgs IToastDismissedEventArgs;
|
2014-01-24 16:45:12 -08:00
|
|
|
typedef ABI::Windows::UI::Notifications::IToastNotificationManagerStatics IToastNotificationManagerStatics;
|
|
|
|
typedef ABI::Windows::UI::Notifications::ToastTemplateType ToastTemplateType;
|
2013-08-07 13:57:06 -07:00
|
|
|
typedef ABI::Windows::Data::Xml::Dom::IXmlNode IXmlNode;
|
|
|
|
typedef ABI::Windows::Data::Xml::Dom::IXmlDocument IXmlDocument;
|
|
|
|
|
2014-04-01 05:29:25 -07:00
|
|
|
void SetNodeValueString(HSTRING inputString,Microsoft::WRL::ComPtr<IXmlNode> node,
|
|
|
|
Microsoft::WRL::ComPtr<IXmlDocument> xml);
|
2013-08-07 13:57:06 -07:00
|
|
|
public:
|
|
|
|
ToastNotificationHandler() {};
|
|
|
|
~ToastNotificationHandler() {};
|
|
|
|
|
2014-02-19 18:29:16 -08:00
|
|
|
bool DisplayNotification(HSTRING title, HSTRING msg, HSTRING imagePath,
|
2014-02-19 18:28:57 -08:00
|
|
|
const nsAString& aCookie, const nsAString& aAppId);
|
2014-02-19 18:29:16 -08:00
|
|
|
bool DisplayTextNotification(HSTRING title, HSTRING msg,
|
2014-02-19 18:28:57 -08:00
|
|
|
const nsAString& aCookie,
|
|
|
|
const nsAString& aAppId);
|
2013-08-07 13:57:06 -07:00
|
|
|
HRESULT OnActivate(IToastNotification *notification, IInspectable *inspectable);
|
2013-10-08 19:15:41 -07:00
|
|
|
HRESULT OnDismiss(IToastNotification *notification,
|
|
|
|
IToastDismissedEventArgs* aArgs);
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsString mCookie;
|
2014-04-01 05:29:25 -07:00
|
|
|
Microsoft::WRL::ComPtr<IToastNotificationManagerStatics> mToastNotificationManagerStatics;
|
2014-01-24 16:45:12 -08:00
|
|
|
|
2014-02-19 18:29:16 -08:00
|
|
|
bool CreateWindowsNotificationFromXml(IXmlDocument *toastXml,
|
2014-02-19 18:28:57 -08:00
|
|
|
const nsAString& aAppId);
|
2014-04-01 05:29:25 -07:00
|
|
|
Microsoft::WRL::ComPtr<IXmlDocument> InitializeXmlForTemplate(ToastTemplateType templateType);
|
2013-08-07 13:57:06 -07:00
|
|
|
};
|