Skip to content

Commit

Permalink
chore: address feedback from review
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Oct 17, 2023
1 parent 8dc9de6 commit 6a637fa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/api/notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Emitted when the notification is closed by manual intervention from the user.
This event is not guaranteed to be emitted in all cases where the notification
is closed.

On Windows, the `close` event is emitted when the notification leaves the screen either by programmatic dismissal via `notification.close()`, the user closing the notification, or via system timeout. If the notification remains in the Action Center afterwards, a further call to `notification.close()` will remove the notification from the action center, but the `close` event will not be emitted again.
On Windows, the `close` event can be emitted in one of three ways: programmatic dismissal with `notification.close()`, by the user closing the notification, or via system timeout. If a notification is in the Action Center after the initial `close` event is emitted, a call to `notification.close()` will remove the notification from the action center but the `close` event will not be emitted again.

#### Event: 'reply' _macOS_

Expand Down
9 changes: 7 additions & 2 deletions shell/browser/notifications/notification.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,14 @@ class Notification {

// Shows the notification.
virtual void Show(const NotificationOptions& options) = 0;
// Closes the notification, this instance will be destroyed after the
// notification gets closed.

// Dismisses the notification. On some platforms this will result in full
// removal and destruction of the notification, but if the initial dismissal
// does not fully get rid of the notification it will be destroyed in Remove.
virtual void Dismiss() = 0;

// Removes the notification if it was not fully removed during dismissal,
// as can happen on some platforms including Windows.
virtual void Remove();

// Should be called by derived classes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#include "shell/browser/notifications/win/windows_toast_notification.h"

#include <string_view>

#include <shlobj.h>
#include <wrl\wrappers\corewrappers.h>

Expand Down Expand Up @@ -63,7 +65,7 @@ namespace {
// applying Creators Update (build 15063).
constexpr wchar_t kGroup[] = L"Notifications";

void DebugLog(const std::string& log_msg) {
void DebugLog(std::string_view log_msg) {
if (base::Environment::Create()->HasVar("ELECTRON_DEBUG_NOTIFICATIONS"))
LOG(INFO) << log_msg;
}
Expand Down

0 comments on commit 6a637fa

Please sign in to comment.