
* chore: bump chromium in DEPS to 07463d3cd628b037c11f36022cb4c788db4628e3 * chore: update patches * fix: Don't leak system network context when nw service is disabled1632494
NetworkService is now deleted by using SequnceLocalStorageSlot on the IO thread when the service is disabled, which expects all associated NetworkContexts on that sequence to be destroyed. * chore: bump chromium in DEPS to 7c16850e7e40990e141f47101b737ec1092175a1 * fix: Destroy all network contexts before primary network context * Simplify out-of-process service registration1615882
* [ThreadPool] Rename base::ThreadPool to base::ThreadPoolInstance1634851
* chore: update patches * fix: -Winconsistent-missing-override warnings * chore: bump chromium in DEPS to 93ebfaccc12715df1d5426797998eed0932f7ae1 * Change CreateBrowserMainParts to return unique_ptrs1632532
* chore: update patches * chore: bump chromium in DEPS to e656555ffb87bdd05e248d0a3ef9dd9d3433e17b * chore: bump chromium in DEPS to 111e7a8d2e3ae9d70e535009d6afb066ac906063 * chore: bump chromium in DEPS to 9b6b84670d32a7aff41ce73adc0eeee67d364989 * chore: update patches * chore: remove ShouldInterceptResourceAsStream as it is removed upstream Refs:1639597
* chore: remove ResourceDispatcherHostCreated as it is removed upstream Refs:1610892
* chore: CreateWithStrongBinding --> CreateWithSelfOwnedReceiver Refs:1636722
* chore: rename all blink media enums Refs:1639237
* chore: add accidentally removed patch content back
131 lines
4.9 KiB
C++
131 lines
4.9 KiB
C++
// Copyright (c) 2015 Felix Rieseberg <feriese@microsoft.com> and Jason Poon
|
|
// <jason.poon@microsoft.com>. All rights reserved.
|
|
// Copyright (c) 2015 Ryan McShane <rmcshane@bandwidth.com> and Brandon Smith
|
|
// <bsmith@bandwidth.com>
|
|
// Thanks to both of those folks mentioned above who first thought up a bunch of
|
|
// this code
|
|
// and released it as MIT to the world.
|
|
|
|
#ifndef ATOM_BROWSER_NOTIFICATIONS_WIN_WINDOWS_TOAST_NOTIFICATION_H_
|
|
#define ATOM_BROWSER_NOTIFICATIONS_WIN_WINDOWS_TOAST_NOTIFICATION_H_
|
|
|
|
#include <windows.h>
|
|
#include <windows.ui.notifications.h>
|
|
#include <wrl/implements.h>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "atom/browser/notifications/notification.h"
|
|
|
|
using Microsoft::WRL::ClassicCom;
|
|
using Microsoft::WRL::ComPtr;
|
|
using Microsoft::WRL::Make;
|
|
using Microsoft::WRL::RuntimeClass;
|
|
using Microsoft::WRL::RuntimeClassFlags;
|
|
|
|
namespace atom {
|
|
|
|
class ScopedHString;
|
|
|
|
using DesktopToastActivatedEventHandler =
|
|
ABI::Windows::Foundation::ITypedEventHandler<
|
|
ABI::Windows::UI::Notifications::ToastNotification*,
|
|
IInspectable*>;
|
|
using DesktopToastDismissedEventHandler =
|
|
ABI::Windows::Foundation::ITypedEventHandler<
|
|
ABI::Windows::UI::Notifications::ToastNotification*,
|
|
ABI::Windows::UI::Notifications::ToastDismissedEventArgs*>;
|
|
using DesktopToastFailedEventHandler =
|
|
ABI::Windows::Foundation::ITypedEventHandler<
|
|
ABI::Windows::UI::Notifications::ToastNotification*,
|
|
ABI::Windows::UI::Notifications::ToastFailedEventArgs*>;
|
|
|
|
class WindowsToastNotification : public Notification {
|
|
public:
|
|
// Should only be called by NotificationPresenterWin.
|
|
static bool Initialize();
|
|
|
|
WindowsToastNotification(NotificationDelegate* delegate,
|
|
NotificationPresenter* presenter);
|
|
~WindowsToastNotification() override;
|
|
|
|
protected:
|
|
// Notification:
|
|
void Show(const NotificationOptions& options) override;
|
|
void Dismiss() override;
|
|
|
|
private:
|
|
friend class ToastEventHandler;
|
|
|
|
bool GetToastXml(
|
|
ABI::Windows::UI::Notifications::IToastNotificationManagerStatics*
|
|
toastManager,
|
|
const std::wstring& title,
|
|
const std::wstring& msg,
|
|
const std::wstring& icon_path,
|
|
const bool silent,
|
|
ABI::Windows::Data::Xml::Dom::IXmlDocument** toastXml);
|
|
bool SetXmlAudioSilent(ABI::Windows::Data::Xml::Dom::IXmlDocument* doc);
|
|
bool SetXmlText(ABI::Windows::Data::Xml::Dom::IXmlDocument* doc,
|
|
const std::wstring& text);
|
|
bool SetXmlText(ABI::Windows::Data::Xml::Dom::IXmlDocument* doc,
|
|
const std::wstring& title,
|
|
const std::wstring& body);
|
|
bool SetXmlImage(ABI::Windows::Data::Xml::Dom::IXmlDocument* doc,
|
|
const std::wstring& icon_path);
|
|
bool GetTextNodeList(ScopedHString* tag,
|
|
ABI::Windows::Data::Xml::Dom::IXmlDocument* doc,
|
|
ABI::Windows::Data::Xml::Dom::IXmlNodeList** nodeList,
|
|
uint32_t reqLength);
|
|
bool AppendTextToXml(ABI::Windows::Data::Xml::Dom::IXmlDocument* doc,
|
|
ABI::Windows::Data::Xml::Dom::IXmlNode* node,
|
|
const std::wstring& text);
|
|
bool SetupCallbacks(
|
|
ABI::Windows::UI::Notifications::IToastNotification* toast);
|
|
bool RemoveCallbacks(
|
|
ABI::Windows::UI::Notifications::IToastNotification* toast);
|
|
|
|
static ComPtr<
|
|
ABI::Windows::UI::Notifications::IToastNotificationManagerStatics>
|
|
toast_manager_;
|
|
static ComPtr<ABI::Windows::UI::Notifications::IToastNotifier>
|
|
toast_notifier_;
|
|
|
|
EventRegistrationToken activated_token_;
|
|
EventRegistrationToken dismissed_token_;
|
|
EventRegistrationToken failed_token_;
|
|
|
|
ComPtr<ToastEventHandler> event_handler_;
|
|
ComPtr<ABI::Windows::UI::Notifications::IToastNotification>
|
|
toast_notification_;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(WindowsToastNotification);
|
|
};
|
|
|
|
class ToastEventHandler : public RuntimeClass<RuntimeClassFlags<ClassicCom>,
|
|
DesktopToastActivatedEventHandler,
|
|
DesktopToastDismissedEventHandler,
|
|
DesktopToastFailedEventHandler> {
|
|
public:
|
|
explicit ToastEventHandler(Notification* notification);
|
|
~ToastEventHandler() override;
|
|
|
|
IFACEMETHODIMP Invoke(
|
|
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
|
IInspectable* args) override;
|
|
IFACEMETHODIMP Invoke(
|
|
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
|
ABI::Windows::UI::Notifications::IToastDismissedEventArgs* e) override;
|
|
IFACEMETHODIMP Invoke(
|
|
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
|
ABI::Windows::UI::Notifications::IToastFailedEventArgs* e) override;
|
|
|
|
private:
|
|
base::WeakPtr<Notification> notification_; // weak ref.
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(ToastEventHandler);
|
|
};
|
|
|
|
} // namespace atom
|
|
|
|
#endif // ATOM_BROWSER_NOTIFICATIONS_WIN_WINDOWS_TOAST_NOTIFICATION_H_
|