![trop[bot]](/assets/img/avatar_default.png)
* chore: bump chromium in DEPS to 141.0.7381.3 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> * chore: update patches Co-authored-by: deepak1556 <hop2deep@gmail.com> * chore: bump chromium in DEPS to 141.0.7382.0 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> * chore: update patches Co-authored-by: deepak1556 <hop2deep@gmail.com> * chore: bump chromium in DEPS to 141.0.7384.0 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> * chore: bump chromium in DEPS to 141.0.7386.0 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> * Move devtools_page and chrome_url_overrides handlers Refs https://chromium-review.googlesource.com/c/chromium/src/+/6862700 Co-authored-by: deepak1556 <hop2deep@gmail.com> * Reland "[api] Advance deprecation of GetIsolate" Refs https://chromium-review.googlesource.com/c/v8/v8/+/6875273 Co-authored-by: deepak1556 <hop2deep@gmail.com> * Move "system integrated UI" concept out of NativeTheme. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6867375 Co-authored-by: deepak1556 <hop2deep@gmail.com> * chore: update patches Co-authored-by: deepak1556 <hop2deep@gmail.com> * Reland "[PermissionOptions] Return PermissionResult in callback for requests" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6851838 Co-authored-by: deepak1556 <hop2deep@gmail.com> * Reland "[exit-time-destructors] Enable by default" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6859042 Co-authored-by: deepak1556 <hop2deep@gmail.com> * chore: update patches Co-authored-by: deepak1556 <hop2deep@gmail.com> * Revoke Read access after removing file via FileSystemAccess API Refs https://chromium-review.googlesource.com/c/chromium/src/+/6677249 Co-authored-by: deepak1556 <hop2deep@gmail.com> * chore: IWYU Co-authored-by: deepak1556 <hop2deep@gmail.com> * Accept an object for `dispatchHttpRequest` params Refs https://chromium-review.googlesource.com/c/chromium/src/+/6877528 Co-authored-by: deepak1556 <hop2deep@gmail.com> * chore: IWYU Co-authored-by: deepak1556 <hop2deep@gmail.com> * Pass navigation UI parameters on EnterFullscreen in EAM Refs https://chromium-review.googlesource.com/c/chromium/src/+/6874923 Co-authored-by: deepak1556 <hop2deep@gmail.com> * chore: rm band-aid_over_an_issue_with_using_deprecated_nsopenpanel_api.patch Co-authored-by: deepak1556 <hop2deep@gmail.com> * Remove unused PreHandleMouseEvent Refs https://chromium-review.googlesource.com/c/chromium/src/+/6880411 Co-authored-by: deepak1556 <hop2deep@gmail.com> * 6878583: siso: update to version 1.4.1 https://chromium-review.googlesource.com/c/chromium/src/+/6878583 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * Fold native_theme_browser into native_theme. https://chromium-review.googlesource.com/c/chromium/src/+/6882627 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * fixup: Reland "[exit-time-destructors] Enable by default https://chromium-review.googlesource.com/c/chromium/src/+/6859042 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * chore: update filenames.libcxx.gni Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * chore: IWYU Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * fixup: chore: IWYU Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * fixup: Reland "[exit-time-destructors] Enable by default Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * fixup: Reland "[exit-time-destructors] Enable by default Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * Remove common_theme.*; place its method in NativeTheme instead. https://chromium-review.googlesource.com/c/chromium/src/+/6886029 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * fixup: Reland "[exit-time-destructors] Enable by default Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * Better track when WebPreferences need updates for color-related changes. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6886797 Co-authored-by: deepak1556 <hop2deep@gmail.com> * chore: bump chromium in DEPS to 141.0.7390.7 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * 6904664: Reland "Make BrowserContext::GetPath() const" https://chromium-review.googlesource.com/c/chromium/src/+/6904664 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * Restore read access after certain file modification operations https://chromium-review.googlesource.com/c/chromium/src/+/6861041 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * fixup: Move "system integrated UI" concept out of NativeTheme. Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * fixup: Reland "[exit-time-destructors] Enable by default Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * chore: update patches Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * 6906096: Remove GetSysSkColor(). https://chromium-review.googlesource.com/c/chromium/src/+/6906096 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * Inline implementation of SysColorChangeListener into the lone user. https://chromium-review.googlesource.com/c/chromium/src/+/6905083 Also 6906096: Remove GetSysSkColor(). | https://chromium-review.googlesource.com/c/chromium/src/+/6906096 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * fixup: 6906096: Remove GetSysSkColor() Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * chore: update patches --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
122 lines
4.4 KiB
C++
122 lines
4.4 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 ELECTRON_SHELL_BROWSER_NOTIFICATIONS_WIN_WINDOWS_TOAST_NOTIFICATION_H_
|
|
#define ELECTRON_SHELL_BROWSER_NOTIFICATIONS_WIN_WINDOWS_TOAST_NOTIFICATION_H_
|
|
|
|
#include <windows.h>
|
|
#include <windows.ui.notifications.h>
|
|
#include <wrl/implements.h>
|
|
#include <string>
|
|
|
|
#include "shell/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 electron {
|
|
|
|
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;
|
|
void Remove() override;
|
|
|
|
private:
|
|
friend class ToastEventHandler;
|
|
|
|
HRESULT ShowInternal(const NotificationOptions& options);
|
|
std::u16string GetToastXml(const std::u16string& title,
|
|
const std::u16string& msg,
|
|
const std::wstring& icon_path,
|
|
const std::u16string& timeout_type,
|
|
const bool silent);
|
|
HRESULT XmlDocumentFromString(
|
|
const wchar_t* xmlString,
|
|
ABI::Windows::Data::Xml::Dom::IXmlDocument** doc);
|
|
HRESULT 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_;
|
|
};
|
|
|
|
class ToastEventHandler : public RuntimeClass<RuntimeClassFlags<ClassicCom>,
|
|
DesktopToastActivatedEventHandler,
|
|
DesktopToastDismissedEventHandler,
|
|
DesktopToastFailedEventHandler> {
|
|
public:
|
|
explicit ToastEventHandler(Notification* notification);
|
|
~ToastEventHandler() override;
|
|
|
|
// disable copy
|
|
ToastEventHandler(const ToastEventHandler&) = delete;
|
|
ToastEventHandler& operator=(const ToastEventHandler&) = delete;
|
|
|
|
// DesktopToastActivatedEventHandler
|
|
IFACEMETHODIMP Invoke(
|
|
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
|
IInspectable* args) override;
|
|
|
|
// DesktopToastDismissedEventHandler
|
|
IFACEMETHODIMP Invoke(
|
|
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
|
ABI::Windows::UI::Notifications::IToastDismissedEventArgs* e) override;
|
|
|
|
// DesktopToastFailedEventHandler
|
|
IFACEMETHODIMP Invoke(
|
|
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
|
ABI::Windows::UI::Notifications::IToastFailedEventArgs* e) override;
|
|
|
|
private:
|
|
base::WeakPtr<Notification> notification_; // weak ref.
|
|
};
|
|
|
|
} // namespace electron
|
|
|
|
#endif // ELECTRON_SHELL_BROWSER_NOTIFICATIONS_WIN_WINDOWS_TOAST_NOTIFICATION_H_
|