Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: full support for persistent HTML5 notifications #35810

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
bea2c36
feat: BREAKING CHANGE: full support for HTML5 notifications (WIN and …
YuriL180821 Sep 25, 2022
429b05b
fix: resolve problem with Notifications BrowserContext
YuriL180821 Dec 23, 2021
4250b8d
feat: workaround with toast scenario type to allow infinite toast dis…
YuriL180821 Dec 9, 2021
0afafcd
feat: support for put_SuppressPopup to establish renotify property (WIN)
YuriL180821 Jan 10, 2022
0d3601b
feat: initial commit for renotify feature support (MacOS)
YuriL180821 Feb 7, 2022
6a7fc1c
fix: full support for renotify property
YuriL180821 Feb 16, 2022
3e35815
fix: silencing IncommingCall sound and playing default sound by PlayS…
YuriL180821 Feb 8, 2022
1367c22
feat: support image property for XML scheme and necessary refactoring…
YuriL180821 Feb 17, 2022
9c2dfc1
fix: swap for icon and image paths
YuriL180821 Mar 5, 2022
9746861
feat: support notificationsComDisplayName property
YuriL180821 Mar 21, 2022
eab0882
fix: refine requireInterraction silent scheme
YuriL180821 May 20, 2022
1126ea6
fix: replace base::PostTask to content::GetUIThreadTaskRunner
YuriL180821 Jun 16, 2022
05f154e
fix: changes regarding new prototype of WebNotificationAllowed
YuriL180821 Sep 25, 2022
e7fd2f2
fix: signed / unsigned comparison
YuriL180821 Sep 25, 2022
a5e2de4
fix: lint check errors
YuriL180821 Sep 27, 2022
de76a80
Revert "feat: initial commit for renotify feature support (MacOS)"
YuriL180821 Oct 7, 2022
ce712f2
temporary exclusion MacOS environment
YuriL180821 Oct 7, 2022
dff6937
fix: Requested landing changes for Windows platform
YuriL180821 Feb 20, 2023
02eb717
fix: lint check errors
YuriL180821 Apr 8, 2023
76e5bb8
revert changes for electron_browser_context.cc from 1359c9d3ca10e950d…
YuriL180821 Apr 8, 2023
d4f6df3
Revert "fix: resolve problem with Notifications BrowserContext"
YuriL180821 Apr 8, 2023
25f1478
feat: make earlier exit in case if Notification::WebContents is nullptr
YuriL180821 Apr 9, 2023
541a217
feat: v8 data property processing
YuriL180821 May 9, 2023
5cca79c
feat: full simplification for the HTML5 notifications feature
YuriL180821 May 7, 2023
60e8601
fix test for app_name in api-notification-dbus-spec.ts
YuriL180821 May 7, 2023
fa236b0
feat: impovement for WRL::Activate parameters packing into json
YuriL180821 May 12, 2023
d9fbdc6
fix: replacement bare BrowserContext pointer on raw_ptr
YuriL180821 May 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: support for put_SuppressPopup to establish renotify property (WIN)
support renotify property for Platform service
  • Loading branch information
YuriL180821 committed May 13, 2023
commit 0afafcd19f97a7b9f4b8800285c159a97e191935
2 changes: 2 additions & 0 deletions shell/browser/notifications/notification.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ struct NotificationOptions {
bool require_interaction; // SAP-17772: configuration toast show time
// according to
// Notification.requireInteraction property
bool should_be_presented; // 16-SAP-18595: display toast according to
// Notification.renotify

NotificationOptions();
~NotificationOptions();
Expand Down
18 changes: 14 additions & 4 deletions shell/browser/notifications/platform_notification_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ void OnWebNotificationAllowed(base::WeakPtr<Notification> notification,
const SkBitmap& icon,
const blink::PlatformNotificationData& data,
bool is_persistent,
bool is_replacing,
bool audio_muted,
bool allowed) {
if (!notification)
Expand All @@ -47,6 +48,8 @@ void OnWebNotificationAllowed(base::WeakPtr<Notification> notification,
// feat: configuration toast show time according to
// Notification.requireInteraction property
options.require_interaction = data.require_interaction;
// feat: display toast according to Notification.renotify
options.should_be_presented = data.renotify ? true : !is_replacing;
// feat: support Notification.data property
// header calculation bellow is caused by presence some not described hader
// into data received see ReadData in
Expand Down Expand Up @@ -185,7 +188,9 @@ void PlatformNotificationService::DisplayNotification(
// the same tag is already extant.
//
// See: https://notifications.spec.whatwg.org/#showing-a-notification
const size_t prev_notif_count = presenter->notifications().size();
presenter->CloseNotificationWithId(notification_id);
const size_t curr_notif_count = presenter->notifications().size();

auto* delegate = new NotificationDelegateImpl(notification_id, origin);

Expand All @@ -194,11 +199,12 @@ void PlatformNotificationService::DisplayNotification(
// feat: correct processing for the persistent notification without
// actions
const bool is_persistent(false);
const bool is_replacing(prev_notif_count > curr_notif_count);
browser_client_->WebNotificationAllowed(
content::WebContents::FromRenderFrameHost(render_frame_host),
base::BindRepeating(&OnWebNotificationAllowed, notification,
notification_resources.notification_icon,
notification_data, is_persistent));
notification_data, is_persistent, is_replacing));
}
}

Expand All @@ -216,7 +222,9 @@ void PlatformNotificationService::DisplayPersistentNotification(
if (!presenter)
return;

const size_t prev_notif_count = presenter->notifications().size();
presenter->CloseNotificationWithId(notification_id);
const size_t curr_notif_count = presenter->notifications().size();

auto* delegate = new NotificationDelegateImpl(notification_id, origin);

Expand All @@ -229,10 +237,12 @@ void PlatformNotificationService::DisplayPersistentNotification(
// feat: correct processing for the persistent notification without
// actions
const bool is_persistent(true);
const bool is_replacing(prev_notif_count > curr_notif_count);
browser_client_->WebNotificationAllowed(
web_ctx, base::BindRepeating(&OnWebNotificationAllowed, notification,
notification_resources.notification_icon,
notification_data, is_persistent));
web_ctx,
base::BindRepeating(&OnWebNotificationAllowed, notification,
notification_resources.notification_icon,
notification_data, is_persistent, is_replacing));
// OnWebNotificationAllowed( notification,
// notification_resources.notification_icon,
// notification_data, is_persistent, false, true);
Expand Down
5 changes: 5 additions & 0 deletions shell/browser/notifications/win/windows_toast_notification.cc
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,11 @@ HRESULT WindowsToastNotification::ShowInternal(
toast_notification2_->put_Tag(HStringReference(hex_str.c_str()).Get()),
"WinAPI: put_Tag failed");

// 16-SAP-18595: display toast according to Notification.renotify
REPORT_AND_RETURN_IF_FAILED(
toast_notification2_->put_SuppressPopup(!options.should_be_presented),
"WinAPI: setup put_Suppress failed");

REPORT_AND_RETURN_IF_FAILED(SetupCallbacks(toast_notification_.Get()),
"WinAPI: SetupCallbacks failed");

Expand Down