Diff
Modified: trunk/Source/WTF/ChangeLog (284239 => 284240)
--- trunk/Source/WTF/ChangeLog 2021-10-15 09:03:25 UTC (rev 284239)
+++ trunk/Source/WTF/ChangeLog 2021-10-15 09:26:08 UTC (rev 284240)
@@ -1,3 +1,13 @@
+2021-10-15 Brady Eidson <beid...@apple.com>
+
+ WebKit Managed Notifications: Skeleton NotificationProvider.
+ <rdar://84275562> and https://bugs.webkit.org/show_bug.cgi?id=231786
+
+ Reviewed by Alex Christensen.
+
+ * Scripts/Preferences/WebPreferencesDebug.yaml:
+ * wtf/PlatformEnableCocoa.h:
+
2021-10-15 Robin Morisset <rmoris...@apple.com>
Revert r284230, my last fixes to the watch build make it break tests
Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesDebug.yaml (284239 => 284240)
--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesDebug.yaml 2021-10-15 09:03:25 UTC (rev 284239)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesDebug.yaml 2021-10-15 09:26:08 UTC (rev 284240)
@@ -32,6 +32,17 @@
WebCore:
default: false
+BuiltInNotifications:
+ type: bool
+ humanReadableName: "Built-In Web Notifications"
+ humanReadableDescription: "Enable built-in WebKit managed notifications"
+ webcoreBinding: none
+ condition: ENABLE(BUILT_IN_NOTIFICATIONS)
+ exposed: [ WebKit ]
+ defaultValue:
+ WebKit:
+ default: false
+
# FIXME: WebKit has an alternate name for this called 'ShowDebugBorders'. We should standardize on one name.
CompositingBordersVisible:
type: bool
Modified: trunk/Source/WTF/wtf/PlatformEnableCocoa.h (284239 => 284240)
--- trunk/Source/WTF/wtf/PlatformEnableCocoa.h 2021-10-15 09:03:25 UTC (rev 284239)
+++ trunk/Source/WTF/wtf/PlatformEnableCocoa.h 2021-10-15 09:26:08 UTC (rev 284240)
@@ -434,6 +434,10 @@
#define ENABLE_NOTIFICATIONS 1
#endif
+#if !defined(ENABLE_BUILT_IN_NOTIFICATIONS) && PLATFORM(IOS)
+#define ENABLE_BUILT_IN_NOTIFICATIONS 1
+#endif
+
#if !defined(ENABLE_ORIENTATION_EVENTS) && PLATFORM(IOS_FAMILY)
#define ENABLE_ORIENTATION_EVENTS 1
#endif
Modified: trunk/Source/WebKit/ChangeLog (284239 => 284240)
--- trunk/Source/WebKit/ChangeLog 2021-10-15 09:03:25 UTC (rev 284239)
+++ trunk/Source/WebKit/ChangeLog 2021-10-15 09:26:08 UTC (rev 284240)
@@ -1,3 +1,64 @@
+2021-10-15 Brady Eidson <beid...@apple.com>
+
+ WebKit Managed Notifications: Skeleton NotificationProvider.
+ <rdar://84275562> and https://bugs.webkit.org/show_bug.cgi?id=231786
+
+ Reviewed by Alex Christensen.
+
+ No new tests (No behavior change yet)
+
+ Currently WebNotificationManagerProxy manages dispatching out stuff to the NotificationProvider SPI
+ that - for example - Safari on Mac implements.
+
+ The interface between the ManagerProxy and the Provider is already the perfect way to add an alternative behavior.
+
+ This introduces the skeleton class of an alternative NotificationProvider that will eventually implement
+ WebKit-managed notifications.
+
+ While under development it will have a global runtime switch so we can A/B test between the client-managed and
+ WebKit-managed notifications. That switch would eventually be replaced by full compile-time behavior which would
+ be decided by a shipping vendor.
+
+ Note: This patch enables the new flag BUILT_IN_NOTIFICATIONS to get the new mechanisms building, but that flag by
+ itself doesn't expose Notifications interfaces in WebCore.
+ That will still require enabling NOTIFICATIONS separately.
+
+ * SourcesCocoa.txt:
+ * UIProcess/API/APINotificationProvider.h:
+ (API::NotificationProvider::isClientReplaceable const): A temporary mechanism to prevent API clients from overriding
+ the built-in NotificationProvider if the feature is enabled. Useful right now because existing Safari does that with existing SPI.
+
+ * UIProcess/API/APIUIClient.h:
+ (API::UIClient::decidePolicyForNotificationPermissionRequest):
+
+ * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+
+ * UIProcess/Cocoa/UIDelegate.h:
+ * UIProcess/Cocoa/UIDelegate.mm:
+ (WebKit::UIDelegate::setDelegate):
+ (WebKit::UIDelegate::UIClient::decidePolicyForNotificationPermissionRequest):
+
+ * UIProcess/Notifications/Cocoa/WebNotificationProviderCocoa.h: Copied from Source/WebKit/UIProcess/API/APINotificationProvider.h.
+ * UIProcess/Notifications/Cocoa/WebNotificationProviderCocoa.mm: Added.
+ (WebKit::WebNotificationProviderCocoa::createIfEnabled):
+ (WebKit::WebNotificationProviderCocoa::WebNotificationProviderCocoa):
+ (WebKit::WebNotificationProviderCocoa::show):
+ (WebKit::WebNotificationProviderCocoa::cancel):
+ (WebKit::WebNotificationProviderCocoa::didDestroyNotification):
+ (WebKit::WebNotificationProviderCocoa::clearNotifications):
+ (WebKit::WebNotificationProviderCocoa::addNotificationManager):
+ (WebKit::WebNotificationProviderCocoa::removeNotificationManager):
+ (WebKit::WebNotificationProviderCocoa::notificationPermissions):
+
+ * UIProcess/Notifications/WebNotificationManagerProxy.cpp:
+ (WebKit::WebNotificationManagerProxy::WebNotificationManagerProxy):
+ (WebKit::WebNotificationManagerProxy::setProvider):
+
+ Fix changes to the Unified Build:
+ * UIProcess/ios/WKHoverPlatter.h:
+ * UIProcess/ios/WKHoverPlatter.mm:
+ * WebKit.xcodeproj/project.pbxproj:
+
2021-10-14 Alex Christensen <achristen...@webkit.org>
Add AdAttributionDaemon plist on iOS
Modified: trunk/Source/WebKit/SourcesCocoa.txt (284239 => 284240)
--- trunk/Source/WebKit/SourcesCocoa.txt 2021-10-15 09:03:25 UTC (rev 284239)
+++ trunk/Source/WebKit/SourcesCocoa.txt 2021-10-15 09:26:08 UTC (rev 284240)
@@ -454,6 +454,8 @@
UIProcess/Network/NetworkProcessProxyCocoa.mm
+UIProcess/Notifications/Cocoa/WebNotificationProviderCocoa.mm
+
UIProcess/ios/forms/WKAirPlayRoutePicker.mm
UIProcess/ios/forms/WKDatePickerViewController.mm
UIProcess/ios/forms/WKDateTimeInputControl.mm
Modified: trunk/Source/WebKit/UIProcess/API/APINotificationProvider.h (284239 => 284240)
--- trunk/Source/WebKit/UIProcess/API/APINotificationProvider.h 2021-10-15 09:03:25 UTC (rev 284239)
+++ trunk/Source/WebKit/UIProcess/API/APINotificationProvider.h 2021-10-15 09:26:08 UTC (rev 284240)
@@ -50,6 +50,8 @@
virtual void addNotificationManager(WebKit::WebNotificationManagerProxy&) { }
virtual void removeNotificationManager(WebKit::WebNotificationManagerProxy&) { }
+ virtual bool isClientReplaceable() const { return true; }
+
virtual HashMap<WTF::String, bool> notificationPermissions() { return HashMap<WTF::String, bool>(); };
};
Modified: trunk/Source/WebKit/UIProcess/API/APIUIClient.h (284239 => 284240)
--- trunk/Source/WebKit/UIProcess/API/APIUIClient.h 2021-10-15 09:03:25 UTC (rev 284239)
+++ trunk/Source/WebKit/UIProcess/API/APIUIClient.h 2021-10-15 09:26:08 UTC (rev 284240)
@@ -137,7 +137,7 @@
virtual void decidePolicyForGeolocationPermissionRequest(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, const WebKit::FrameInfoData&, Function<void(bool)>&) { }
virtual void decidePolicyForUserMediaPermissionRequest(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, SecurityOrigin&, WebKit::UserMediaPermissionRequestProxy& request) { request.doDefaultAction(); }
virtual void checkUserMediaPermissionForOrigin(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, SecurityOrigin&, WebKit::UserMediaPermissionCheckProxy& request) { request.deny(); }
- virtual void decidePolicyForNotificationPermissionRequest(WebKit::WebPageProxy&, SecurityOrigin&, CompletionHandler<void(bool allowed)>&& completionHandler) { completionHandler(false); }
+ virtual void decidePolicyForNotificationPermissionRequest(WebKit::WebPageProxy&, API::SecurityOrigin&, CompletionHandler<void(bool allowed)>&& completionHandler) { completionHandler(false); }
virtual void requestStorageAccessConfirm(WebKit::WebPageProxy&, WebKit::WebFrameProxy*, const WebCore::RegistrableDomain& requestingDomain, const WebCore::RegistrableDomain& currentDomain, CompletionHandler<void(bool)>&& completionHandler) { completionHandler(true); }
// Printing.
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (284239 => 284240)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h 2021-10-15 09:03:25 UTC (rev 284239)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h 2021-10-15 09:26:08 UTC (rev 284240)
@@ -160,6 +160,8 @@
- (void)_webView:(WKWebView *)webView startXRSessionWithCompletionHandler:(void (^)(id))completionHandler WK_API_AVAILABLE(macos(12.0), ios(15.0));
+- (void)_webView:(WKWebView *)webView requestNotificationPermissionForSecurityOrigin:(WKSecurityOrigin *)securityOrigin decisionHandler:(void (^)(BOOL))decisionHandler WK_API_AVAILABLE(macos(10.13.4), ios(WK_IOS_TBA));
+
#if TARGET_OS_IPHONE
- (BOOL)_webView:(WKWebView *)webView shouldIncludeAppLinkActionsForElement:(_WKActivatedElementInfo *)element WK_API_AVAILABLE(ios(9.0));
@@ -242,7 +244,6 @@
- (CGFloat)_webViewFooterHeight:(WKWebView *)webView WK_API_AVAILABLE(macos(10.13.4));
- (void)_webView:(WKWebView *)webView drawHeaderInRect:(CGRect)rect forPageWithTitle:(NSString *)title URL:(NSURL *)url WK_API_AVAILABLE(macos(10.13.4));
- (void)_webView:(WKWebView *)webView drawFooterInRect:(CGRect)rect forPageWithTitle:(NSString *)title URL:(NSURL *)url WK_API_AVAILABLE(macos(10.13.4));
-- (void)_webView:(WKWebView *)webView requestNotificationPermissionForSecurityOrigin:(WKSecurityOrigin *)securityOrigin decisionHandler:(void (^)(BOOL))decisionHandler WK_API_AVAILABLE(macos(10.13.4));
- (void)_webView:(WKWebView *)webview mouseDidMoveOverElement:(_WKHitTestResult *)hitTestResult withFlags:(NSEventModifierFlags)flags userInfo:(id <NSSecureCoding>)userInfo;
- (void)_webView:(WKWebView *)webView didExceedBackgroundResourceLimitWhileInForeground:(_WKResourceLimit)limit WK_API_AVAILABLE(macos(10.13.4));
- (void)_webView:(WKWebView *)webView setResizable:(BOOL)isResizable WK_API_AVAILABLE(macos(10.13.4));
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h (284239 => 284240)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h 2021-10-15 09:03:25 UTC (rev 284239)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h 2021-10-15 09:26:08 UTC (rev 284240)
@@ -104,6 +104,9 @@
void didResignInputElementStrongPasswordAppearance(WebPageProxy&, API::Object*) final;
bool takeFocus(WebPageProxy*, WKFocusDirection) final;
void handleAutoplayEvent(WebPageProxy&, WebCore::AutoplayEvent, OptionSet<WebCore::AutoplayEventFlags>) final;
+
+ void decidePolicyForNotificationPermissionRequest(WebPageProxy&, API::SecurityOrigin&, CompletionHandler<void(bool allowed)>&&) final;
+
#if PLATFORM(MAC)
void showPage(WebPageProxy*) final;
void focus(WebPageProxy*) final;
@@ -122,7 +125,6 @@
void drawHeader(WebPageProxy&, WebFrameProxy&, WebCore::FloatRect&&) final;
void drawFooter(WebPageProxy&, WebFrameProxy&, WebCore::FloatRect&&) final;
- void decidePolicyForNotificationPermissionRequest(WebPageProxy&, API::SecurityOrigin&, CompletionHandler<void(bool allowed)>&&) final;
void unavailablePluginButtonClicked(WebPageProxy&, WKPluginUnavailabilityReason, API::Dictionary&) final;
void mouseDidMoveOverElement(WebPageProxy&, const WebHitTestResultData&, OptionSet<WebEvent::Modifier>, API::Object*);
void didClickAutoFillButton(WebPageProxy&, API::Object*) final;
@@ -194,6 +196,7 @@
bool webViewDidResignInputElementStrongPasswordAppearanceWithUserInfo : 1;
bool webViewTakeFocus : 1;
bool webViewHandleAutoplayEventWithFlags : 1;
+ bool webViewRequestNotificationPermissionForSecurityOriginDecisionHandler : 1;
#if PLATFORM(MAC)
bool showWebView : 1;
bool focusWebView : 1;
@@ -215,7 +218,6 @@
bool webViewDidExceedBackgroundResourceLimitWhileInForeground : 1;
bool webViewSaveDataToFileSuggestedFilenameMimeTypeOriginatingURL : 1;
bool webViewRunOpenPanelWithParametersInitiatedByFrameCompletionHandler : 1;
- bool webViewRequestNotificationPermissionForSecurityOriginDecisionHandler : 1;
bool webViewConfigurationForLocalInspector : 1;
bool webViewDidAttachLocalInspector : 1;
bool webViewWillCloseLocalInspector : 1;
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (284239 => 284240)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2021-10-15 09:03:25 UTC (rev 284239)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2021-10-15 09:26:08 UTC (rev 284240)
@@ -113,6 +113,7 @@
m_delegateMethods.webViewDidResignInputElementStrongPasswordAppearanceWithUserInfo = [delegate respondsToSelector:@selector(_webView:didResignInputElementStrongPasswordAppearanceWithUserInfo:)];
m_delegateMethods.webViewTakeFocus = [delegate respondsToSelector:@selector(_webView:takeFocus:)];
m_delegateMethods.webViewHandleAutoplayEventWithFlags = [delegate respondsToSelector:@selector(_webView:handleAutoplayEvent:withFlags:)];
+ m_delegateMethods.webViewRequestNotificationPermissionForSecurityOriginDecisionHandler = [delegate respondsToSelector:@selector(_webView:requestNotificationPermissionForSecurityOrigin:decisionHandler:)];
#if PLATFORM(MAC)
m_delegateMethods.showWebView = [delegate respondsToSelector:@selector(_showWebView:)];
@@ -135,7 +136,6 @@
m_delegateMethods.webViewDidExceedBackgroundResourceLimitWhileInForeground = [delegate respondsToSelector:@selector(_webView:didExceedBackgroundResourceLimitWhileInForeground:)];
m_delegateMethods.webViewSaveDataToFileSuggestedFilenameMimeTypeOriginatingURL = [delegate respondsToSelector:@selector(_webView:saveDataToFile:suggestedFilename:mimeType:originatingURL:)];
m_delegateMethods.webViewRunOpenPanelWithParametersInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runOpenPanelWithParameters:initiatedByFrame:completionHandler:)];
- m_delegateMethods.webViewRequestNotificationPermissionForSecurityOriginDecisionHandler = [delegate respondsToSelector:@selector(_webView:requestNotificationPermissionForSecurityOrigin:decisionHandler:)];
m_delegateMethods.webViewConfigurationForLocalInspector = [delegate respondsToSelector:@selector(_webView:configurationForLocalInspector:)];
m_delegateMethods.webViewDidAttachLocalInspector = [delegate respondsToSelector:@selector(_webView:didAttachLocalInspector:)];
m_delegateMethods.webViewWillCloseLocalInspector = [delegate respondsToSelector:@selector(_webView:willCloseLocalInspector:)];
@@ -616,6 +616,27 @@
[(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate->m_webView.get().get() handleAutoplayEvent:toWKAutoplayEvent(event) withFlags:toWKAutoplayEventFlags(flags)];
}
+void UIDelegate::UIClient::decidePolicyForNotificationPermissionRequest(WebKit::WebPageProxy&, API::SecurityOrigin& securityOrigin, CompletionHandler<void(bool allowed)>&& completionHandler)
+{
+ if (!m_uiDelegate)
+ return completionHandler(false);
+
+ if (!m_uiDelegate->m_delegateMethods.webViewRequestNotificationPermissionForSecurityOriginDecisionHandler)
+ return completionHandler(false);
+
+ auto delegate = m_uiDelegate->m_delegate.get();
+ if (!delegate)
+ return completionHandler(false);
+
+ auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:requestNotificationPermissionForSecurityOrigin:decisionHandler:));
+ [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate->m_webView.get().get() requestNotificationPermissionForSecurityOrigin:wrapper(securityOrigin) decisionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (BOOL result) mutable {
+ if (checker->completionHandlerHasBeenCalled())
+ return;
+ checker->didCallCompletionHandler();
+ completionHandler(result);
+ }).get()];
+}
+
#if PLATFORM(MAC)
bool UIDelegate::UIClient::canRunModal() const
{
@@ -947,27 +968,6 @@
[(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate->m_webView.get().get() saveDataToFile:wrapper(data) suggestedFilename:suggestedFilename mimeType:mimeType originatingURL:originatingURL];
}
-void UIDelegate::UIClient::decidePolicyForNotificationPermissionRequest(WebKit::WebPageProxy&, API::SecurityOrigin& securityOrigin, CompletionHandler<void(bool allowed)>&& completionHandler)
-{
- if (!m_uiDelegate)
- return completionHandler(false);
-
- if (!m_uiDelegate->m_delegateMethods.webViewRequestNotificationPermissionForSecurityOriginDecisionHandler)
- return completionHandler(false);
-
- auto delegate = m_uiDelegate->m_delegate.get();
- if (!delegate)
- return completionHandler(false);
-
- auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:requestNotificationPermissionForSecurityOrigin:decisionHandler:));
- [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate->m_webView.get().get() requestNotificationPermissionForSecurityOrigin:wrapper(securityOrigin) decisionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (BOOL result) mutable {
- if (checker->completionHandlerHasBeenCalled())
- return;
- checker->didCallCompletionHandler();
- completionHandler(result);
- }).get()];
-}
-
Ref<API::InspectorConfiguration> UIDelegate::UIClient::configurationForLocalInspector(WebPageProxy&, WebInspectorUIProxy& inspector)
{
if (!m_uiDelegate)
Copied: trunk/Source/WebKit/UIProcess/Notifications/Cocoa/WebNotificationProviderCocoa.h (from rev 284239, trunk/Source/WebKit/UIProcess/API/APINotificationProvider.h) (0 => 284240)
--- trunk/Source/WebKit/UIProcess/Notifications/Cocoa/WebNotificationProviderCocoa.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/Notifications/Cocoa/WebNotificationProviderCocoa.h 2021-10-15 09:26:08 UTC (rev 284240)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(BUILT_IN_NOTIFICATIONS) && PLATFORM(COCOA)
+
+#include "APINotificationProvider.h"
+#include <wtf/Forward.h>
+
+namespace WebKit {
+
+class WebNotification;
+class WebNotificationManagerProxy;
+class WebPageProxy;
+
+class WebNotificationProviderCocoa : public API::NotificationProvider {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ static std::unique_ptr<WebNotificationProviderCocoa> createIfEnabled();
+ explicit WebNotificationProviderCocoa();
+
+ void show(WebPageProxy&, WebNotification&) final;
+ void cancel(WebNotification&) final;
+ void didDestroyNotification(WebNotification&) final;
+ void clearNotifications(const Vector<uint64_t>& notificationIDs) final;
+
+ void addNotificationManager(WebNotificationManagerProxy&) final;
+ void removeNotificationManager(WebNotificationManagerProxy&) final;
+
+ bool isClientReplaceable() const final { return false; }
+
+ HashMap<WTF::String, bool> notificationPermissions() final;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(BUILT_IN_NOTIFICATIONS) && PLATFORM(COCOA)
Copied: trunk/Source/WebKit/UIProcess/Notifications/Cocoa/WebNotificationProviderCocoa.mm (from rev 284239, trunk/Source/WebKit/UIProcess/ios/WKHoverPlatter.h) (0 => 284240)
--- trunk/Source/WebKit/UIProcess/Notifications/Cocoa/WebNotificationProviderCocoa.mm (rev 0)
+++ trunk/Source/WebKit/UIProcess/Notifications/Cocoa/WebNotificationProviderCocoa.mm 2021-10-15 09:26:08 UTC (rev 284240)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "WebNotificationProviderCocoa.h"
+
+#if ENABLE(BUILT_IN_NOTIFICATIONS)
+
+#import "WebPreferencesKeys.h"
+
+namespace WebKit {
+
+std::unique_ptr<WebNotificationProviderCocoa> WebNotificationProviderCocoa::createIfEnabled()
+{
+ // FIXME: Remove this defaults lookup and preferences key once feature development is complete. <rdar://84268742>
+ if ([[NSUserDefaults standardUserDefaults] boolForKey:static_cast<NSString *>(WebPreferencesKey::builtInNotificationsKey())])
+ return WTF::makeUnique<WebNotificationProviderCocoa>();
+ return nullptr;
+}
+
+WebNotificationProviderCocoa::WebNotificationProviderCocoa()
+{
+}
+
+void WebNotificationProviderCocoa::show(WebPageProxy&, WebNotification&)
+{
+}
+
+void WebNotificationProviderCocoa::cancel(WebNotification&)
+{
+}
+
+void WebNotificationProviderCocoa::didDestroyNotification(WebNotification&)
+{
+}
+
+void WebNotificationProviderCocoa::clearNotifications(const Vector<uint64_t>&)
+{
+}
+
+void WebNotificationProviderCocoa::addNotificationManager(WebNotificationManagerProxy&)
+{
+}
+
+void WebNotificationProviderCocoa::removeNotificationManager(WebNotificationManagerProxy&)
+{
+}
+
+HashMap<WTF::String, bool> WebNotificationProviderCocoa::notificationPermissions()
+{
+ return HashMap<WTF::String, bool>();
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(BUILT_IN_NOTIFICATIONS)
Modified: trunk/Source/WebKit/UIProcess/Notifications/WebNotificationManagerProxy.cpp (284239 => 284240)
--- trunk/Source/WebKit/UIProcess/Notifications/WebNotificationManagerProxy.cpp 2021-10-15 09:03:25 UTC (rev 284239)
+++ trunk/Source/WebKit/UIProcess/Notifications/WebNotificationManagerProxy.cpp 2021-10-15 09:26:08 UTC (rev 284240)
@@ -35,6 +35,10 @@
#include "WebProcessPool.h"
#include "WebProcessProxy.h"
+#if PLATFORM(COCOA)
+#include "WebNotificationProviderCocoa.h"
+#endif
+
namespace WebKit {
using namespace WebCore;
@@ -56,12 +60,19 @@
WebNotificationManagerProxy::WebNotificationManagerProxy(WebProcessPool* processPool)
: WebContextSupplement(processPool)
- , m_provider(makeUnique<API::NotificationProvider>())
{
+#if ENABLE(BUILT_IN_NOTIFICATIONS) && PLATFORM(COCOA)
+ m_provider = WebNotificationProviderCocoa::createIfEnabled();
+#endif
+ if (!m_provider)
+ m_provider = makeUnique<API::NotificationProvider>();
}
void WebNotificationManagerProxy::setProvider(std::unique_ptr<API::NotificationProvider>&& provider)
{
+ if (m_provider && !m_provider->isClientReplaceable())
+ return;
+
if (!provider) {
m_provider = makeUnique<API::NotificationProvider>();
return;
Modified: trunk/Source/WebKit/UIProcess/ios/WKHoverPlatter.h (284239 => 284240)
--- trunk/Source/WebKit/UIProcess/ios/WKHoverPlatter.h 2021-10-15 09:03:25 UTC (rev 284239)
+++ trunk/Source/WebKit/UIProcess/ios/WKHoverPlatter.h 2021-10-15 09:26:08 UTC (rev 284240)
@@ -25,6 +25,14 @@
#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) || ENABLE(HOVER_GESTURE_RECOGNIZER)
+#import <UIKit/UIKit.h>
+#import <WebCore/FloatPoint.h>
+
+namespace WebKit {
+struct InteractionInformationAtPosition;
+struct InteractionInformationRequest;
+}
+
@class WKHoverPlatter;
@protocol WKHoverPlatterDelegate
Modified: trunk/Source/WebKit/UIProcess/ios/WKHoverPlatter.mm (284239 => 284240)
--- trunk/Source/WebKit/UIProcess/ios/WKHoverPlatter.mm 2021-10-15 09:03:25 UTC (rev 284239)
+++ trunk/Source/WebKit/UIProcess/ios/WKHoverPlatter.mm 2021-10-15 09:26:08 UTC (rev 284240)
@@ -28,10 +28,13 @@
#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) || ENABLE(HOVER_GESTURE_RECOGNIZER)
+#import "InteractionInformationAtPosition.h"
+#import "InteractionInformationRequest.h"
#import "WKHoverPlatterParameters.h"
#import <WebCore/PathUtilities.h>
#import <WebCore/WebCoreCALayerExtras.h>
#import <pal/spi/cocoa/QuartzCoreSPI.h>
+#import <wtf/WeakObjCPtr.h>
static RetainPtr<CABasicAnimation> createBaseAnimation()
{
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (284239 => 284240)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-10-15 09:03:25 UTC (rev 284239)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-10-15 09:26:08 UTC (rev 284240)
@@ -1032,6 +1032,7 @@
5123CF1C133D260A0056F800 /* WKIconDatabaseCG.h in Headers */ = {isa = PBXBuildFile; fileRef = 5123CF1A133D260A0056F800 /* WKIconDatabaseCG.h */; settings = {ATTRIBUTES = (Private, ); }; };
51240EBA220A08D2005CFC63 /* DownloadMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 51240EB8220A08CA005CFC63 /* DownloadMap.h */; };
51240EC0220B694C005CFC63 /* NetworkResourceLoadMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 51240EBE220B6947005CFC63 /* NetworkResourceLoadMap.h */; };
+ 5127148327024F0300197034 /* WebNotificationProviderCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 5127148227024EFC00197034 /* WebNotificationProviderCocoa.h */; };
512935D81288D19400A4B695 /* WebContextMenuItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 512935D61288D19400A4B695 /* WebContextMenuItem.h */; };
512935E41288D97800A4B695 /* InjectedBundlePageContextMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 512935E21288D97800A4B695 /* InjectedBundlePageContextMenuClient.h */; };
5129EB1223D0DE7B00AF1CD7 /* ContentWorldShared.h in Headers */ = {isa = PBXBuildFile; fileRef = 5129EB1123D0DE7800AF1CD7 /* ContentWorldShared.h */; };
@@ -4140,6 +4141,8 @@
51240EB9220A08CA005CFC63 /* DownloadMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DownloadMap.cpp; sourceTree = "<group>"; };
51240EBE220B6947005CFC63 /* NetworkResourceLoadMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkResourceLoadMap.h; sourceTree = "<group>"; };
51240EBF220B6948005CFC63 /* NetworkResourceLoadMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkResourceLoadMap.cpp; sourceTree = "<group>"; };
+ 5127148127024EFC00197034 /* WebNotificationProviderCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNotificationProviderCocoa.mm; sourceTree = "<group>"; };
+ 5127148227024EFC00197034 /* WebNotificationProviderCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNotificationProviderCocoa.h; sourceTree = "<group>"; };
512935D51288D19400A4B695 /* WebContextMenuItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenuItem.cpp; sourceTree = "<group>"; };
512935D61288D19400A4B695 /* WebContextMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuItem.h; sourceTree = "<group>"; };
512935E11288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageContextMenuClient.cpp; sourceTree = "<group>"; };
@@ -8153,6 +8156,7 @@
31A2EC401489973700810D71 /* Notifications */ = {
isa = PBXGroup;
children = (
+ 5127148027024ECC00197034 /* Cocoa */,
31A2EC531489982500810D71 /* NotificationPermissionRequest.h */,
31A2EC41148997BE00810D71 /* WebNotification.cpp */,
31A2EC42148997BE00810D71 /* WebNotification.h */,
@@ -9025,6 +9029,15 @@
name = cg;
sourceTree = "<group>";
};
+ 5127148027024ECC00197034 /* Cocoa */ = {
+ isa = PBXGroup;
+ children = (
+ 5127148227024EFC00197034 /* WebNotificationProviderCocoa.h */,
+ 5127148127024EFC00197034 /* WebNotificationProviderCocoa.mm */,
+ );
+ path = Cocoa;
+ sourceTree = "<group>";
+ };
512A9754180DF9270039A149 /* Databases */ = {
isa = PBXGroup;
children = (
@@ -12301,6 +12314,7 @@
7C89D2941A67122F003A5FDE /* APIUserScript.h in Headers */,
2D8786241BDB58FF00D02ABB /* APIUserStyleSheet.h in Headers */,
C5E1AFED16B21017006CC1F2 /* APIWebArchive.h in Headers */,
+ 5127148327024F0300197034 /* WebNotificationProviderCocoa.h in Headers */,
C5E1AFEF16B21029006CC1F2 /* APIWebArchiveResource.h in Headers */,
579F1BFC23C811CF00C7D4B4 /* APIWebAuthenticationAssertionResponse.h in Headers */,
57EBE26A234676C5008D8AF9 /* APIWebAuthenticationPanel.h in Headers */,
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (284239 => 284240)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2021-10-15 09:03:25 UTC (rev 284239)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2021-10-15 09:26:08 UTC (rev 284240)
@@ -1,3 +1,14 @@
+2021-10-15 Brady Eidson <beid...@apple.com>
+
+ WebKit Managed Notifications: Skeleton NotificationProvider.
+ <rdar://84275562> and https://bugs.webkit.org/show_bug.cgi?id=231786
+
+ Reviewed by Alex Christensen.
+
+ * WebCoreSupport/WebNotificationClient.mm:
+ (-[WebNotificationPolicyListener NO_RETURN_DUE_TO_ASSERT]):
+ (-[WebNotificationPolicyListener denyOnlyThisRequest]): Deleted.
+
2021-10-14 Alex Christensen <achristen...@webkit.org>
Remove Variant.h
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebNotificationClient.mm (284239 => 284240)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebNotificationClient.mm 2021-10-15 09:03:25 UTC (rev 284239)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebNotificationClient.mm 2021-10-15 09:26:08 UTC (rev 284240)
@@ -192,7 +192,7 @@
}
#if PLATFORM(IOS_FAMILY)
-- (void)denyOnlyThisRequest
+- (void)denyOnlyThisRequest NO_RETURN_DUE_TO_ASSERT
{
ASSERT_NOT_REACHED();
}