Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ed057f97998a9d045854af1bab40e8c4e420b759
      
https://github.com/WebKit/WebKit/commit/ed057f97998a9d045854af1bab40e8c4e420b759
  Author: Wenson Hsieh <[email protected]>
  Date:   2024-08-07 (Wed, 07 Aug 2024)

  Changed paths:
    M Source/WTF/wtf/PlatformEnableCocoa.h
    M Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
    M Source/WebKit/NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm
    A Source/WebKit/Platform/cocoa/CocoaWindow.h
    M Source/WebKit/Platform/cocoa/PaymentAuthorizationPresenter.h
    M Source/WebKit/Platform/ios/PaymentAuthorizationController.mm
    M Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp
    M Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h
    M Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h
    M Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm
    M Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
    M Source/WebKit/UIProcess/PageClient.h
    M Source/WebKit/UIProcess/WebPageProxyInternals.h
    M Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
    M Source/WebKit/UIProcess/mac/PageClientImplMac.h
    M Source/WebKit/UIProcess/mac/PageClientImplMac.mm
    M Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj

  Log Message:
  -----------
  Refactor some Apple Pay logic for presenting PaymentAuthorizationController 
in the UI process
https://bugs.webkit.org/show_bug.cgi?id=277773
rdar://133326929

Reviewed by Abrar Rahman Protyasha.

Refactor logic for presenting payment authorization controllers on iOS family 
platforms, in the case
where `WebPaymentCoordinatorProxy` is being hosted in the UI process when 
`APPLE_PAY_REMOTE_UI` is
disabled. See below for more details.

* Source/WTF/wtf/PlatformEnableCocoa.h

Turn `APPLE_PAY_REMOTE_UI` back off.

* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h:
* Source/WebKit/NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm:
(WebKit::NetworkConnectionToWebProcess::paymentCoordinatorPresentingWindow 
const):
* Source/WebKit/Platform/cocoa/CocoaWindow.h: Added.

Add a new project header to define `CocoaWindow` as either `NSWindow` or 
`UIWindow`, to make Cocoa
platform-agnostic code a bit easier to write (see below).

* Source/WebKit/Platform/cocoa/PaymentAuthorizationPresenter.h:
* Source/WebKit/Platform/ios/PaymentAuthorizationController.mm:
(-[WKPaymentAuthorizationControllerDelegate initWithRequest:presenter:]):

Store the `presentingWindowForPaymentAuthorization` when creating the delegate, 
and return it in the
delegate method below.

(-[WKPaymentAuthorizationControllerDelegate 
presentationWindowForPaymentAuthorizationController:]):
* Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
(WebKit::WebPaymentCoordinatorProxy::presentingWindowForPaymentAuthorization 
const):

Add a new client hook to ask for the presenting window for showing payment 
authorization UI. This
will either be `nil` in the case where the payment coordinator proxy lives in 
the network process,
or it'll return the `WKWebView`'s containing `UIWindow` in the case where it's 
being presented from
the UI process.

* Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h:
* Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h:
* Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm:
(WebKit::PageClientImplCocoa::platformWindow const):

Refactor this page client hook to be present on both iOS and macOS.

* Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::Internals::paymentCoordinatorPresentingWindow const):
* Source/WebKit/UIProcess/PageClient.h:
* Source/WebKit/UIProcess/WebPageProxyInternals.h:
* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::Internals::paymentCoordinatorAuthorizationPresenter):
* Source/WebKit/UIProcess/mac/PageClientImplMac.h:
* Source/WebKit/UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::platformWindow): Deleted.
* Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::Internals::paymentCoordinatorPresentingWindow): Deleted.

Move this into `WebPageProxyCocoa.mm`, so we can share code with iOS.

* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to