electron/shell/browser/notifications/win/windows_toast_notification.cc

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

675 lines
23 KiB
C++
Raw Normal View History

2017-03-23 19:48:22 +00:00
// 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.
#include "shell/browser/notifications/win/windows_toast_notification.h"
#include <string_view>
2015-11-20 05:28:37 +00:00
#include <shlobj.h>
#include <wrl\wrappers\corewrappers.h>
2015-11-20 05:28:37 +00:00
#include "base/environment.h"
chore: bump chromium to 100.0.4857.0 (main) (#32419) * chore: bump chromium in DEPS to 99.0.4819.0 * chore: update patches * chore: bump chromium in DEPS to 99.0.4824.0 * chore: update patches * chore: bump chromium in DEPS to 99.0.4827.0 * chore: update patches * 3352511: PiP: Add inkdrop and pointer cursor to PiP window buttons https://chromium-review.googlesource.com/c/chromium/src/+/3352511 * 3309164: webhid: Show FIDO devices in the chooser if allowed https://chromium-review.googlesource.com/c/chromium/src/+/3309164 * 3297868: hid: Add experimental HIDDevice.forget() https://chromium-review.googlesource.com/c/chromium/src/+/3297868 * 3362491: [Extensions] Move i18n API to //extensions https://chromium-review.googlesource.com/c/chromium/src/+/3362491 * MCC Refactor step0: Allow embedders to register associated_interface binders with RenderFrameHostImpl::associated_registry_. https://chromium-review.googlesource.com/c/chromium/src/+/3281481 * 3352616: [Gtk] Remove libgtk from the link-line https://chromium-review.googlesource.com/c/chromium/src/+/3352616 * 3249211: Clear-Site-Data support for partitioned cookies https://chromium-review.googlesource.com/c/chromium/src/+/3249211 * [Extensions][COIL] Use [allow|block]list in //extensions/common https://chromium-review.googlesource.com/c/chromium/src/+/3372668 * Begin ScopedUserPrefUpdate migration to modern base::Value https://chromium-review.googlesource.com/c/chromium/src/+/3376154 * [Code Health] Refactor PrefService GetDict + GetList to use base::Value https://chromium-review.googlesource.com/c/chromium/src/+/3343526 * 3354997: [CodeHealth] Remove deprecated SetDictionary method https://chromium-review.googlesource.com/c/chromium/src/+/3354997 * 3287323: Add LacrosPrefStore for lacros settings https://chromium-review.googlesource.com/c/chromium/src/+/3287323 * 3365916: [PA] Clean up remaining lazy commit code https://chromium-review.googlesource.com/c/chromium/src/+/3365916 * [MPArch] Target the external protocol error at the responsible frame. https://chromium-review.googlesource.com/c/chromium/src/+/3011560 * Pass origin to RegisterNonNetworkSubresourceURLLoaderFactories https://chromium-review.googlesource.com/c/chromium/src/+/3350608 * Linux: Send OSCrypt raw encryption key to the Network Service https://chromium-review.googlesource.com/c/chromium/src/+/3320484 * [PlzServiceWorker] Remove remaining references to PlzServiceWorker. https://chromium-review.googlesource.com/c/chromium/src/+/3359441 * chore: fixup for lint * 3327621: Fix tablet mode detection for Win 11. https://chromium-review.googlesource.com/c/chromium/src/+/3327621 * 3342428: ax_mac: move AXTextMarker conversion utils under ui umbrella https://chromium-review.googlesource.com/c/chromium/src/+/3342428 * 3353974: Mac: Use base::Feature for overlay features https://chromium-review.googlesource.com/c/chromium/src/+/3353974 * chore: bump chromium in DEPS to 99.0.4828.0 * chore: update patches * chore: bump chromium in DEPS to 99.0.4837.0 * chore: update patches * chore: update patches * 3379142: Drop FALLTHROUGH macro Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3379142 * 3381749: C++17: Allow use of std::map::try_emplace and std::map::insert_or_assign Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3381749 * chore: bump chromium in DEPS to 99.0.4839.0 * chore: update patches * chore: bump chromium in DEPS to 99.0.4840.0 * chore: bump chromium in DEPS to 99.0.4844.0 * 3395881: [api] Deprecate Local<v8::Context> v8::Object::CreationContext() Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3395881 * chore: update patches * chore: bump chromium in DEPS to 100.0.4845.0 * chore: update patches * chore: bump chromium in DEPS to 100.0.4847.0 * chore: update patches * chore: bump chromium in DEPS to 100.0.4849.0 * chore: update patches * chore: bump chromium in DEPS to 100.0.4851.0 * chore: bump chromium in DEPS to 100.0.4853.0 * update patches * chore: update patches * update patches * 3383599: Fonts Access: Remove prototype that uses a font picker. https://chromium-review.googlesource.com/c/chromium/src/+/3383599 * 3404768: Remove ALLOW_UNUSED macros https://chromium-review.googlesource.com/c/chromium/src/+/3404768 * 3374762: Remove ignore_result.h https://chromium-review.googlesource.com/c/chromium/src/+/3374762 * 3399305: [unseasoned-pdf] Apply proper frame offsets for touch selections https://chromium-review.googlesource.com/c/chromium/src/+/3399305 * 3402210: [Extensions] Don't trigger unload event for already unloaded extension https://chromium-review.googlesource.com/c/chromium/src/+/3402210 * 3410912: Combine URLLoaderClient OnReceiveResponse and OnStartLoadingResponseBody. https://chromium-review.googlesource.com/c/chromium/src/+/3410912 * 3370428: Make the AuthSchemes policy support dynamic refresh https://chromium-review.googlesource.com/c/chromium/src/+/3370428 * 3407603: Finish ScopedUserPrefUpdate migration to modern base::Value https://chromium-review.googlesource.com/c/chromium/src/+/3407603 * 3378352: ozone/x11: move code from //ui/p/x11 to //ui/ozone/p/x11 https://chromium-review.googlesource.com/c/chromium/src/+/3378352 * 3370810: Delete chrome/service, AKA the Cloud Print service process. https://chromium-review.googlesource.com/c/chromium/src/+/3370810 * chore: bump chromium in DEPS to 100.0.4855.0 * chore: update patches * fixup! 3370810: Delete chrome/service, AKA the Cloud Print service process. * revert 3348007 to fix windows build * 3318572: [Code health] Fix gn check errors in //extensions/browser:* https://chromium-review.googlesource.com/c/chromium/src/+/3318572 * fix printing.patch * fix iwyu issue * 3408515: win: Make ShorcutOperation an enum class and modernize names https://chromium-review.googlesource.com/c/chromium/src/+/3408515 * 3388333: [UIA] Remove dead code accessibility_misc_utils.h/cc https://chromium-review.googlesource.com/c/chromium/src/+/3388333 * fix windows build? i hope * patch gn visibility of //ui/ozone/platform/x11 * missing include base/logging.h * use BUILDFLAG for USE_NSS_CERTS https://chromium-review.googlesource.com/c/chromium/src/+/3379123 * defined(OS_*) ==> BUILDFLAG(IS_*) https://bugs.chromium.org/p/chromium/issues/detail?id=1234043 * fixup! 3404768: Remove ALLOW_UNUSED macros * another attempt to fix windows build * temporarily disable the custom scheme service worker test https://github.com/electron/electron/issues/32664 * fix loading mv3 extensions not sure what cl broke this unfort. * fixup! 3404768: Remove ALLOW_UNUSED macros * patch nan https://chromium-review.googlesource.com/c/v8/v8/+/3395880 * fix node test * fix nullptr in FindPdfFrame * patch perfetto to fix build issue on win-ia32 https://source.chromium.org/chromium/_/android/platform/external/perfetto.git/+/bc44c3c7533c00e56f88c06c592d634aecc884be * fix build for linux-x64-testing-no-run-as-node * fix patch * skip <webview>.capturePage() test https://github.com/electron/electron/issues/32705 * test: fix failing tests of focus/blur events of WebContents (#32711) * inherit stdio from app module test child processes this prevents them from timing out due to full stdout buffers * test to see if we can get better logs on windows ci * try again for appveyor log things * skip contentTracing tests on ia32 * ci: disable gpu compositing * drop applied patch * fix merge fail * Revert "ci: disable gpu compositing" This reverts commit 0344129fcb19ea3e87e06c1110d751f22eba3fec. Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@github.com> Co-authored-by: VerteDinde <khammond@slack-corp.com> Co-authored-by: VerteDinde <vertedinde@electronjs.org> Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: Jeremy Rose <nornagon@nornagon.net> Co-authored-by: Cheng Zhao <zcbenz@gmail.com> Co-authored-by: deepak1556 <hop2deep@gmail.com>
2022-02-10 02:58:52 +00:00
#include "base/logging.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util_win.h"
2015-11-10 11:50:38 +00:00
#include "base/strings/utf_string_conversions.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "shell/browser/notifications/notification_delegate.h"
#include "shell/browser/notifications/win/notification_presenter_win.h"
#include "shell/browser/win/scoped_hstring.h"
#include "shell/common/application_info.h"
#include "ui/base/l10n/l10n_util_win.h"
#include "ui/strings/grit/ui_strings.h"
2017-03-23 19:48:22 +00:00
using ABI::Windows::Data::Xml::Dom::IXmlAttribute;
using ABI::Windows::Data::Xml::Dom::IXmlDocument;
using ABI::Windows::Data::Xml::Dom::IXmlDocumentIO;
2017-03-23 19:48:22 +00:00
using ABI::Windows::Data::Xml::Dom::IXmlElement;
using ABI::Windows::Data::Xml::Dom::IXmlNamedNodeMap;
using ABI::Windows::Data::Xml::Dom::IXmlNode;
using ABI::Windows::Data::Xml::Dom::IXmlNodeList;
using ABI::Windows::Data::Xml::Dom::IXmlText;
using Microsoft::WRL::Wrappers::HStringReference;
namespace winui = ABI::Windows::UI;
#define RETURN_IF_FAILED(hr) \
do { \
if (const HRESULT _hrTemp = hr; FAILED(_hrTemp)) { \
return _hrTemp; \
} \
} while (false)
#define REPORT_AND_RETURN_IF_FAILED(hr, msg) \
do { \
if (const HRESULT _hrTemp = hr; FAILED(_hrTemp)) { \
std::string _err = \
base::StrCat({msg, ", ERROR ", base::NumberToString(_hrTemp)}); \
DebugLog(_err); \
Notification::NotificationFailed(_err); \
return _hrTemp; \
} \
} while (false)
namespace electron {
2015-11-16 08:47:34 +00:00
2015-11-20 05:28:37 +00:00
namespace {
// This string needs to be max 16 characters to work on Windows 10 prior to
// applying Creators Update (build 15063).
constexpr wchar_t kGroup[] = L"Notifications";
void DebugLog(std::string_view log_msg) {
if (base::Environment::Create()->HasVar("ELECTRON_DEBUG_NOTIFICATIONS"))
LOG(INFO) << log_msg;
}
2015-11-20 05:28:37 +00:00
} // namespace
// static
ComPtr<winui::Notifications::IToastNotificationManagerStatics>
WindowsToastNotification::toast_manager_;
// static
ComPtr<winui::Notifications::IToastNotifier>
WindowsToastNotification::toast_notifier_;
// static
bool WindowsToastNotification::Initialize() {
// Just initialize, don't care if it fails or already initialized.
Windows::Foundation::Initialize(RO_INIT_MULTITHREADED);
2015-11-16 08:47:34 +00:00
2015-11-10 11:50:38 +00:00
ScopedHString toast_manager_str(
RuntimeClass_Windows_UI_Notifications_ToastNotificationManager);
if (!toast_manager_str.success())
return false;
if (FAILED(Windows::Foundation::GetActivationFactory(toast_manager_str,
&toast_manager_)))
return false;
2015-11-10 11:50:38 +00:00
2018-10-24 10:49:10 +00:00
if (IsRunningInDesktopBridge()) {
// Ironically, the Desktop Bridge / UWP environment
// requires us to not give Windows an appUserModelId.
return SUCCEEDED(toast_manager_->CreateToastNotifier(&toast_notifier_));
} else {
ScopedHString app_id;
2018-10-24 10:49:10 +00:00
if (!GetAppUserModelID(&app_id))
return false;
return SUCCEEDED(
toast_manager_->CreateToastNotifierWithId(app_id, &toast_notifier_));
}
}
2015-11-10 11:50:38 +00:00
WindowsToastNotification::WindowsToastNotification(
2015-12-25 03:05:48 +00:00
NotificationDelegate* delegate,
NotificationPresenter* presenter)
2017-03-23 19:48:22 +00:00
: Notification(delegate, presenter) {}
WindowsToastNotification::~WindowsToastNotification() {
// Remove the notification on exit.
if (toast_notification_) {
RemoveCallbacks(toast_notification_.Get());
}
}
2017-06-24 11:03:27 +00:00
void WindowsToastNotification::Show(const NotificationOptions& options) {
if (SUCCEEDED(ShowInternal(options))) {
DebugLog("Notification created");
if (delegate())
delegate()->NotificationDisplayed();
}
}
void WindowsToastNotification::Remove() {
DebugLog("Removing notification from action center");
ComPtr<winui::Notifications::IToastNotificationManagerStatics2>
toast_manager2;
if (FAILED(toast_manager_.As(&toast_manager2)))
return;
ComPtr<winui::Notifications::IToastNotificationHistory> notification_history;
if (FAILED(toast_manager2->get_History(&notification_history)))
return;
ScopedHString app_id;
if (!GetAppUserModelID(&app_id))
return;
ScopedHString group(kGroup);
ScopedHString tag(base::as_wcstr(base::UTF8ToUTF16(notification_id())));
notification_history->RemoveGroupedTagWithId(tag, group, app_id);
}
void WindowsToastNotification::Dismiss() {
DebugLog("Hiding notification");
toast_notifier_->Hide(toast_notification_.Get());
}
2017-12-14 00:31:02 +00:00
HRESULT WindowsToastNotification::ShowInternal(
const NotificationOptions& options) {
2015-11-10 11:50:38 +00:00
ComPtr<IXmlDocument> toast_xml;
// The custom xml takes priority over the preset template.
if (!options.toast_xml.empty()) {
REPORT_AND_RETURN_IF_FAILED(
XmlDocumentFromString(base::as_wcstr(options.toast_xml), &toast_xml),
"XML: Invalid XML");
} else {
auto* presenter_win = static_cast<NotificationPresenterWin*>(presenter());
std::wstring icon_path =
presenter_win->SaveIconToFilesystem(options.icon, options.icon_url);
REPORT_AND_RETURN_IF_FAILED(
GetToastXml(toast_manager_.Get(), options.title, options.msg, icon_path,
options.timeout_type, options.silent, &toast_xml),
"XML: Failed to create XML document");
}
2015-11-10 11:50:38 +00:00
ScopedHString toast_str(
RuntimeClass_Windows_UI_Notifications_ToastNotification);
if (!toast_str.success()) {
NotificationFailed("Creating ScopedHString failed");
return E_FAIL;
}
ComPtr<winui::Notifications::IToastNotificationFactory> toast_factory;
REPORT_AND_RETURN_IF_FAILED(
Windows::Foundation::GetActivationFactory(toast_str, &toast_factory),
"WinAPI: GetActivationFactory failed");
REPORT_AND_RETURN_IF_FAILED(toast_factory->CreateToastNotification(
toast_xml.Get(), &toast_notification_),
"WinAPI: CreateToastNotification failed");
ComPtr<winui::Notifications::IToastNotification2> toast2;
REPORT_AND_RETURN_IF_FAILED(
toast_notification_->QueryInterface(IID_PPV_ARGS(&toast2)),
"WinAPI: Getting Notification interface failed");
ScopedHString group(kGroup);
REPORT_AND_RETURN_IF_FAILED(toast2->put_Group(group),
"WinAPI: Setting group failed");
ScopedHString tag(base::as_wcstr(base::UTF8ToUTF16(notification_id())));
REPORT_AND_RETURN_IF_FAILED(toast2->put_Tag(tag),
"WinAPI: Setting tag failed");
REPORT_AND_RETURN_IF_FAILED(SetupCallbacks(toast_notification_.Get()),
"WinAPI: SetupCallbacks failed");
REPORT_AND_RETURN_IF_FAILED(toast_notifier_->Show(toast_notification_.Get()),
"WinAPI: Show failed");
return S_OK;
}
HRESULT WindowsToastNotification::GetToastXml(
winui::Notifications::IToastNotificationManagerStatics* toastManager,
const std::u16string& title,
const std::u16string& msg,
const std::wstring& icon_path,
const std::u16string& timeout_type,
2017-05-30 09:06:51 +00:00
bool silent,
2015-11-10 11:50:38 +00:00
IXmlDocument** toast_xml) {
winui::Notifications::ToastTemplateType template_type;
2015-11-10 12:07:12 +00:00
if (title.empty() || msg.empty()) {
2015-11-10 11:50:38 +00:00
// Single line toast.
2017-03-23 19:48:22 +00:00
template_type =
icon_path.empty()
? winui::Notifications::ToastTemplateType_ToastText01
: winui::Notifications::ToastTemplateType_ToastImageAndText01;
REPORT_AND_RETURN_IF_FAILED(
toast_manager_->GetTemplateContent(template_type, toast_xml),
"XML: Fetching XML ToastImageAndText01 template failed");
std::u16string toastMsg = title.empty() ? msg : title;
// we can't create an empty notification
toastMsg = toastMsg.empty() ? u"[no message]" : toastMsg;
REPORT_AND_RETURN_IF_FAILED(
SetXmlText(*toast_xml, toastMsg),
"XML: Filling XML ToastImageAndText01 template failed");
} else {
2015-11-10 11:50:38 +00:00
// Title and body toast.
2017-03-23 19:48:22 +00:00
template_type =
icon_path.empty()
? winui::Notifications::ToastTemplateType_ToastText02
: winui::Notifications::ToastTemplateType_ToastImageAndText02;
REPORT_AND_RETURN_IF_FAILED(
toastManager->GetTemplateContent(template_type, toast_xml),
"XML: Fetching XML ToastImageAndText02 template failed");
REPORT_AND_RETURN_IF_FAILED(
SetXmlText(*toast_xml, title, msg),
"XML: Filling XML ToastImageAndText02 template failed");
}
2016-03-08 06:02:42 +00:00
// Configure the toast's timeout settings
if (timeout_type == u"never") {
REPORT_AND_RETURN_IF_FAILED(
(SetXmlScenarioReminder(*toast_xml)),
"XML: Setting \"scenario\" option on notification failed");
}
// Configure the toast's notification sound
if (silent) {
REPORT_AND_RETURN_IF_FAILED(
SetXmlAudioSilent(*toast_xml),
"XML: Setting \"silent\" option on notification failed");
}
// Configure the toast's image
if (!icon_path.empty()) {
REPORT_AND_RETURN_IF_FAILED(
SetXmlImage(*toast_xml, icon_path),
"XML: Setting \"icon\" option on notification failed");
}
return S_OK;
}
HRESULT WindowsToastNotification::SetXmlScenarioReminder(IXmlDocument* doc) {
ScopedHString tag(L"toast");
if (!tag.success())
return false;
ComPtr<IXmlNodeList> node_list;
RETURN_IF_FAILED(doc->GetElementsByTagName(tag, &node_list));
// Check that root "toast" node exists
ComPtr<IXmlNode> root;
RETURN_IF_FAILED(node_list->Item(0, &root));
// get attributes of root "toast" node
ComPtr<IXmlNamedNodeMap> toast_attributes;
RETURN_IF_FAILED(root->get_Attributes(&toast_attributes));
ComPtr<IXmlAttribute> scenario_attribute;
ScopedHString scenario_str(L"scenario");
RETURN_IF_FAILED(doc->CreateAttribute(scenario_str, &scenario_attribute));
ComPtr<IXmlNode> scenario_attribute_node;
RETURN_IF_FAILED(scenario_attribute.As(&scenario_attribute_node));
ScopedHString scenario_value(L"reminder");
if (!scenario_value.success())
return E_FAIL;
ComPtr<IXmlText> scenario_text;
RETURN_IF_FAILED(doc->CreateTextNode(scenario_value, &scenario_text));
ComPtr<IXmlNode> scenario_node;
RETURN_IF_FAILED(scenario_text.As(&scenario_node));
ComPtr<IXmlNode> scenario_backup_node;
RETURN_IF_FAILED(scenario_attribute_node->AppendChild(scenario_node.Get(),
&scenario_backup_node));
ComPtr<IXmlNode> scenario_attribute_pnode;
RETURN_IF_FAILED(toast_attributes.Get()->SetNamedItem(
scenario_attribute_node.Get(), &scenario_attribute_pnode));
// Create "actions" wrapper
ComPtr<IXmlElement> actions_wrapper_element;
ScopedHString actions_wrapper_str(L"actions");
RETURN_IF_FAILED(
doc->CreateElement(actions_wrapper_str, &actions_wrapper_element));
ComPtr<IXmlNode> actions_wrapper_node_tmp;
RETURN_IF_FAILED(actions_wrapper_element.As(&actions_wrapper_node_tmp));
// Append actions wrapper node to toast xml
ComPtr<IXmlNode> actions_wrapper_node;
RETURN_IF_FAILED(
root->AppendChild(actions_wrapper_node_tmp.Get(), &actions_wrapper_node));
ComPtr<IXmlNamedNodeMap> attributes_actions_wrapper;
RETURN_IF_FAILED(
actions_wrapper_node->get_Attributes(&attributes_actions_wrapper));
// Add a "Dismiss" button
// Create "action" tag
ComPtr<IXmlElement> action_element;
ScopedHString action_str(L"action");
RETURN_IF_FAILED(doc->CreateElement(action_str, &action_element));
ComPtr<IXmlNode> action_node_tmp;
RETURN_IF_FAILED(action_element.As(&action_node_tmp));
// Append action node to actions wrapper in toast xml
ComPtr<IXmlNode> action_node;
RETURN_IF_FAILED(
actions_wrapper_node->AppendChild(action_node_tmp.Get(), &action_node));
// Setup attributes for action
ComPtr<IXmlNamedNodeMap> action_attributes;
RETURN_IF_FAILED(action_node->get_Attributes(&action_attributes));
// Create activationType attribute
ComPtr<IXmlAttribute> activation_type_attribute;
ScopedHString activation_type_str(L"activationType");
RETURN_IF_FAILED(
doc->CreateAttribute(activation_type_str, &activation_type_attribute));
ComPtr<IXmlNode> activation_type_attribute_node;
RETURN_IF_FAILED(
activation_type_attribute.As(&activation_type_attribute_node));
// Set activationType attribute to system
ScopedHString activation_type_value(L"system");
if (!activation_type_value.success())
return E_FAIL;
ComPtr<IXmlText> activation_type_text;
RETURN_IF_FAILED(
doc->CreateTextNode(activation_type_value, &activation_type_text));
ComPtr<IXmlNode> activation_type_node;
RETURN_IF_FAILED(activation_type_text.As(&activation_type_node));
ComPtr<IXmlNode> activation_type_backup_node;
RETURN_IF_FAILED(activation_type_attribute_node->AppendChild(
activation_type_node.Get(), &activation_type_backup_node));
// Add activation type to the action attributes
ComPtr<IXmlNode> activation_type_attribute_pnode;
RETURN_IF_FAILED(action_attributes.Get()->SetNamedItem(
activation_type_attribute_node.Get(), &activation_type_attribute_pnode));
// Create arguments attribute
ComPtr<IXmlAttribute> arguments_attribute;
ScopedHString arguments_str(L"arguments");
RETURN_IF_FAILED(doc->CreateAttribute(arguments_str, &arguments_attribute));
ComPtr<IXmlNode> arguments_attribute_node;
RETURN_IF_FAILED(arguments_attribute.As(&arguments_attribute_node));
// Set arguments attribute to dismiss
ScopedHString arguments_value(L"dismiss");
if (!arguments_value.success())
return E_FAIL;
ComPtr<IXmlText> arguments_text;
RETURN_IF_FAILED(doc->CreateTextNode(arguments_value, &arguments_text));
ComPtr<IXmlNode> arguments_node;
RETURN_IF_FAILED(arguments_text.As(&arguments_node));
ComPtr<IXmlNode> arguments_backup_node;
RETURN_IF_FAILED(arguments_attribute_node->AppendChild(
arguments_node.Get(), &arguments_backup_node));
// Add arguments to the action attributes
ComPtr<IXmlNode> arguments_attribute_pnode;
RETURN_IF_FAILED(action_attributes.Get()->SetNamedItem(
arguments_attribute_node.Get(), &arguments_attribute_pnode));
// Create content attribute
ComPtr<IXmlAttribute> content_attribute;
ScopedHString content_str(L"content");
RETURN_IF_FAILED(doc->CreateAttribute(content_str, &content_attribute));
ComPtr<IXmlNode> content_attribute_node;
RETURN_IF_FAILED(content_attribute.As(&content_attribute_node));
// Set content attribute to Dismiss
ScopedHString content_value(l10n_util::GetWideString(IDS_APP_CLOSE));
if (!content_value.success())
return E_FAIL;
ComPtr<IXmlText> content_text;
RETURN_IF_FAILED(doc->CreateTextNode(content_value, &content_text));
ComPtr<IXmlNode> content_node;
RETURN_IF_FAILED(content_text.As(&content_node));
ComPtr<IXmlNode> content_backup_node;
RETURN_IF_FAILED(content_attribute_node->AppendChild(content_node.Get(),
&content_backup_node));
// Add content to the action attributes
ComPtr<IXmlNode> content_attribute_pnode;
return action_attributes.Get()->SetNamedItem(content_attribute_node.Get(),
&content_attribute_pnode);
}
HRESULT WindowsToastNotification::SetXmlAudioSilent(IXmlDocument* doc) {
2017-03-23 19:48:22 +00:00
ScopedHString tag(L"toast");
if (!tag.success())
return E_FAIL;
ComPtr<IXmlNodeList> node_list;
RETURN_IF_FAILED(doc->GetElementsByTagName(tag, &node_list));
ComPtr<IXmlNode> root;
RETURN_IF_FAILED(node_list->Item(0, &root));
2016-03-08 06:02:42 +00:00
ComPtr<IXmlElement> audio_element;
ScopedHString audio_str(L"audio");
RETURN_IF_FAILED(doc->CreateElement(audio_str, &audio_element));
2016-03-08 06:02:42 +00:00
ComPtr<IXmlNode> audio_node_tmp;
RETURN_IF_FAILED(audio_element.As(&audio_node_tmp));
2016-03-08 06:02:42 +00:00
// Append audio node to toast xml
ComPtr<IXmlNode> audio_node;
RETURN_IF_FAILED(root->AppendChild(audio_node_tmp.Get(), &audio_node));
2016-03-08 06:02:42 +00:00
// Create silent attribute
ComPtr<IXmlNamedNodeMap> attributes;
RETURN_IF_FAILED(audio_node->get_Attributes(&attributes));
2016-03-08 06:02:42 +00:00
ComPtr<IXmlAttribute> silent_attribute;
ScopedHString silent_str(L"silent");
RETURN_IF_FAILED(doc->CreateAttribute(silent_str, &silent_attribute));
2016-03-08 06:02:42 +00:00
ComPtr<IXmlNode> silent_attribute_node;
RETURN_IF_FAILED(silent_attribute.As(&silent_attribute_node));
2016-03-08 06:02:42 +00:00
// Set silent attribute to true
ScopedHString silent_value(L"true");
if (!silent_value.success())
return E_FAIL;
2016-03-08 06:02:42 +00:00
ComPtr<IXmlText> silent_text;
RETURN_IF_FAILED(doc->CreateTextNode(silent_value, &silent_text));
ComPtr<IXmlNode> silent_node;
RETURN_IF_FAILED(silent_text.As(&silent_node));
2016-03-08 06:02:42 +00:00
ComPtr<IXmlNode> child_node;
RETURN_IF_FAILED(
silent_attribute_node->AppendChild(silent_node.Get(), &child_node));
2016-03-08 06:02:42 +00:00
ComPtr<IXmlNode> silent_attribute_pnode;
return attributes.Get()->SetNamedItem(silent_attribute_node.Get(),
&silent_attribute_pnode);
}
HRESULT WindowsToastNotification::SetXmlText(IXmlDocument* doc,
const std::u16string& text) {
2015-11-10 11:50:38 +00:00
ScopedHString tag;
ComPtr<IXmlNodeList> node_list;
RETURN_IF_FAILED(GetTextNodeList(&tag, doc, &node_list, 1));
2015-11-10 11:50:38 +00:00
ComPtr<IXmlNode> node;
RETURN_IF_FAILED(node_list->Item(0, &node));
2015-11-10 11:50:38 +00:00
return AppendTextToXml(doc, node.Get(), text);
}
HRESULT WindowsToastNotification::SetXmlText(IXmlDocument* doc,
const std::u16string& title,
const std::u16string& body) {
2015-11-10 11:50:38 +00:00
ScopedHString tag;
ComPtr<IXmlNodeList> node_list;
RETURN_IF_FAILED(GetTextNodeList(&tag, doc, &node_list, 2));
2015-11-10 11:50:38 +00:00
ComPtr<IXmlNode> node;
RETURN_IF_FAILED(node_list->Item(0, &node));
RETURN_IF_FAILED(AppendTextToXml(doc, node.Get(), title));
RETURN_IF_FAILED(node_list->Item(1, &node));
2015-11-10 11:50:38 +00:00
return AppendTextToXml(doc, node.Get(), body);
}
HRESULT WindowsToastNotification::SetXmlImage(IXmlDocument* doc,
const std::wstring& icon_path) {
ScopedHString tag(L"image");
2015-11-10 11:50:38 +00:00
if (!tag.success())
return E_FAIL;
2015-11-10 11:50:38 +00:00
ComPtr<IXmlNodeList> node_list;
RETURN_IF_FAILED(doc->GetElementsByTagName(tag, &node_list));
2015-11-10 11:50:38 +00:00
ComPtr<IXmlNode> image_node;
RETURN_IF_FAILED(node_list->Item(0, &image_node));
2015-11-10 11:50:38 +00:00
ComPtr<IXmlNamedNodeMap> attrs;
RETURN_IF_FAILED(image_node->get_Attributes(&attrs));
2015-11-10 11:50:38 +00:00
ScopedHString src(L"src");
if (!src.success())
return E_FAIL;
2015-11-10 11:50:38 +00:00
ComPtr<IXmlNode> src_attr;
RETURN_IF_FAILED(attrs->GetNamedItem(src, &src_attr));
const ScopedHString img_path{icon_path};
2015-11-10 11:50:38 +00:00
if (!img_path.success())
return E_FAIL;
2015-11-10 11:50:38 +00:00
ComPtr<IXmlText> src_text;
RETURN_IF_FAILED(doc->CreateTextNode(img_path, &src_text));
2015-11-10 11:50:38 +00:00
ComPtr<IXmlNode> src_node;
RETURN_IF_FAILED(src_text.As(&src_node));
2015-11-10 11:50:38 +00:00
ComPtr<IXmlNode> child_node;
return src_attr->AppendChild(src_node.Get(), &child_node);
}
HRESULT WindowsToastNotification::GetTextNodeList(ScopedHString* tag,
IXmlDocument* doc,
IXmlNodeList** node_list,
uint32_t req_length) {
tag->Reset(L"text");
2015-11-10 11:50:38 +00:00
if (!tag->success())
return E_FAIL;
RETURN_IF_FAILED(doc->GetElementsByTagName(*tag, node_list));
2016-03-08 06:02:42 +00:00
uint32_t node_length;
RETURN_IF_FAILED((*node_list)->get_Length(&node_length));
2015-11-10 11:50:38 +00:00
return node_length >= req_length;
}
HRESULT WindowsToastNotification::AppendTextToXml(IXmlDocument* doc,
IXmlNode* node,
const std::u16string& text) {
ScopedHString str(base::as_wcstr(text));
2015-11-10 11:50:38 +00:00
if (!str.success())
return E_FAIL;
2015-11-10 11:50:38 +00:00
ComPtr<IXmlText> xml_text;
RETURN_IF_FAILED(doc->CreateTextNode(str, &xml_text));
2015-11-10 11:50:38 +00:00
ComPtr<IXmlNode> text_node;
RETURN_IF_FAILED(xml_text.As(&text_node));
2015-11-10 11:50:38 +00:00
ComPtr<IXmlNode> append_node;
RETURN_IF_FAILED(node->AppendChild(text_node.Get(), &append_node));
return S_OK;
}
HRESULT WindowsToastNotification::XmlDocumentFromString(
const wchar_t* xmlString,
IXmlDocument** doc) {
ComPtr<IXmlDocument> xmlDoc;
RETURN_IF_FAILED(Windows::Foundation::ActivateInstance(
HStringReference(RuntimeClass_Windows_Data_Xml_Dom_XmlDocument).Get(),
&xmlDoc));
2015-12-25 03:05:48 +00:00
ComPtr<IXmlDocumentIO> docIO;
RETURN_IF_FAILED(xmlDoc.As(&docIO));
2015-12-25 03:05:48 +00:00
RETURN_IF_FAILED(docIO->LoadXml(HStringReference(xmlString).Get()));
return xmlDoc.CopyTo(doc);
}
HRESULT WindowsToastNotification::SetupCallbacks(
winui::Notifications::IToastNotification* toast) {
event_handler_ = Make<ToastEventHandler>(this);
RETURN_IF_FAILED(
toast->add_Activated(event_handler_.Get(), &activated_token_));
RETURN_IF_FAILED(
toast->add_Dismissed(event_handler_.Get(), &dismissed_token_));
RETURN_IF_FAILED(toast->add_Failed(event_handler_.Get(), &failed_token_));
return S_OK;
2015-12-25 03:05:48 +00:00
}
bool WindowsToastNotification::RemoveCallbacks(
winui::Notifications::IToastNotification* toast) {
2015-12-25 03:05:48 +00:00
if (FAILED(toast->remove_Activated(activated_token_)))
2015-11-10 11:50:38 +00:00
return false;
2015-12-25 03:05:48 +00:00
if (FAILED(toast->remove_Dismissed(dismissed_token_)))
return false;
2015-12-25 03:05:48 +00:00
return SUCCEEDED(toast->remove_Failed(failed_token_));
}
/*
/ Toast Event Handler
*/
ToastEventHandler::ToastEventHandler(Notification* notification)
2017-03-23 19:48:22 +00:00
: notification_(notification->GetWeakPtr()) {}
ToastEventHandler::~ToastEventHandler() = default;
IFACEMETHODIMP ToastEventHandler::Invoke(
winui::Notifications::IToastNotification* sender,
2017-03-23 19:48:22 +00:00
IInspectable* args) {
chore: bump chromium to 103.0.5046.0 (main) (#33906) * chore: bump chromium in DEPS to 103.0.5020.0 * chore: bump chromium in DEPS to 103.0.5022.0 * chore: bump chromium in DEPS to 103.0.5024.0 * chore: update patches * 3587410: [Printing] Remove JobEventDetails Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3587410 * chore: bump chromium in DEPS to 103.0.5026.0 * chore: update patches * 3577218: WebUI: Delete webui_resources.grd and related GN targets. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3577218 * chore: bump chromium in DEPS to 103.0.5028.0 * chore: update patches * 3579297: Convert UpdatePrintSettings() to use non-deprecated base::Value APIs. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3579297 * 3560622: serial: Add SerialPort.forget() method Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3560622 * 3581708: Restore original display when moving from tab-fullscreen to browser-fullscreen. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3581708 * chore: fix authorization flags lint error * 3583363: Remove net wrappers around base/strings/escape.h Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3583363 * fixup! 3560622: serial: Add SerialPort.forget() method Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3560622 * 3587589: Reland "Propagate the MIME type from DownloadTargetDeterminer to DownloadItem" Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3587589 * 3584006: Remove IsRenderViewLive from content public Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3584006 * 3596174: [api] Remove APIs for resurrecting finalizers Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3596174 * 3368244: Hook SnapshotForContentAnalysis renderer API to scan system prints Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3368244 * chore: bump chromium in DEPS to 103.0.5030.0 * chore: update patches * chore: bump chromium in DEPS to 103.0.5032.0 * chore: bump chromium in DEPS to 103.0.5034.0 * chore: bump chromium in DEPS to 103.0.5036.0 * chore: update patches * 3586363: Introduce PrintRenderFrame.PrintWithParams() for batch printing to PDF Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3586363 * 3593199: Remove content::PermissionType references and replace them with blink::PermissionType Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3593199 * 3368244: Hook SnapshotForContentAnalysis renderer API to scan system prints Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3368244 * chore: lint * chore: bump chromium in DEPS to 103.0.5038.0 * chore: update patches * fixup! 3560622: serial: Add SerialPort.forget() method * 3606495: mac screen capture: add metric Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3606495 * chore: bump chromium in DEPS to 103.0.5040.0 * chore: update patches * 3590840: Add IPs to DnsOverHttpsServerConfig https://chromium-review.googlesource.com/c/chromium/src/+/3590840 * stub functions for ElectronSerialDelegate and SerialChooserController to fix link * 3566412: [base] Remove base/android dependency on post_task.h and officially remove post_task.h! Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * 3347944: [content] No longer hand-off whole MainFunctionParams to BrowserMainParts Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3347944 * fixup! 3566412: [base] Remove base/android dependency on post_task.h and off… e3ea3e1 …icially remove post_task.h! * chore: update process_singleton patches for content::GetIOThreadTaskRunner({}) Ref: 2015655: [BrowserThread] Migrate co/pub/br and co/br/scheduler to the new API | https://chromium-review.googlesource.com/c/chromium/src/+/2015655 * chore: migrate base::DeleteSoon to content::GetUIThreadTaskRunner({})->DeleteSoon Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * chore: remove duplicate functions for RevokePortPermissionWebInitiated & GetPortInfo * chore: migrate Linux/Windows methods off of post_task.h Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * 64908: Stop building legacy SwiftShader GL in Chromium https://swiftshader-review.googlesource.com/c/SwiftShader/+/64908 * 3573245: Added Themed versions of RoundedRectBackground and RoundedRectBorder. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3573245 * chore: bump chromium in DEPS to 103.0.5042.0 * chore: update patches * 3571804: [api] Advance API deprecation for V8 version v10.2 https://chromium-review.googlesource.com/c/v8/v8/+/3571804 * fixup! 3571804: [api] Advance API deprecation for V8 version v10.2 * build: fix run-clang-format extension matching * lint * fix windows build * how is clang-format still not working for me * chore: update patches * 3623985: Replace ad-hoc SetPublicFirstPartySets calls with method in ContentBrowserClient. https://chromium-review.googlesource.com/c/chromium/src/+/3623985 * no need to implement WillProvidePublicFirstPartySets; the default is false * 3601036: [QT] Introduce ui/views/linux_ui/linux_ui_factory.* https://chromium-review.googlesource.com/c/chromium/src/+/3601036 * 3583363: Remove net wrappers around base/strings/escape.h https://chromium-review.googlesource.com/c/chromium/src/+/3583363 * lint * chore: bump chromium in DEPS to 103.0.5044.0 * fix conflicts * chore: update patches * upgrade nan * pin version of nan in tests * replace my hacky deprecated override fix with the fix from upstream * revert runtime dcheck in v8 * pin nan version at root too * refactor: tell gyp to use c++17 when building with our node * Revert "refactor: tell gyp to use c++17 when building with our node" This reverts commit 41a03a5799a8f40f31555d73d20ea865acfcd192. * Undo the reversion of 41a03a5799a8f40f31555d73d20ea865acfcd192. This reverts commit 54440abc598153bd7e259be4a908f0ecc0b33348. * disable sequential/test-cpu-prof-kill for now * also sequential/test-diagnostic-dir-cpu-prof Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: VerteDinde <vertedinde@electronjs.org> Co-authored-by: Jeremy Rose <japthorp@slack-corp.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-05-17 16:48:40 +00:00
content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE,
base::BindOnce(&Notification::NotificationClicked, notification_));
DebugLog("Notification clicked");
return S_OK;
}
IFACEMETHODIMP ToastEventHandler::Invoke(
winui::Notifications::IToastNotification* sender,
winui::Notifications::IToastDismissedEventArgs* e) {
chore: bump chromium to 103.0.5046.0 (main) (#33906) * chore: bump chromium in DEPS to 103.0.5020.0 * chore: bump chromium in DEPS to 103.0.5022.0 * chore: bump chromium in DEPS to 103.0.5024.0 * chore: update patches * 3587410: [Printing] Remove JobEventDetails Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3587410 * chore: bump chromium in DEPS to 103.0.5026.0 * chore: update patches * 3577218: WebUI: Delete webui_resources.grd and related GN targets. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3577218 * chore: bump chromium in DEPS to 103.0.5028.0 * chore: update patches * 3579297: Convert UpdatePrintSettings() to use non-deprecated base::Value APIs. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3579297 * 3560622: serial: Add SerialPort.forget() method Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3560622 * 3581708: Restore original display when moving from tab-fullscreen to browser-fullscreen. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3581708 * chore: fix authorization flags lint error * 3583363: Remove net wrappers around base/strings/escape.h Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3583363 * fixup! 3560622: serial: Add SerialPort.forget() method Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3560622 * 3587589: Reland "Propagate the MIME type from DownloadTargetDeterminer to DownloadItem" Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3587589 * 3584006: Remove IsRenderViewLive from content public Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3584006 * 3596174: [api] Remove APIs for resurrecting finalizers Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3596174 * 3368244: Hook SnapshotForContentAnalysis renderer API to scan system prints Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3368244 * chore: bump chromium in DEPS to 103.0.5030.0 * chore: update patches * chore: bump chromium in DEPS to 103.0.5032.0 * chore: bump chromium in DEPS to 103.0.5034.0 * chore: bump chromium in DEPS to 103.0.5036.0 * chore: update patches * 3586363: Introduce PrintRenderFrame.PrintWithParams() for batch printing to PDF Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3586363 * 3593199: Remove content::PermissionType references and replace them with blink::PermissionType Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3593199 * 3368244: Hook SnapshotForContentAnalysis renderer API to scan system prints Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3368244 * chore: lint * chore: bump chromium in DEPS to 103.0.5038.0 * chore: update patches * fixup! 3560622: serial: Add SerialPort.forget() method * 3606495: mac screen capture: add metric Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3606495 * chore: bump chromium in DEPS to 103.0.5040.0 * chore: update patches * 3590840: Add IPs to DnsOverHttpsServerConfig https://chromium-review.googlesource.com/c/chromium/src/+/3590840 * stub functions for ElectronSerialDelegate and SerialChooserController to fix link * 3566412: [base] Remove base/android dependency on post_task.h and officially remove post_task.h! Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * 3347944: [content] No longer hand-off whole MainFunctionParams to BrowserMainParts Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3347944 * fixup! 3566412: [base] Remove base/android dependency on post_task.h and off… e3ea3e1 …icially remove post_task.h! * chore: update process_singleton patches for content::GetIOThreadTaskRunner({}) Ref: 2015655: [BrowserThread] Migrate co/pub/br and co/br/scheduler to the new API | https://chromium-review.googlesource.com/c/chromium/src/+/2015655 * chore: migrate base::DeleteSoon to content::GetUIThreadTaskRunner({})->DeleteSoon Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * chore: remove duplicate functions for RevokePortPermissionWebInitiated & GetPortInfo * chore: migrate Linux/Windows methods off of post_task.h Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * 64908: Stop building legacy SwiftShader GL in Chromium https://swiftshader-review.googlesource.com/c/SwiftShader/+/64908 * 3573245: Added Themed versions of RoundedRectBackground and RoundedRectBorder. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3573245 * chore: bump chromium in DEPS to 103.0.5042.0 * chore: update patches * 3571804: [api] Advance API deprecation for V8 version v10.2 https://chromium-review.googlesource.com/c/v8/v8/+/3571804 * fixup! 3571804: [api] Advance API deprecation for V8 version v10.2 * build: fix run-clang-format extension matching * lint * fix windows build * how is clang-format still not working for me * chore: update patches * 3623985: Replace ad-hoc SetPublicFirstPartySets calls with method in ContentBrowserClient. https://chromium-review.googlesource.com/c/chromium/src/+/3623985 * no need to implement WillProvidePublicFirstPartySets; the default is false * 3601036: [QT] Introduce ui/views/linux_ui/linux_ui_factory.* https://chromium-review.googlesource.com/c/chromium/src/+/3601036 * 3583363: Remove net wrappers around base/strings/escape.h https://chromium-review.googlesource.com/c/chromium/src/+/3583363 * lint * chore: bump chromium in DEPS to 103.0.5044.0 * fix conflicts * chore: update patches * upgrade nan * pin version of nan in tests * replace my hacky deprecated override fix with the fix from upstream * revert runtime dcheck in v8 * pin nan version at root too * refactor: tell gyp to use c++17 when building with our node * Revert "refactor: tell gyp to use c++17 when building with our node" This reverts commit 41a03a5799a8f40f31555d73d20ea865acfcd192. * Undo the reversion of 41a03a5799a8f40f31555d73d20ea865acfcd192. This reverts commit 54440abc598153bd7e259be4a908f0ecc0b33348. * disable sequential/test-cpu-prof-kill for now * also sequential/test-diagnostic-dir-cpu-prof Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: VerteDinde <vertedinde@electronjs.org> Co-authored-by: Jeremy Rose <japthorp@slack-corp.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-05-17 16:48:40 +00:00
content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE, base::BindOnce(&Notification::NotificationDismissed,
notification_, false));
DebugLog("Notification dismissed");
return S_OK;
}
IFACEMETHODIMP ToastEventHandler::Invoke(
winui::Notifications::IToastNotification* sender,
winui::Notifications::IToastFailedEventArgs* e) {
HRESULT error;
e->get_ErrorCode(&error);
std::string errorMessage =
"Notification failed. HRESULT:" + std::to_string(error);
chore: bump chromium to 103.0.5046.0 (main) (#33906) * chore: bump chromium in DEPS to 103.0.5020.0 * chore: bump chromium in DEPS to 103.0.5022.0 * chore: bump chromium in DEPS to 103.0.5024.0 * chore: update patches * 3587410: [Printing] Remove JobEventDetails Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3587410 * chore: bump chromium in DEPS to 103.0.5026.0 * chore: update patches * 3577218: WebUI: Delete webui_resources.grd and related GN targets. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3577218 * chore: bump chromium in DEPS to 103.0.5028.0 * chore: update patches * 3579297: Convert UpdatePrintSettings() to use non-deprecated base::Value APIs. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3579297 * 3560622: serial: Add SerialPort.forget() method Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3560622 * 3581708: Restore original display when moving from tab-fullscreen to browser-fullscreen. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3581708 * chore: fix authorization flags lint error * 3583363: Remove net wrappers around base/strings/escape.h Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3583363 * fixup! 3560622: serial: Add SerialPort.forget() method Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3560622 * 3587589: Reland "Propagate the MIME type from DownloadTargetDeterminer to DownloadItem" Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3587589 * 3584006: Remove IsRenderViewLive from content public Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3584006 * 3596174: [api] Remove APIs for resurrecting finalizers Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3596174 * 3368244: Hook SnapshotForContentAnalysis renderer API to scan system prints Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3368244 * chore: bump chromium in DEPS to 103.0.5030.0 * chore: update patches * chore: bump chromium in DEPS to 103.0.5032.0 * chore: bump chromium in DEPS to 103.0.5034.0 * chore: bump chromium in DEPS to 103.0.5036.0 * chore: update patches * 3586363: Introduce PrintRenderFrame.PrintWithParams() for batch printing to PDF Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3586363 * 3593199: Remove content::PermissionType references and replace them with blink::PermissionType Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3593199 * 3368244: Hook SnapshotForContentAnalysis renderer API to scan system prints Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3368244 * chore: lint * chore: bump chromium in DEPS to 103.0.5038.0 * chore: update patches * fixup! 3560622: serial: Add SerialPort.forget() method * 3606495: mac screen capture: add metric Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3606495 * chore: bump chromium in DEPS to 103.0.5040.0 * chore: update patches * 3590840: Add IPs to DnsOverHttpsServerConfig https://chromium-review.googlesource.com/c/chromium/src/+/3590840 * stub functions for ElectronSerialDelegate and SerialChooserController to fix link * 3566412: [base] Remove base/android dependency on post_task.h and officially remove post_task.h! Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * 3347944: [content] No longer hand-off whole MainFunctionParams to BrowserMainParts Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3347944 * fixup! 3566412: [base] Remove base/android dependency on post_task.h and off… e3ea3e1 …icially remove post_task.h! * chore: update process_singleton patches for content::GetIOThreadTaskRunner({}) Ref: 2015655: [BrowserThread] Migrate co/pub/br and co/br/scheduler to the new API | https://chromium-review.googlesource.com/c/chromium/src/+/2015655 * chore: migrate base::DeleteSoon to content::GetUIThreadTaskRunner({})->DeleteSoon Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * chore: remove duplicate functions for RevokePortPermissionWebInitiated & GetPortInfo * chore: migrate Linux/Windows methods off of post_task.h Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * 64908: Stop building legacy SwiftShader GL in Chromium https://swiftshader-review.googlesource.com/c/SwiftShader/+/64908 * 3573245: Added Themed versions of RoundedRectBackground and RoundedRectBorder. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3573245 * chore: bump chromium in DEPS to 103.0.5042.0 * chore: update patches * 3571804: [api] Advance API deprecation for V8 version v10.2 https://chromium-review.googlesource.com/c/v8/v8/+/3571804 * fixup! 3571804: [api] Advance API deprecation for V8 version v10.2 * build: fix run-clang-format extension matching * lint * fix windows build * how is clang-format still not working for me * chore: update patches * 3623985: Replace ad-hoc SetPublicFirstPartySets calls with method in ContentBrowserClient. https://chromium-review.googlesource.com/c/chromium/src/+/3623985 * no need to implement WillProvidePublicFirstPartySets; the default is false * 3601036: [QT] Introduce ui/views/linux_ui/linux_ui_factory.* https://chromium-review.googlesource.com/c/chromium/src/+/3601036 * 3583363: Remove net wrappers around base/strings/escape.h https://chromium-review.googlesource.com/c/chromium/src/+/3583363 * lint * chore: bump chromium in DEPS to 103.0.5044.0 * fix conflicts * chore: update patches * upgrade nan * pin version of nan in tests * replace my hacky deprecated override fix with the fix from upstream * revert runtime dcheck in v8 * pin nan version at root too * refactor: tell gyp to use c++17 when building with our node * Revert "refactor: tell gyp to use c++17 when building with our node" This reverts commit 41a03a5799a8f40f31555d73d20ea865acfcd192. * Undo the reversion of 41a03a5799a8f40f31555d73d20ea865acfcd192. This reverts commit 54440abc598153bd7e259be4a908f0ecc0b33348. * disable sequential/test-cpu-prof-kill for now * also sequential/test-diagnostic-dir-cpu-prof Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: VerteDinde <vertedinde@electronjs.org> Co-authored-by: Jeremy Rose <japthorp@slack-corp.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-05-17 16:48:40 +00:00
content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE, base::BindOnce(&Notification::NotificationFailed,
notification_, errorMessage));
DebugLog(errorMessage);
return S_OK;
}
} // namespace electron