Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #pragma once |
michael@0 | 7 | |
michael@0 | 8 | #include <windows.ui.notifications.h> |
michael@0 | 9 | #include <windows.data.xml.dom.h> |
michael@0 | 10 | #include "mozwrlbase.h" |
michael@0 | 11 | #include "nsString.h" |
michael@0 | 12 | |
michael@0 | 13 | |
michael@0 | 14 | class ToastNotificationHandler { |
michael@0 | 15 | typedef ABI::Windows::UI::Notifications::IToastNotification IToastNotification; |
michael@0 | 16 | typedef ABI::Windows::UI::Notifications::IToastDismissedEventArgs IToastDismissedEventArgs; |
michael@0 | 17 | typedef ABI::Windows::UI::Notifications::IToastNotificationManagerStatics IToastNotificationManagerStatics; |
michael@0 | 18 | typedef ABI::Windows::UI::Notifications::ToastTemplateType ToastTemplateType; |
michael@0 | 19 | typedef ABI::Windows::Data::Xml::Dom::IXmlNode IXmlNode; |
michael@0 | 20 | typedef ABI::Windows::Data::Xml::Dom::IXmlDocument IXmlDocument; |
michael@0 | 21 | |
michael@0 | 22 | void SetNodeValueString(HSTRING inputString,Microsoft::WRL::ComPtr<IXmlNode> node, |
michael@0 | 23 | Microsoft::WRL::ComPtr<IXmlDocument> xml); |
michael@0 | 24 | public: |
michael@0 | 25 | ToastNotificationHandler() {}; |
michael@0 | 26 | ~ToastNotificationHandler() {}; |
michael@0 | 27 | |
michael@0 | 28 | bool DisplayNotification(HSTRING title, HSTRING msg, HSTRING imagePath, |
michael@0 | 29 | const nsAString& aCookie, const nsAString& aAppId); |
michael@0 | 30 | bool DisplayTextNotification(HSTRING title, HSTRING msg, |
michael@0 | 31 | const nsAString& aCookie, |
michael@0 | 32 | const nsAString& aAppId); |
michael@0 | 33 | HRESULT OnActivate(IToastNotification *notification, IInspectable *inspectable); |
michael@0 | 34 | HRESULT OnDismiss(IToastNotification *notification, |
michael@0 | 35 | IToastDismissedEventArgs* aArgs); |
michael@0 | 36 | |
michael@0 | 37 | private: |
michael@0 | 38 | nsString mCookie; |
michael@0 | 39 | Microsoft::WRL::ComPtr<IToastNotificationManagerStatics> mToastNotificationManagerStatics; |
michael@0 | 40 | |
michael@0 | 41 | bool CreateWindowsNotificationFromXml(IXmlDocument *toastXml, |
michael@0 | 42 | const nsAString& aAppId); |
michael@0 | 43 | Microsoft::WRL::ComPtr<IXmlDocument> InitializeXmlForTemplate(ToastTemplateType templateType); |
michael@0 | 44 | }; |