[webkit-changes] [WebKit/WebKit] b37edf: Route notification permission requests through web...

bnham noreply at github.com
Wed Jul 31 09:21:10 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b37edf6d5b9ef66cda7e8f9246c7d06225888c0d
      https://github.com/WebKit/WebKit/commit/b37edf6d5b9ef66cda7e8f9246c7d06225888c0d
  Author: Ben Nham <nham at apple.com>
  Date:   2024-07-31 (Wed, 31 Jul 2024)

  Changed paths:
    M Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp
    M Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.h
    M Source/WebKit/Platform/spi/Cocoa/UserNotificationsSPI.h
    M Source/WebKit/Shared/Notifications/NotificationManagerMessageHandler.h
    M Source/WebKit/Shared/Notifications/NotificationManagerMessageHandler.messages.in
    M Source/WebKit/UIProcess/Notifications/ServiceWorkerNotificationHandler.cpp
    M Source/WebKit/UIProcess/Notifications/ServiceWorkerNotificationHandler.h
    M Source/WebKit/UIProcess/Notifications/WebNotificationManagerMessageHandler.cpp
    M Source/WebKit/UIProcess/Notifications/WebNotificationManagerMessageHandler.h
    M Source/WebKit/WebProcess/Notifications/WebNotificationManager.cpp
    M Source/WebKit/WebProcess/Notifications/WebNotificationManager.h
    M Source/WebKit/WebProcess/WebCoreSupport/WebNotificationClient.cpp
    M Source/WebKit/webpushd/PushClientConnection.h
    M Source/WebKit/webpushd/PushClientConnection.messages.in
    M Source/WebKit/webpushd/PushClientConnection.mm
    M Source/WebKit/webpushd/WebPushDaemon.h
    M Source/WebKit/webpushd/WebPushDaemon.mm
    M Source/WebKit/webpushd/_WKMockUserNotificationCenter.h
    M Source/WebKit/webpushd/_WKMockUserNotificationCenter.mm
    M Source/WebKit/webpushd/webpushtool/WebPushToolConnection.h
    M Source/WebKit/webpushd/webpushtool/WebPushToolConnection.mm
    M Source/WebKit/webpushd/webpushtool/WebPushToolMain.mm

  Log Message:
  -----------
  Route notification permission requests through webpushd
https://bugs.webkit.org/show_bug.cgi?id=277101
rdar://131367050

Reviewed by Brady Eidson.

When running in built-in notifications mode, we should route push and notification permission
requests through webpushd rather than through the embedder.

We want to centralize notification and permission management in webpushd because it reduces the
amount of duplicate boilerplate code to write in each embedder, and it makes it much easier to keep
the state of permissions and push subscriptions in sync.

Testing is currently through an app that toggles on the built-in notification setting, as well as
via webpushtool. This patch is hooked up to use _WKMockUserNotificationCenter though, so it should
be easy to add an integration test for this in a future patch when I actually hook up
Notification.permission and PushManager.permissionState to webpushd.

* Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.cpp:
(WebKit::NetworkNotificationManager::requestPermission):
(WebKit::NetworkNotificationManager::getPushPermissionState):
* Source/WebKit/NetworkProcess/Notifications/NetworkNotificationManager.h:
* Source/WebKit/Platform/spi/Cocoa/UserNotificationsSPI.h:
* Source/WebKit/Shared/Notifications/NotificationManagerMessageHandler.h:
* Source/WebKit/Shared/Notifications/NotificationManagerMessageHandler.messages.in:
* Source/WebKit/UIProcess/Notifications/ServiceWorkerNotificationHandler.cpp:
(WebKit::ServiceWorkerNotificationHandler::requestPermission):
* Source/WebKit/UIProcess/Notifications/ServiceWorkerNotificationHandler.h:
* Source/WebKit/UIProcess/Notifications/WebNotificationManagerMessageHandler.cpp:
(WebKit::WebNotificationManagerMessageHandler::requestPermission):
* Source/WebKit/UIProcess/Notifications/WebNotificationManagerMessageHandler.h:
* Source/WebKit/WebProcess/Notifications/WebNotificationManager.cpp:
(WebKit::sendNotificationMessageWithAsyncReply):
(WebKit::WebNotificationManager::requestPermission):
* Source/WebKit/WebProcess/Notifications/WebNotificationManager.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebNotificationClient.cpp:
(WebKit::WebNotificationClient::requestPermission):
* Source/WebKit/webpushd/PushClientConnection.h:
* Source/WebKit/webpushd/PushClientConnection.messages.in:
* Source/WebKit/webpushd/PushClientConnection.mm:
(WebPushD::PushClientConnection::getPushPermissionState):
(WebPushD::PushClientConnection::requestPushPermission):
(WebPushD::PushClientConnection::showNotification):
(WebPushD::PushClientConnection::getNotifications):
* Source/WebKit/webpushd/WebPushDaemon.h:
* Source/WebKit/webpushd/WebPushDaemon.mm:
(WebPushD::WebPushDaemon::getPushPermissionState):
(WebPushD::WebPushDaemon::requestPushPermission):
* Source/WebKit/webpushd/_WKMockUserNotificationCenter.h:
* Source/WebKit/webpushd/_WKMockUserNotificationCenter.mm:
(notificationPermissions):
(-[_WKMockUserNotificationCenter initWithBundleIdentifier:]):
(-[_WKMockUserNotificationCenter addNotificationRequest:withCompletionHandler:]):
(-[_WKMockUserNotificationCenter getDeliveredNotificationsWithCompletionHandler:]):
(-[_WKMockUserNotificationCenter getNotificationSettingsWithCompletionHandler:]):
(-[_WKMockUserNotificationCenter requestAuthorizationWithOptions:completionHandler:]):
* Source/WebKit/webpushd/webpushtool/WebPushToolConnection.h:
* Source/WebKit/webpushd/webpushtool/WebPushToolConnection.mm:
(WebPushTool::Connection::getPushPermissionState):
(WebPushTool::Connection::requestPushPermission):
* Source/WebKit/webpushd/webpushtool/WebPushToolMain.mm:
(printUsageAndTerminate):
(WebKit::WebPushToolVerb::done):
(WebKit::InjectPushMessageVerb::InjectPushMessageVerb):
(WebKit::GetPushPermissionStateVerb::GetPushPermissionStateVerb):
(WebKit::RequestPushPermissionVerb::RequestPushPermissionVerb):
(WebKit::WebPushToolMain):

Canonical link: https://commits.webkit.org/281654@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list