⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 242748 in webkit


Ignore:
Timestamp:
Mar 11, 2019, 3:42:09 PM (7 years ago)
Author:
aestes@apple.com
Message:

[Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
https://bugs.webkit.org/show_bug.cgi?id=195530
<rdar://problem/48747164>

Reviewed by Alex Christensen.

Source/WebCore:

  • Modules/applepay/PaymentCoordinatorClient.h: Defined isWebPaymentCoordinator.
  • page/Settings.yaml: Defined the applePayRemoteUIEnabled setting and reordered the other

Apple Pay settings.

Source/WebCore/PAL:

  • pal/cocoa/PassKitSoftLink.h: Soft-linked PKPaymentAuthorizationController on iOS.
  • pal/cocoa/PassKitSoftLink.mm: Ditto.
  • pal/spi/cocoa/PassKitSPI.h: Declared PKPaymentAuthorizationControllerPrivateDelegate and

related SPI.

Source/WebKit:

  • Configurations/Network-iOS.entitlements: Added the 'com.apple.payment.all-access'

entitlement and reordered the others.

  • NetworkProcess/NetworkConnectionToWebProcess.cpp:

(WebKit::NetworkConnectionToWebProcess::didReceiveMessage): Forwarded
WebPaymentCoordinatorProxy messages to the payment coordinator.
(WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage): Ditto.
(WebKit::NetworkConnectionToWebProcess::didClose): Set m_paymentCoordinator to nullptr.

  • NetworkProcess/NetworkConnectionToWebProcess.h: Inherited from

WebPaymentCoordinatorProxy::Client and added a unique_ptr<WebPaymentCoordinatorProxy> member.

  • NetworkProcess/cocoa/NetworkSessionCocoa.h: Declared getters for source application bundle

and secondary identifiers, and CTDataConnectionServiceType on iOS.

  • NetworkProcess/cocoa/NetworkSessionCocoa.mm:

(WebKit::NetworkSessionCocoa::sourceApplicationBundleIdentifier const): Defined getter.
(WebKit::NetworkSessionCocoa::sourceApplicationSecondaryIdentifier const): Ditto.
(WebKit::NetworkSessionCocoa::ctDataConnectionServiceType const): Ditto.
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Initialized
m_sourceApplicationBundleIdentifier and m_sourceApplicationSecondaryIdentifier with
corresponding NetworkSessionCreationParameters.

  • NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm: Added.

(WebKit::NetworkConnectionToWebProcess::paymentCoordinator): Added. Returns
m_paymentCoordinator after lazily initializing it.
(WebKit::NetworkConnectionToWebProcess::paymentCoordinatorConnection): Added. Returns the
connection to the web process.
(WebKit::NetworkConnectionToWebProcess::paymentCoordinatorPresentingViewController): Added.
Returns nil.
(WebKit::NetworkConnectionToWebProcess::paymentCoordinatorCTDataConnectionServiceType):
Added. Returns the value from the network session identified by sessionID.
(WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationBundleIdentifier):
Ditto.
(WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationSecondaryIdentifier):
Ditto.
(WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAuthorizationPresenter): Added.
Returns a new PaymentAuthorizationController.
(WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAddMessageReceiver): Added empty
definition. NetworkConnectionToWebProcess explicitly forwards WebPaymentCoordinatorProxy
messages to its payment coordinator, so there's no need to register with a MessageReceiverMap.
(WebKit::NetworkConnectionToWebProcess::paymentCoordinatorRemoveMessageReceiver): Ditto.

  • Platform/ios/PaymentAuthorizationController.h: Added. Declares a

PaymentAuthorizationPresenter subclass based on PKPaymentAuthorizationController.

  • Platform/ios/PaymentAuthorizationController.mm: Added.

(-[WKPaymentAuthorizationControllerDelegate initWithRequest:presenter:]):
Initialized WKPaymentAuthorizationDelegate with request and presenter.
(-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationControllerDidFinish:]):
Forwarded call to WKPaymentAuthorizationDelegate.
(-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didAuthorizePayment:handler:]):
Ditto.
(-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingMethod:handler:]):
Ditto.
(-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingContact:handler:]):
Ditto.
(-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectPaymentMethod:handler:]):
Ditto.
(-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:willFinishWithError:]):
Ditto.
(-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didRequestMerchantSession:]):
Ditto.
(WebKit::PaymentAuthorizationController::PaymentAuthorizationController):
Initialized m_controller with a new PKPaymentAuthorizationController and m_delegate with a
new WKPaymentAuthorizationControllerDelegate.
(WebKit::PaymentAuthorizationController::platformDelegate): Returned m_delegate.
(WebKit::PaymentAuthorizationController::dismiss): Dismissed the controller, set its
delegates to nil, set m_controller to nil, invalidated the delegate, and set m_delegate to
nil.
(WebKit::PaymentAuthorizationController::present): Called -presentWithCompletion: on the
controller, forwarding the passed-in completion handler.

  • Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Allowed PassKit to look up

the "com.apple.passd.in-app-payment" and "com.apple.passd.library" service endpoints.

  • Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:

(WebKit::WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy): Changed to call
paymentCoordinatorAddMessageReceiver.
(WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy): Changed to call
paymentCoordinatorRemoveMessageReceiver.
(WebKit::WebPaymentCoordinatorProxy::messageSenderDestinationID const): Deleted.
(WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard): Passed sessionID to
platformCanMakePaymentsWithActiveCard.
(WebKit::WebPaymentCoordinatorProxy::showPaymentUI): Stored destinationID and passed
sessionID to platformShowPaymentUI.
(WebKit::WebPaymentCoordinatorProxy::cancelPaymentSession): Changed to account for new
behavior of didCancelPaymentSession.
(WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession): Changed to call hidePaymentUI.
(WebKit::WebPaymentCoordinatorProxy::presenterDidFinish): Changed to only call hidePaymentUI
when didReachFinalState is true, since didCancelPaymentSession is called otherwise.
(WebKit::WebPaymentCoordinatorProxy::didReachFinalState): Cleared m_destinationID.

  • Shared/ApplePay/WebPaymentCoordinatorProxy.h: Added m_destionationID member.
  • Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: Changed

CanMakePaymentsWithActiveCard and ShowPaymentUI messages to take destinationID and sessionID
arguments.

  • Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:

(WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard): Passed
sessionID to paymentCoordinatorSourceApplicationSecondaryIdentifier.
(WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Passed sessionID to various
m_client call sites.

  • Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:

(WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Passed sessionID to
platformPaymentRequest.
(WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Null-checked m_authorizationPresenter
before calling dismiss.

  • Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:

(WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Passed sessionID to
platformPaymentRequest.
(WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Null-checked m_authorizationPresenter
before calling dismiss.

  • Shared/WebPreferences.yaml: Added ApplePayRemoteUIEnabled as an internal preference.
  • SourcesCocoa.txt: Added NetworkConnectionToWebProcessIOS.mm and

PaymentAuthorizationController.mm.

  • UIProcess/AuxiliaryProcessProxy.h:

(WebKit::AuxiliaryProcessProxy::messageReceiverMap): Deleted.

  • UIProcess/Cocoa/WebPageProxyCocoa.mm:

(WebKit::WebPageProxy::paymentCoordinatorConnection): Moved from WebPageProxy.cpp.
(WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
(WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
(WebKit::WebPageProxy::paymentCoordinatorAddMessageReceiver): Ditto.
(WebKit::WebPageProxy::paymentCoordinatorRemoveMessageReceiver): Ditto.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::paymentCoordinatorConnection): Moved to WebPageProxyCocoa.mm.
(WebKit::WebPageProxy::paymentCoordinatorMessageReceiver): Ditto.
(WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
(WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
(WebKit::WebPageProxy::paymentCoordinatorDestinationID): Ditto.

  • UIProcess/WebPageProxy.h:
  • UIProcess/ios/WebPageProxyIOS.mm:

(WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType): Asserted that
sessionID equals the website data store's sessionID.

  • WebKit.xcodeproj/project.pbxproj:
  • WebProcess/ApplePay/WebPaymentCoordinator.cpp:

(WebKit::WebPaymentCoordinator::networkProcessConnectionClosed): Added. Cancels the current
session if Apple Pay Remote UI is enabled and the network process connection closes.
(WebKit::WebPaymentCoordinator::availablePaymentNetworks): Changed to account for
WebPaymentCoordinator being an IPC::MessageSender.
(WebKit::WebPaymentCoordinator::canMakePayments): Ditto.
(WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCard): Ditto.
(WebKit::WebPaymentCoordinator::openPaymentSetup): Ditto.
(WebKit::WebPaymentCoordinator::showPaymentUI): Ditto.
(WebKit::WebPaymentCoordinator::completeMerchantValidation): Ditto.
(WebKit::WebPaymentCoordinator::completeShippingMethodSelection): Ditto.
(WebKit::WebPaymentCoordinator::completeShippingContactSelection): Ditto.
(WebKit::WebPaymentCoordinator::completePaymentMethodSelection): Ditto.
(WebKit::WebPaymentCoordinator::completePaymentSession): Ditto.
(WebKit::WebPaymentCoordinator::abortPaymentSession): Ditto.
(WebKit::WebPaymentCoordinator::cancelPaymentSession): Ditto.
(WebKit::WebPaymentCoordinator::messageSenderConnection const): Added. Returns a connection
to the network process if Apple Pay Remote UI is enabled. Otherwise, returned the web
process's parent connection.
(WebKit::WebPaymentCoordinator::messageSenderDestinationID const): Added. Returns the web
page's ID.
(WebKit::WebPaymentCoordinator::remoteUIEnabled const): Added. Calls Settings::applePayRemoteUIEnabled.

  • WebProcess/ApplePay/WebPaymentCoordinator.h: Inherited from IPC::MessageSender.
  • WebProcess/Network/NetworkProcessConnection.cpp:

(WebKit::NetworkProcessConnection::didReceiveMessage): Forwarded WebPaymentCoordinator
messages to the payment coordinator of the web page matching the decoder's destination ID.
(WebKit::NetworkProcessConnection::didReceiveSyncMessage): Ditto for sync messages.

  • WebProcess/WebPage/Cocoa/WebPageCocoa.mm:

(WebKit::WebPage::paymentCoordinator): Added a payment coordinator getter.

  • WebProcess/WebPage/WebPage.h: Ditto.
  • WebProcess/WebProcess.cpp:

(WebKit::WebProcess::networkProcessConnectionClosed): Called
WebPaymentCoordinator::networkProcessConnectionClosed when the network process connection
closes.

Source/WTF:

  • wtf/FeatureDefines.h: Defined ENABLE_APPLE_PAY_REMOTE_UI.
Location:
trunk/Source
Files:
2 added
36 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r242747 r242748  
     12019-03-11  Andy Estes  <aestes@apple.com>
     2
     3        [Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
     4        https://bugs.webkit.org/show_bug.cgi?id=195530
     5        <rdar://problem/48747164>
     6
     7        Reviewed by Alex Christensen.
     8
     9        * wtf/FeatureDefines.h: Defined ENABLE_APPLE_PAY_REMOTE_UI.
     10
    1112019-03-11  Yusuke Suzuki  <ysuzuki@apple.com>
    212
  • trunk/Source/WTF/wtf/FeatureDefines.h

    r242356 r242748  
    11/*
    2  * Copyright (C) 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006-2019 Apple Inc. All rights reserved.
    33 * Copyright (C) 2007-2009 Torch Mobile, Inc.
    44 * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved.
     
    6060#endif
    6161
     62#if !defined(ENABLE_APPLE_PAY_REMOTE_UI)
     63#if !PLATFORM(APPLETV) && !PLATFORM(IOSMAC) && !PLATFORM(WATCHOS)
     64#define ENABLE_APPLE_PAY_REMOTE_UI 1
     65#endif
     66#endif
     67
    6268#if !defined(ENABLE_ASYNC_SCROLLING)
    6369#define ENABLE_ASYNC_SCROLLING 1
  • trunk/Source/WebCore/ChangeLog

    r242746 r242748  
     12019-03-11  Andy Estes  <aestes@apple.com>
     2
     3        [Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
     4        https://bugs.webkit.org/show_bug.cgi?id=195530
     5        <rdar://problem/48747164>
     6
     7        Reviewed by Alex Christensen.
     8
     9        * Modules/applepay/PaymentCoordinatorClient.h: Defined isWebPaymentCoordinator.
     10        * page/Settings.yaml: Defined the applePayRemoteUIEnabled setting and reordered the other
     11        Apple Pay settings.
     12
    1132019-03-11  Alex Christensen  <achristensen@webkit.org>
    214
  • trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h

    r242681 r242748  
    6464
    6565    virtual bool isMockPaymentCoordinator() const { return false; }
     66    virtual bool isWebPaymentCoordinator() const { return false; }
    6667
    6768protected:
  • trunk/Source/WebCore/PAL/ChangeLog

    r242746 r242748  
     12019-03-11  Andy Estes  <aestes@apple.com>
     2
     3        [Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
     4        https://bugs.webkit.org/show_bug.cgi?id=195530
     5        <rdar://problem/48747164>
     6
     7        Reviewed by Alex Christensen.
     8
     9        * pal/cocoa/PassKitSoftLink.h: Soft-linked PKPaymentAuthorizationController on iOS.
     10        * pal/cocoa/PassKitSoftLink.mm: Ditto.
     11        * pal/spi/cocoa/PassKitSPI.h: Declared PKPaymentAuthorizationControllerPrivateDelegate and
     12        related SPI.
     13
    1142019-03-11  Alex Christensen  <achristensen@webkit.org>
    215
  • trunk/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.h

    r242616 r242748  
    11/*
    2  * Copyright (C) 2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4343SOFT_LINK_CLASS_FOR_HEADER(PAL, PKShippingMethod)
    4444
     45#if PLATFORM(IOS_FAMILY)
     46SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentAuthorizationController)
     47#endif
     48
    4549SOFT_LINK_FUNCTION_FOR_HEADER(PAL, PassKit, PKCanMakePaymentsWithMerchantIdentifierAndDomain, void, (NSString *identifier, NSString *domain, PKCanMakePaymentsCompletion completion), (identifier, domain, completion))
    4650SOFT_LINK_FUNCTION_FOR_HEADER(PAL, PassKit, PKDrawApplePayButton, void, (CGContextRef context, CGRect drawRect, CGFloat scale, PKPaymentButtonType type, PKPaymentButtonStyle style, NSString *languageCode), (context, drawRect, scale, type, style, languageCode))
  • trunk/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.mm

    r242616 r242748  
    11/*
    2  * Copyright (C) 2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4747SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKShippingMethod, PAL_EXPORT)
    4848
     49#if PLATFORM(IOS_FAMILY)
     50SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentAuthorizationController, PAL_EXPORT)
     51#endif
     52
    4953SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKCanMakePaymentsWithMerchantIdentifierAndDomain, void, (NSString *identifier, NSString *domain, PKCanMakePaymentsCompletion completion), (identifier, domain, completion), PAL_EXPORT)
    5054SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, PassKit, PKDrawApplePayButton, void, (CGContextRef context, CGRect drawRect, CGFloat scale, PKPaymentButtonType type, PKPaymentButtonStyle style, NSString *languageCode), (context, drawRect, scale, type, style, languageCode))
  • trunk/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h

    r238515 r242748  
    11/*
    2  * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4444#import <PassKit/PKPaymentRequest_Private.h>
    4545
     46#if PLATFORM(IOS_FAMILY)
     47#import <PassKit/PKPaymentAuthorizationController_Private.h>
     48#endif
     49
    4650#else
    4751
     
    4953
    5054#import <PassKit/PassKit.h>
     55
     56@protocol PKPaymentAuthorizationControllerPrivateDelegate;
     57
     58NS_ASSUME_NONNULL_BEGIN
     59
     60@interface PKPaymentAuthorizationController ()
     61@property (nonatomic, assign, nullable) id<PKPaymentAuthorizationControllerPrivateDelegate> privateDelegate;
     62@end
     63
     64@class PKPaymentMerchantSession;
     65
     66@protocol PKPaymentAuthorizationControllerPrivateDelegate <NSObject>
     67@optional
     68- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller willFinishWithError:(NSError *)error;
     69- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller didRequestMerchantSession:(void(^)(PKPaymentMerchantSession *, NSError *))sessionBlock;
     70@end
     71
     72NS_ASSUME_NONNULL_END
    5173
    5274#elif PLATFORM(MAC)
  • trunk/Source/WebCore/page/Settings.yaml

    r242664 r242748  
    653653  initial: false
    654654
     655applePayCapabilityDisclosureAllowed:
     656  conditional: APPLE_PAY
     657  initial: true
     658applePayEnabled:
     659  conditional: APPLE_PAY
     660  initial: false
     661applePayRemoteUIEnabled:
     662  conditional: APPLE_PAY_REMOTE_UI
     663  initial: true
    655664paymentRequestEnabled:
    656   initial: false
    657665  conditional: PAYMENT_REQUEST
    658 applePayEnabled:
    659   initial: false
    660   conditional: APPLE_PAY
    661 applePayCapabilityDisclosureAllowed:
    662   initial: true
    663   conditional: APPLE_PAY
     666  initial: false
    664667
    665668javaEnabled:
  • trunk/Source/WebKit/ChangeLog

    r242745 r242748  
     12019-03-11  Andy Estes  <aestes@apple.com>
     2
     3        [Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
     4        https://bugs.webkit.org/show_bug.cgi?id=195530
     5        <rdar://problem/48747164>
     6
     7        Reviewed by Alex Christensen.
     8
     9        * Configurations/Network-iOS.entitlements: Added the 'com.apple.payment.all-access'
     10        entitlement and reordered the others.
     11
     12        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
     13        (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): Forwarded
     14        WebPaymentCoordinatorProxy messages to the payment coordinator.
     15        (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage): Ditto.
     16        (WebKit::NetworkConnectionToWebProcess::didClose): Set m_paymentCoordinator to nullptr.
     17        * NetworkProcess/NetworkConnectionToWebProcess.h: Inherited from
     18        WebPaymentCoordinatorProxy::Client and added a unique_ptr<WebPaymentCoordinatorProxy> member.
     19
     20        * NetworkProcess/cocoa/NetworkSessionCocoa.h: Declared getters for source application bundle
     21        and secondary identifiers, and CTDataConnectionServiceType on iOS.
     22        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
     23        (WebKit::NetworkSessionCocoa::sourceApplicationBundleIdentifier const): Defined getter.
     24        (WebKit::NetworkSessionCocoa::sourceApplicationSecondaryIdentifier const): Ditto.
     25        (WebKit::NetworkSessionCocoa::ctDataConnectionServiceType const): Ditto.
     26        (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Initialized
     27        m_sourceApplicationBundleIdentifier and m_sourceApplicationSecondaryIdentifier with
     28        corresponding NetworkSessionCreationParameters.
     29
     30        * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm: Added.
     31        (WebKit::NetworkConnectionToWebProcess::paymentCoordinator): Added. Returns
     32        m_paymentCoordinator after lazily initializing it.
     33        (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorConnection): Added. Returns the
     34        connection to the web process.
     35        (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorPresentingViewController): Added.
     36        Returns nil.
     37        (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorCTDataConnectionServiceType):
     38        Added. Returns the value from the network session identified by sessionID.
     39        (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationBundleIdentifier):
     40        Ditto.
     41        (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationSecondaryIdentifier):
     42        Ditto.
     43        (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAuthorizationPresenter): Added.
     44        Returns a new PaymentAuthorizationController.
     45        (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAddMessageReceiver): Added empty
     46        definition. NetworkConnectionToWebProcess explicitly forwards WebPaymentCoordinatorProxy
     47        messages to its payment coordinator, so there's no need to register with a MessageReceiverMap.
     48        (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorRemoveMessageReceiver): Ditto.
     49
     50        * Platform/ios/PaymentAuthorizationController.h: Added. Declares a
     51        PaymentAuthorizationPresenter subclass based on PKPaymentAuthorizationController.
     52        * Platform/ios/PaymentAuthorizationController.mm: Added.
     53        (-[WKPaymentAuthorizationControllerDelegate initWithRequest:presenter:]):
     54        Initialized WKPaymentAuthorizationDelegate with request and presenter.
     55        (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationControllerDidFinish:]):
     56        Forwarded call to WKPaymentAuthorizationDelegate.
     57        (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didAuthorizePayment:handler:]):
     58        Ditto.
     59        (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingMethod:handler:]):
     60        Ditto.
     61        (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingContact:handler:]):
     62        Ditto.
     63        (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectPaymentMethod:handler:]):
     64        Ditto.
     65        (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:willFinishWithError:]):
     66        Ditto.
     67        (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didRequestMerchantSession:]):
     68        Ditto.
     69        (WebKit::PaymentAuthorizationController::PaymentAuthorizationController):
     70        Initialized m_controller with a new PKPaymentAuthorizationController and m_delegate with a
     71        new WKPaymentAuthorizationControllerDelegate.
     72        (WebKit::PaymentAuthorizationController::platformDelegate): Returned m_delegate.
     73        (WebKit::PaymentAuthorizationController::dismiss): Dismissed the controller, set its
     74        delegates to nil, set m_controller to nil, invalidated the delegate, and set m_delegate to
     75        nil.
     76        (WebKit::PaymentAuthorizationController::present): Called -presentWithCompletion: on the
     77        controller, forwarding the passed-in completion handler.
     78        * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Allowed PassKit to look up
     79        the "com.apple.passd.in-app-payment" and "com.apple.passd.library" service endpoints.
     80
     81        * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
     82        (WebKit::WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy): Changed to call
     83        paymentCoordinatorAddMessageReceiver.
     84        (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy): Changed to call
     85        paymentCoordinatorRemoveMessageReceiver.
     86        (WebKit::WebPaymentCoordinatorProxy::messageSenderDestinationID const): Deleted.
     87        (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard): Passed sessionID to
     88        platformCanMakePaymentsWithActiveCard.
     89        (WebKit::WebPaymentCoordinatorProxy::showPaymentUI): Stored destinationID and passed
     90        sessionID to platformShowPaymentUI.
     91        (WebKit::WebPaymentCoordinatorProxy::cancelPaymentSession): Changed to account for new
     92        behavior of didCancelPaymentSession.
     93        (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession): Changed to call hidePaymentUI.
     94        (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish): Changed to only call hidePaymentUI
     95        when didReachFinalState is true, since didCancelPaymentSession is called otherwise.
     96        (WebKit::WebPaymentCoordinatorProxy::didReachFinalState): Cleared m_destinationID.
     97        * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Added m_destionationID member.
     98        * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: Changed
     99        CanMakePaymentsWithActiveCard and ShowPaymentUI messages to take destinationID and sessionID
     100        arguments.
     101
     102        * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
     103        (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard): Passed
     104        sessionID to paymentCoordinatorSourceApplicationSecondaryIdentifier.
     105        (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Passed sessionID to various
     106        m_client call sites.
     107
     108        * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
     109        (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Passed sessionID to
     110        platformPaymentRequest.
     111        (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Null-checked m_authorizationPresenter
     112        before calling dismiss.
     113
     114        * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
     115        (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Passed sessionID to
     116        platformPaymentRequest.
     117        (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Null-checked m_authorizationPresenter
     118        before calling dismiss.
     119
     120        * Shared/WebPreferences.yaml: Added ApplePayRemoteUIEnabled as an internal preference.
     121
     122        * SourcesCocoa.txt: Added NetworkConnectionToWebProcessIOS.mm and
     123        PaymentAuthorizationController.mm.
     124
     125        * UIProcess/AuxiliaryProcessProxy.h:
     126        (WebKit::AuxiliaryProcessProxy::messageReceiverMap): Deleted.
     127
     128        * UIProcess/Cocoa/WebPageProxyCocoa.mm:
     129        (WebKit::WebPageProxy::paymentCoordinatorConnection): Moved from WebPageProxy.cpp.
     130        (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
     131        (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
     132        (WebKit::WebPageProxy::paymentCoordinatorAddMessageReceiver): Ditto.
     133        (WebKit::WebPageProxy::paymentCoordinatorRemoveMessageReceiver): Ditto.
     134
     135        * UIProcess/WebPageProxy.cpp:
     136        (WebKit::WebPageProxy::paymentCoordinatorConnection): Moved to WebPageProxyCocoa.mm.
     137        (WebKit::WebPageProxy::paymentCoordinatorMessageReceiver): Ditto.
     138        (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
     139        (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
     140        (WebKit::WebPageProxy::paymentCoordinatorDestinationID): Ditto.
     141        * UIProcess/WebPageProxy.h:
     142
     143        * UIProcess/ios/WebPageProxyIOS.mm:
     144        (WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType): Asserted that
     145        sessionID equals the website data store's sessionID.
     146
     147        * WebKit.xcodeproj/project.pbxproj:
     148
     149        * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
     150        (WebKit::WebPaymentCoordinator::networkProcessConnectionClosed): Added. Cancels the current
     151        session if Apple Pay Remote UI is enabled and the network process connection closes.
     152        (WebKit::WebPaymentCoordinator::availablePaymentNetworks): Changed to account for
     153        WebPaymentCoordinator being an IPC::MessageSender.
     154        (WebKit::WebPaymentCoordinator::canMakePayments): Ditto.
     155        (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCard): Ditto.
     156        (WebKit::WebPaymentCoordinator::openPaymentSetup): Ditto.
     157        (WebKit::WebPaymentCoordinator::showPaymentUI): Ditto.
     158        (WebKit::WebPaymentCoordinator::completeMerchantValidation): Ditto.
     159        (WebKit::WebPaymentCoordinator::completeShippingMethodSelection): Ditto.
     160        (WebKit::WebPaymentCoordinator::completeShippingContactSelection): Ditto.
     161        (WebKit::WebPaymentCoordinator::completePaymentMethodSelection): Ditto.
     162        (WebKit::WebPaymentCoordinator::completePaymentSession): Ditto.
     163        (WebKit::WebPaymentCoordinator::abortPaymentSession): Ditto.
     164        (WebKit::WebPaymentCoordinator::cancelPaymentSession): Ditto.
     165        (WebKit::WebPaymentCoordinator::messageSenderConnection const): Added. Returns a connection
     166        to the network process if Apple Pay Remote UI is enabled. Otherwise, returned the web
     167        process's parent connection.
     168        (WebKit::WebPaymentCoordinator::messageSenderDestinationID const): Added. Returns the web
     169        page's ID.
     170        (WebKit::WebPaymentCoordinator::remoteUIEnabled const): Added. Calls Settings::applePayRemoteUIEnabled.
     171        * WebProcess/ApplePay/WebPaymentCoordinator.h: Inherited from IPC::MessageSender.
     172
     173        * WebProcess/Network/NetworkProcessConnection.cpp:
     174        (WebKit::NetworkProcessConnection::didReceiveMessage): Forwarded WebPaymentCoordinator
     175        messages to the payment coordinator of the web page matching the decoder's destination ID.
     176        (WebKit::NetworkProcessConnection::didReceiveSyncMessage): Ditto for sync messages.
     177
     178        * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
     179        (WebKit::WebPage::paymentCoordinator): Added a payment coordinator getter.
     180        * WebProcess/WebPage/WebPage.h: Ditto.
     181
     182        * WebProcess/WebProcess.cpp:
     183        (WebKit::WebProcess::networkProcessConnectionClosed): Called
     184        WebPaymentCoordinator::networkProcessConnectionClosed when the network process connection
     185        closes.
     186
    11872019-03-11  Per Arne Vollan  <pvollan@apple.com>
    2188
  • trunk/Source/WebKit/Configurations/Network-iOS.entitlements

    r242680 r242748  
    33<plist version="1.0">
    44<dict>
     5        <key>com.apple.multitasking.systemappassertions</key>
     6        <true/>
     7        <key>com.apple.payment.all-access</key>
     8        <true/>
    59        <key>com.apple.private.accounts.bundleidspoofing</key>
     10        <true/>
     11        <key>com.apple.private.memorystatus</key>
    612        <true/>
    713        <key>com.apple.private.network.socket-delegate</key>
     
    1117                <string>com.apple.WebKit.Networking</string>
    1218        </array>
    13         <key>com.apple.multitasking.systemappassertions</key>
    14         <true/>
    15         <key>com.apple.private.memorystatus</key>
    16         <true/>
    1719</dict>
    1820</plist>
  • trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp

    r242738 r242748  
    6363#include <WebCore/SecurityPolicy.h>
    6464
     65#if ENABLE(APPLE_PAY_REMOTE_UI)
     66#include "WebPaymentCoordinatorProxyMessages.h"
     67#endif
     68
    6569namespace WebKit {
    6670using namespace WebCore;
     
    198202#endif
    199203
     204#if ENABLE(APPLE_PAY_REMOTE_UI)
     205    if (decoder.messageReceiverName() == Messages::WebPaymentCoordinatorProxy::messageReceiverName())
     206        return paymentCoordinator().didReceiveMessage(connection, decoder);
     207#endif
     208
    200209    ASSERT_NOT_REACHED();
    201210}
     
    232241#endif
    233242
     243#if ENABLE(APPLE_PAY_REMOTE_UI)
     244    if (decoder.messageReceiverName() == Messages::WebPaymentCoordinatorProxy::messageReceiverName())
     245        return paymentCoordinator().didReceiveSyncMessage(connection, decoder, reply);
     246#endif
     247
    234248    ASSERT_NOT_REACHED();
    235249}
     
    278292#if ENABLE(SERVICE_WORKER)
    279293    unregisterSWConnections();
     294#endif
     295
     296#if ENABLE(APPLE_PAY_REMOTE_UI)
     297    m_paymentCoordinator = nullptr;
    280298#endif
    281299}
  • trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h

    r242738 r242748  
    3333#include "NetworkMDNSRegister.h"
    3434#include "NetworkRTCProvider.h"
     35#include "WebPaymentCoordinatorProxy.h"
    3536#include <WebCore/NetworkLoadInformation.h>
    3637#include <WebCore/RegistrableDomain.h>
     
    6465}
    6566
    66 class NetworkConnectionToWebProcess : public RefCounted<NetworkConnectionToWebProcess>, IPC::Connection::Client {
     67class NetworkConnectionToWebProcess
     68    : public RefCounted<NetworkConnectionToWebProcess>
     69#if ENABLE(APPLE_PAY_REMOTE_UI)
     70    , public WebPaymentCoordinatorProxy::Client
     71#endif
     72    , IPC::Connection::Client {
    6773public:
    6874    using RegistrableDomain = WebCore::RegistrableDomain;
     
    245251    size_t findNetworkActivityTracker(ResourceLoadIdentifier resourceID);
    246252
     253#if ENABLE(APPLE_PAY_REMOTE_UI)
     254    WebPaymentCoordinatorProxy& paymentCoordinator();
     255
     256    // WebPaymentCoordinatorProxy::Client
     257    IPC::Connection* paymentCoordinatorConnection(const WebPaymentCoordinatorProxy&) final;
     258    UIViewController *paymentCoordinatorPresentingViewController(const WebPaymentCoordinatorProxy&) final;
     259    const String& paymentCoordinatorCTDataConnectionServiceType(const WebPaymentCoordinatorProxy&, PAL::SessionID) final;
     260    const String& paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) final;
     261    const String& paymentCoordinatorSourceApplicationSecondaryIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) final;
     262    std::unique_ptr<PaymentAuthorizationPresenter> paymentCoordinatorAuthorizationPresenter(WebPaymentCoordinatorProxy&, PKPaymentRequest *) final;
     263    void paymentCoordinatorAddMessageReceiver(WebPaymentCoordinatorProxy&, const IPC::StringReference&, IPC::MessageReceiver&) final;
     264    void paymentCoordinatorRemoveMessageReceiver(WebPaymentCoordinatorProxy&, const IPC::StringReference&) final;
     265#endif
     266
    247267    Ref<IPC::Connection> m_connection;
    248268    Ref<NetworkProcess> m_networkProcess;
     
    270290    HashMap<uint64_t, RefPtr<WebIDBConnectionToClient>> m_webIDBConnections;
    271291#endif
    272    
     292
    273293#if ENABLE(SERVICE_WORKER)
    274294    HashMap<WebCore::SWServerConnectionIdentifier, WeakPtr<WebSWServerConnection>> m_swConnections;
    275295#endif
     296
     297#if ENABLE(APPLE_PAY_REMOTE_UI)
     298    std::unique_ptr<WebPaymentCoordinatorProxy> m_paymentCoordinator;
     299#endif
    276300};
    277301
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h

    r240689 r242748  
    11/*
    2  * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4848    ~NetworkSessionCocoa();
    4949
     50    const String& sourceApplicationBundleIdentifier() const;
     51    const String& sourceApplicationSecondaryIdentifier() const;
    5052    // Must be called before any NetworkSession has been created.
    5153    // FIXME: Move this to NetworkSessionCreationParameters.
    5254#if PLATFORM(IOS_FAMILY)
     55    const String& ctDataConnectionServiceType() const;
    5356    static void setCTDataConnectionServiceType(const String&);
    5457#endif
     
    8386
    8487    String m_boundInterfaceIdentifier;
     88    String m_sourceApplicationBundleIdentifier;
     89    String m_sourceApplicationSecondaryIdentifier;
    8590    RetainPtr<CFDictionaryRef> m_proxyConfiguration;
    8691    bool m_shouldLogCookieInformation { false };
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm

    r242723 r242748  
    11/*
    2  * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    804804}
    805805
     806const String& NetworkSessionCocoa::sourceApplicationBundleIdentifier() const
     807{
     808    return m_sourceApplicationBundleIdentifier;
     809}
     810
     811const String& NetworkSessionCocoa::sourceApplicationSecondaryIdentifier() const
     812{
     813    return m_sourceApplicationSecondaryIdentifier;
     814}
     815
    806816#if PLATFORM(IOS_FAMILY)
    807817static String& globalCTDataConnectionServiceType()
     
    810820    return ctDataConnectionServiceType.get();
    811821}
    812 #endif
    813 
    814 #if PLATFORM(IOS_FAMILY)
     822
     823const String& NetworkSessionCocoa::ctDataConnectionServiceType() const
     824{
     825    return globalCTDataConnectionServiceType();
     826}
     827
    815828void NetworkSessionCocoa::setCTDataConnectionServiceType(const String& type)
    816829{
     
    851864    : NetworkSession(networkProcess, parameters.sessionID)
    852865    , m_boundInterfaceIdentifier(parameters.boundInterfaceIdentifier)
     866    , m_sourceApplicationBundleIdentifier(parameters.sourceApplicationBundleIdentifier)
     867    , m_sourceApplicationSecondaryIdentifier(parameters.sourceApplicationSecondaryIdentifier)
    853868    , m_proxyConfiguration(parameters.proxyConfiguration)
    854869    , m_shouldLogCookieInformation(parameters.shouldLogCookieInformation)
     
    883898        configuration._sourceApplicationAuditTokenData = (__bridge NSData *)data.get();
    884899
    885     if (!parameters.sourceApplicationBundleIdentifier.isEmpty()) {
    886         configuration._sourceApplicationBundleIdentifier = parameters.sourceApplicationBundleIdentifier;
     900    if (!m_sourceApplicationBundleIdentifier.isEmpty()) {
     901        configuration._sourceApplicationBundleIdentifier = m_sourceApplicationBundleIdentifier;
    887902        configuration._sourceApplicationAuditTokenData = nil;
    888903    }
    889904
    890     if (!parameters.sourceApplicationSecondaryIdentifier.isEmpty())
    891         configuration._sourceApplicationSecondaryIdentifier = parameters.sourceApplicationSecondaryIdentifier;
     905    if (!m_sourceApplicationSecondaryIdentifier.isEmpty())
     906        configuration._sourceApplicationSecondaryIdentifier = m_sourceApplicationSecondaryIdentifier;
    892907
    893908    configuration.connectionProxyDictionary = proxyDictionary(parameters.httpProxy, parameters.httpsProxy);
  • trunk/Source/WebKit/Platform/ios/PaymentAuthorizationController.h

    r242747 r242748  
    11/*
    2  * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #import "config.h"
    27 #import "WebPaymentCoordinatorProxy.h"
     26#pragma once
    2827
    29 #if PLATFORM(IOS_FAMILY) && ENABLE(APPLE_PAY)
     28#if USE(PASSKIT) && PLATFORM(IOS_FAMILY)
    3029
    31 #import "APIUIClient.h"
    32 #import "PaymentAuthorizationPresenter.h"
    33 #import "WebPageProxy.h"
    34 #import <PassKit/PassKit.h>
    35 #import <UIKit/UIViewController.h>
    36 #import <WebCore/PaymentAuthorizationStatus.h>
    37 #import <pal/cocoa/PassKitSoftLink.h>
     30#include "PaymentAuthorizationPresenter.h"
     31#include <wtf/RetainPtr.h>
     32
     33OBJC_CLASS PKPaymentAuthorizationController;
     34OBJC_CLASS PKPaymentRequest;
     35OBJC_CLASS WKPaymentAuthorizationControllerDelegate;
     36OBJC_CLASS WKPaymentAuthorizationDelegate;
    3837
    3938namespace WebKit {
    4039
    41 void WebPaymentCoordinatorProxy::platformShowPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest& request, CompletionHandler<void(bool)>&& completionHandler)
    42 {
    43     auto paymentRequest = platformPaymentRequest(originatingURL, linkIconURLStrings, request);
     40class PaymentAuthorizationController final : public PaymentAuthorizationPresenter {
     41public:
     42    PaymentAuthorizationController(PaymentAuthorizationPresenter::Client&, PKPaymentRequest *);
    4443
    45     ASSERT(!m_authorizationPresenter);
    46     m_authorizationPresenter = m_client.paymentCoordinatorAuthorizationPresenter(*this, paymentRequest.get());
    47     if (!m_authorizationPresenter)
    48         return completionHandler(false);
     44private:
     45    // PaymentAuthorizationPresenter
     46    WKPaymentAuthorizationDelegate *platformDelegate() final;
     47    void dismiss() final;
     48    void present(UIViewController *, CompletionHandler<void(bool)>&&) final;
    4949
    50     m_authorizationPresenter->present(m_client.paymentCoordinatorPresentingViewController(*this), WTFMove(completionHandler));
    51 }
     50    RetainPtr<PKPaymentAuthorizationController> m_controller;
     51    RetainPtr<WKPaymentAuthorizationControllerDelegate> m_delegate;
     52};
    5253
    53 void WebPaymentCoordinatorProxy::hidePaymentUI()
    54 {
    55     m_authorizationPresenter->dismiss();
    56     m_authorizationPresenter = nullptr;
    57 }
     54} // namespace WebKit
    5855
    59 }
    60 
    61 #endif
     56#endif // USE(PASSKIT) && PLATFORM(IOS_FAMILY)
  • trunk/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb

    r242680 r242748  
    1 ; Copyright (C) 2014-2015 Apple Inc. All rights reserved.
     1; Copyright (C) 2014-2019 Apple Inc. All rights reserved.
    22;
    33; Redistribution and use in source and binary forms, with or without
     
    7878    (global-name "com.apple.securityd"))
    7979
     80;; PassKit framework
     81(allow mach-lookup
     82    (global-name "com.apple.passd.in-app-payment")
     83    (global-name "com.apple.passd.library"))
     84
    8085(deny file-write-create
    8186       (vnode-type SYMLINK))
  • trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp

    r242681 r242748  
    4747    : m_client { client }
    4848{
    49     m_client.paymentCoordinatorMessageReceiver(*this).addMessageReceiver(Messages::WebPaymentCoordinatorProxy::messageReceiverName(), m_client.paymentCoordinatorDestinationID(*this), *this);
     49    m_client.paymentCoordinatorAddMessageReceiver(*this, Messages::WebPaymentCoordinatorProxy::messageReceiverName(), *this);
    5050    finishConstruction(*this);
    5151}
     
    5656        hidePaymentUI();
    5757
    58     m_client.paymentCoordinatorMessageReceiver(*this).removeMessageReceiver(Messages::WebPaymentCoordinatorProxy::messageReceiverName(), m_client.paymentCoordinatorDestinationID(*this));
     58    m_client.paymentCoordinatorRemoveMessageReceiver(*this, Messages::WebPaymentCoordinatorProxy::messageReceiverName());
    5959}
    6060
     
    6666uint64_t WebPaymentCoordinatorProxy::messageSenderDestinationID() const
    6767{
    68     return m_client.paymentCoordinatorDestinationID(*this);
     68    return *m_destinationID;
    6969}
    7070
     
    7979}
    8080
    81 void WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&& completionHandler)
    82 {
    83     platformCanMakePaymentsWithActiveCard(merchantIdentifier, domainName, WTFMove(completionHandler));
     81void WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, PAL::SessionID sessionID, CompletionHandler<void(bool)>&& completionHandler)
     82{
     83    platformCanMakePaymentsWithActiveCard(merchantIdentifier, domainName, sessionID, WTFMove(completionHandler));
    8484}
    8585
     
    8989}
    9090
    91 void WebPaymentCoordinatorProxy::showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest& paymentRequest, CompletionHandler<void(bool)>&& completionHandler)
    92 {
     91void WebPaymentCoordinatorProxy::showPaymentUI(uint64_t destinationID, PAL::SessionID sessionID, const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest& paymentRequest, CompletionHandler<void(bool)>&& completionHandler)
     92{
     93    if (auto& coordinator = activePaymentCoordinatorProxy())
     94        coordinator->didCancelPaymentSession();
     95    activePaymentCoordinatorProxy() = makeWeakPtr(this);
     96
    9397    // FIXME: Make this a message check.
    9498    ASSERT(canBegin());
    95 
    96     if (auto& coordinator = activePaymentCoordinatorProxy()) {
    97         coordinator->hidePaymentUI();
    98         coordinator->didCancelPaymentSession();
    99     }
    100 
    101     activePaymentCoordinatorProxy() = makeWeakPtr(this);
    102 
     99    ASSERT(!m_destinationID);
     100    ASSERT(!m_authorizationPresenter);
     101
     102    m_destinationID = destinationID;
    103103    m_state = State::Activating;
    104104
     
    109109        linkIconURLs.append(URL(URL(), linkIconURLString));
    110110
    111     platformShowPaymentUI(originatingURL, linkIconURLs, paymentRequest, [weakThis = makeWeakPtr(*this)](bool result) {
     111    platformShowPaymentUI(originatingURL, linkIconURLs, sessionID, paymentRequest, [weakThis = makeWeakPtr(*this)](bool result) {
    112112        if (!weakThis)
    113113            return;
     
    125125}
    126126
    127    
    128127void WebPaymentCoordinatorProxy::completeMerchantValidation(const WebCore::PaymentMerchantSession& paymentMerchantSession)
    129128{
     
    212211        return;
    213212
     213    didCancelPaymentSession();
     214}
     215
     216void WebPaymentCoordinatorProxy::didCancelPaymentSession()
     217{
     218    ASSERT(canCancel());
     219    send(Messages::WebPaymentCoordinator::DidCancelPaymentSession());
    214220    hidePaymentUI();
    215     didCancelPaymentSession();
    216 }
    217 
    218 void WebPaymentCoordinatorProxy::didCancelPaymentSession()
    219 {
    220     ASSERT(canCancel());
    221 
    222     send(Messages::WebPaymentCoordinator::DidCancelPaymentSession());
    223 
    224221    didReachFinalState();
    225222}
     
    243240    if (!didReachFinalState)
    244241        didCancelPaymentSession();
    245     hidePaymentUI();
     242    else
     243        hidePaymentUI();
    246244}
    247245
     
    336334void WebPaymentCoordinatorProxy::didReachFinalState()
    337335{
     336    m_destinationID = WTF::nullopt;
    338337    m_state = State::Idle;
    339338    m_merchantValidationState = MerchantValidationState::Idle;
  • trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h

    r242681 r242748  
    4242namespace IPC {
    4343class Connection;
    44 class MessageReceiverMap;
     44}
     45
     46namespace PAL {
     47class SessionID;
    4548}
    4649
     
    7376
    7477        virtual IPC::Connection* paymentCoordinatorConnection(const WebPaymentCoordinatorProxy&) = 0;
    75         virtual IPC::MessageReceiverMap& paymentCoordinatorMessageReceiver(const WebPaymentCoordinatorProxy&) = 0;
    76         virtual const String& paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&) = 0;
    77         virtual const String& paymentCoordinatorSourceApplicationSecondaryIdentifier(const WebPaymentCoordinatorProxy&) = 0;
    78         virtual uint64_t paymentCoordinatorDestinationID(const WebPaymentCoordinatorProxy&) = 0;
     78        virtual const String& paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) = 0;
     79        virtual const String& paymentCoordinatorSourceApplicationSecondaryIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) = 0;
     80        virtual void paymentCoordinatorAddMessageReceiver(WebPaymentCoordinatorProxy&, const IPC::StringReference&, IPC::MessageReceiver&) = 0;
     81        virtual void paymentCoordinatorRemoveMessageReceiver(WebPaymentCoordinatorProxy&, const IPC::StringReference&) = 0;
    7982#if PLATFORM(IOS_FAMILY)
    8083        virtual UIViewController *paymentCoordinatorPresentingViewController(const WebPaymentCoordinatorProxy&) = 0;
    81         virtual const String& paymentCoordinatorCTDataConnectionServiceType(const WebPaymentCoordinatorProxy&) = 0;
     84        virtual const String& paymentCoordinatorCTDataConnectionServiceType(const WebPaymentCoordinatorProxy&, PAL::SessionID) = 0;
    8285        virtual std::unique_ptr<PaymentAuthorizationPresenter> paymentCoordinatorAuthorizationPresenter(WebPaymentCoordinatorProxy&, PKPaymentRequest *) = 0;
    8386#endif
     
    8790    };
    8891
     92    friend class NetworkConnectionToWebProcess;
    8993    explicit WebPaymentCoordinatorProxy(Client&);
    9094    ~WebPaymentCoordinatorProxy();
    91 
    92     void didCancelPaymentSession();
    93     void hidePaymentUI();
    9495
    9596private:
     
    113114    void availablePaymentNetworks(CompletionHandler<void(Vector<String>&&)>&&);
    114115    void canMakePayments(CompletionHandler<void(bool)>&&);
    115     void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&&);
     116    void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, PAL::SessionID, CompletionHandler<void(bool)>&&);
    116117    void openPaymentSetup(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&&);
    117     void showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest&, CompletionHandler<void(bool)>&&);
     118    void showPaymentUI(uint64_t destinationID, PAL::SessionID, const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest&, CompletionHandler<void(bool)>&&);
    118119    void completeMerchantValidation(const WebCore::PaymentMerchantSession&);
    119120    void completeShippingMethodSelection(const Optional<WebCore::ShippingMethodUpdate>&);
     
    129130    bool canAbort() const;
    130131
     132    void didCancelPaymentSession();
    131133    void didReachFinalState();
     134    void hidePaymentUI();
    132135
    133136    Vector<String> platformAvailablePaymentNetworks();
    134137    bool platformCanMakePayments();
    135     void platformCanMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void(bool)>&& completionHandler);
     138    void platformCanMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, PAL::SessionID, WTF::Function<void(bool)>&& completionHandler);
    136139    void platformOpenPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void(bool)>&& completionHandler);
    137     void platformShowPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&, CompletionHandler<void(bool)>&&);
     140    void platformShowPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, PAL::SessionID, const WebCore::ApplePaySessionPaymentRequest&, CompletionHandler<void(bool)>&&);
    138141    void platformCompleteMerchantValidation(const WebCore::PaymentMerchantSession&);
    139142    void platformCompleteShippingMethodSelection(const Optional<WebCore::ShippingMethodUpdate>&);
     
    142145    void platformCompletePaymentSession(const Optional<WebCore::PaymentAuthorizationResult>&);
    143146#if PLATFORM(COCOA)
    144     RetainPtr<PKPaymentRequest> platformPaymentRequest(const URL& originatingURL, const Vector<URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&);
     147    RetainPtr<PKPaymentRequest> platformPaymentRequest(const URL& originatingURL, const Vector<URL>& linkIconURLs, PAL::SessionID, const WebCore::ApplePaySessionPaymentRequest&);
    145148#endif
    146149
    147150    Client& m_client;
     151    Optional<uint64_t> m_destinationID;
    148152
    149153    enum class State {
  • trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in

    r242681 r242748  
    1 # Copyright (C) 2015-2018 Apple Inc. All rights reserved.
     1# Copyright (C) 2015-2019 Apple Inc. All rights reserved.
    22#
    33# Redistribution and use in source and binary forms, with or without
     
    2929    AvailablePaymentNetworks() -> (Vector<String> availablePaymentNetworks) Delayed
    3030    CanMakePayments() -> (bool result) Delayed
    31     CanMakePaymentsWithActiveCard(String merchantIdentifier, String domainName) -> (bool canMakePayments) Async
     31    CanMakePaymentsWithActiveCard(String merchantIdentifier, String domainName, PAL::SessionID sessionID) -> (bool canMakePayments) Async
    3232    OpenPaymentSetup(String merchantIdentifier, String domainName) -> (bool result) Async
    3333
    34     ShowPaymentUI(String originatingURLString, Vector<String> linkIconURLStrings, WebCore::ApplePaySessionPaymentRequest paymentRequest) -> (bool result) Delayed
     34    ShowPaymentUI(uint64_t destinationID, PAL::SessionID sessionID, String originatingURLString, Vector<String> linkIconURLStrings, WebCore::ApplePaySessionPaymentRequest paymentRequest) -> (bool result) Delayed
    3535    CompleteMerchantValidation(WebCore::PaymentMerchantSession paymentMerchantSession)
    3636    CompleteShippingMethodSelection(Optional<WebCore::ShippingMethodUpdate> update)
  • trunk/Source/WebKit/Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm

    r242616 r242748  
    5858}
    5959
    60 void WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void(bool)>&& completionHandler)
    61 {
    62 #if HAVE(PASSKIT_GRANULAR_ERRORS)
    63     PKCanMakePaymentsWithMerchantIdentifierDomainAndSourceApplication(merchantIdentifier, domainName, m_client.paymentCoordinatorSourceApplicationSecondaryIdentifier(*this), makeBlockPtr([completionHandler = WTFMove(completionHandler)](BOOL canMakePayments, NSError *error) mutable {
     60void WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, PAL::SessionID sessionID, WTF::Function<void(bool)>&& completionHandler)
     61{
     62#if HAVE(PASSKIT_GRANULAR_ERRORS)
     63    PKCanMakePaymentsWithMerchantIdentifierDomainAndSourceApplication(merchantIdentifier, domainName, m_client.paymentCoordinatorSourceApplicationSecondaryIdentifier(*this, sessionID), makeBlockPtr([completionHandler = WTFMove(completionHandler)](BOOL canMakePayments, NSError *error) mutable {
    6464        if (error)
    6565            LOG_ERROR("PKCanMakePaymentsWithMerchantIdentifierAndDomain error %@", error);
     
    237237#endif
    238238
    239 RetainPtr<PKPaymentRequest> WebPaymentCoordinatorProxy::platformPaymentRequest(const URL& originatingURL, const Vector<URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest& paymentRequest)
     239RetainPtr<PKPaymentRequest> WebPaymentCoordinatorProxy::platformPaymentRequest(const URL& originatingURL, const Vector<URL>& linkIconURLs, PAL::SessionID sessionID, const WebCore::ApplePaySessionPaymentRequest& paymentRequest)
    240240{
    241241    auto result = adoptNS([PAL::allocPKPaymentRequestInstance() init]);
     
    301301
    302302    // FIXME: Instead of using respondsToSelector, this should use a proper #if version check.
    303     auto& bundleIdentifier = m_client.paymentCoordinatorSourceApplicationBundleIdentifier(*this);
     303    auto& bundleIdentifier = m_client.paymentCoordinatorSourceApplicationBundleIdentifier(*this, sessionID);
    304304    if (!bundleIdentifier.isEmpty() && [result respondsToSelector:@selector(setSourceApplicationBundleIdentifier:)])
    305305        [result setSourceApplicationBundleIdentifier:bundleIdentifier];
    306306
    307     auto& secondaryIdentifier = m_client.paymentCoordinatorSourceApplicationSecondaryIdentifier(*this);
     307    auto& secondaryIdentifier = m_client.paymentCoordinatorSourceApplicationSecondaryIdentifier(*this, sessionID);
    308308    if (!secondaryIdentifier.isEmpty() && [result respondsToSelector:@selector(setSourceApplicationSecondaryIdentifier:)])
    309309        [result setSourceApplicationSecondaryIdentifier:secondaryIdentifier];
    310310
    311311#if PLATFORM(IOS_FAMILY)
    312     auto& serviceType = m_client.paymentCoordinatorCTDataConnectionServiceType(*this);
     312    auto& serviceType = m_client.paymentCoordinatorCTDataConnectionServiceType(*this, sessionID);
    313313    if (!serviceType.isEmpty() && [result respondsToSelector:@selector(setCTDataConnectionServiceType:)])
    314314        [result setCTDataConnectionServiceType:serviceType];
  • trunk/Source/WebKit/Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm

    r242616 r242748  
    3939namespace WebKit {
    4040
    41 void WebPaymentCoordinatorProxy::platformShowPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest& request, CompletionHandler<void(bool)>&& completionHandler)
     41void WebPaymentCoordinatorProxy::platformShowPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLStrings, PAL::SessionID sessionID, const WebCore::ApplePaySessionPaymentRequest& request, CompletionHandler<void(bool)>&& completionHandler)
    4242{
    43     auto paymentRequest = platformPaymentRequest(originatingURL, linkIconURLStrings, request);
     43    auto paymentRequest = platformPaymentRequest(originatingURL, linkIconURLStrings, sessionID, request);
    4444
    4545    ASSERT(!m_authorizationPresenter);
     
    5353void WebPaymentCoordinatorProxy::hidePaymentUI()
    5454{
    55     m_authorizationPresenter->dismiss();
     55    if (m_authorizationPresenter)
     56        m_authorizationPresenter->dismiss();
    5657    m_authorizationPresenter = nullptr;
    5758}
  • trunk/Source/WebKit/Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm

    r242616 r242748  
    3636namespace WebKit {
    3737
    38 void WebPaymentCoordinatorProxy::platformShowPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest& request, CompletionHandler<void(bool)>&& completionHandler)
     38void WebPaymentCoordinatorProxy::platformShowPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLStrings, PAL::SessionID sessionID, const WebCore::ApplePaySessionPaymentRequest& request, CompletionHandler<void(bool)>&& completionHandler)
    3939{
    40     auto paymentRequest = platformPaymentRequest(originatingURL, linkIconURLStrings, request);
     40    auto paymentRequest = platformPaymentRequest(originatingURL, linkIconURLStrings, sessionID, request);
    4141
    4242    auto showPaymentUIRequestSeed = m_showPaymentUIRequestSeed;
     
    9898
    9999    [[m_sheetWindow sheetParent] endSheet:m_sheetWindow.get()];
    100     m_authorizationPresenter->dismiss();
     100
     101    if (m_authorizationPresenter)
     102        m_authorizationPresenter->dismiss();
    101103    m_authorizationPresenter = nullptr;
    102104
  • trunk/Source/WebKit/Shared/WebPreferences.yaml

    r242738 r242748  
    15811581  webcoreBinding: RuntimeEnabledFeatures
    15821582
     1583ApplePayRemoteUIEnabled:
     1584  category: internal
     1585  condition: ENABLE(APPLE_PAY_REMOTE_UI)
     1586  defaultValue: true
     1587  humanReadableDescription: "Enable Apple Pay Remote UI"
     1588  humanReadableName: "Apple Pay Remote UI"
     1589  type: bool
     1590
    15831591# Deprecated
    15841592
  • trunk/Source/WebKit/SourcesCocoa.txt

    r242696 r242748  
    4444NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkServiceEntryPoint.mm
    4545
     46NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm
    4647NetworkProcess/ios/NetworkProcessIOS.mm
    4748
     
    7677
    7778Platform/ios/AccessibilityIOS.mm
     79Platform/ios/PaymentAuthorizationController.mm
    7880
    7981Platform/IPC/mac/ConnectionMac.mm
  • trunk/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h

    r242332 r242748  
    8787    void setProcessSuppressionEnabled(bool);
    8888
    89     IPC::MessageReceiverMap& messageReceiverMap() { return m_messageReceiverMap; }
    90 
    9189protected:
    9290    // ProcessLauncher::Client
  • trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm

    r240491 r242748  
    11/*
    2  * Copyright (C) 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3636#import "WebPageMessages.h"
    3737#import "WebProcessProxy.h"
     38#import "WebsiteDataStore.h"
    3839#import <WebCore/DragItem.h>
    3940#import <WebCore/NotImplemented.h>
     
    207208    process().send(Messages::WebPage::PerformDictionaryLookupOfCurrentSelection(), m_pageID);
    208209}
     210   
     211#if ENABLE(APPLE_PAY)
     212
     213IPC::Connection* WebPageProxy::paymentCoordinatorConnection(const WebPaymentCoordinatorProxy&)
     214{
     215    return messageSenderConnection();
     216}
     217
     218const String& WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID sessionID)
     219{
     220    ASSERT_UNUSED(sessionID, sessionID == websiteDataStore().sessionID());
     221    return websiteDataStore().sourceApplicationBundleIdentifier();
     222}
     223
     224const String& WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID sessionID)
     225{
     226    ASSERT_UNUSED(sessionID, sessionID == websiteDataStore().sessionID());
     227    return websiteDataStore().sourceApplicationSecondaryIdentifier();
     228}
     229
     230void WebPageProxy::paymentCoordinatorAddMessageReceiver(WebPaymentCoordinatorProxy&, const IPC::StringReference& messageReceiverName, IPC::MessageReceiver& messageReceiver)
     231{
     232    process().addMessageReceiver(messageReceiverName, m_pageID, messageReceiver);
     233}
     234
     235void WebPageProxy::paymentCoordinatorRemoveMessageReceiver(WebPaymentCoordinatorProxy&, const IPC::StringReference& messageReceiverName)
     236{
     237    process().removeMessageReceiver(messageReceiverName, m_pageID);
     238}
     239
     240#endif
    209241
    210242} // namespace WebKit
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r242713 r242748  
    87688768}
    87698769
    8770 #if ENABLE(APPLE_PAY)
    8771 
    8772 IPC::Connection* WebPageProxy::paymentCoordinatorConnection(const WebPaymentCoordinatorProxy&)
    8773 {
    8774     return messageSenderConnection();
    8775 }
    8776 
    8777 IPC::MessageReceiverMap& WebPageProxy::paymentCoordinatorMessageReceiver(const WebPaymentCoordinatorProxy&)
    8778 {
    8779     return process().messageReceiverMap();
    8780 }
    8781 
    8782 const String& WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&)
    8783 {
    8784     return websiteDataStore().sourceApplicationBundleIdentifier();
    8785 }
    8786 
    8787 const String& WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier(const WebPaymentCoordinatorProxy&)
    8788 {
    8789     return websiteDataStore().sourceApplicationSecondaryIdentifier();
    8790 }
    8791 
    8792 uint64_t WebPageProxy::paymentCoordinatorDestinationID(const WebPaymentCoordinatorProxy&)
    8793 {
    8794     return messageSenderDestinationID();
    8795 }
    8796 
    8797 #endif
    8798 
    87998770void WebPageProxy::addObserver(WebViewDidMoveToWindowObserver& observer)
    88008771{
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r242705 r242748  
    19871987#if ENABLE(APPLE_PAY)
    19881988    IPC::Connection* paymentCoordinatorConnection(const WebPaymentCoordinatorProxy&) final;
    1989     IPC::MessageReceiverMap& paymentCoordinatorMessageReceiver(const WebPaymentCoordinatorProxy&) final;
    1990     const String& paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&) final;
    1991     const String& paymentCoordinatorSourceApplicationSecondaryIdentifier(const WebPaymentCoordinatorProxy&) final;
    1992     uint64_t paymentCoordinatorDestinationID(const WebPaymentCoordinatorProxy&) final;
     1989    const String& paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) final;
     1990    const String& paymentCoordinatorSourceApplicationSecondaryIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) final;
     1991    void paymentCoordinatorAddMessageReceiver(WebPaymentCoordinatorProxy&, const IPC::StringReference&, IPC::MessageReceiver&) final;
     1992    void paymentCoordinatorRemoveMessageReceiver(WebPaymentCoordinatorProxy&, const IPC::StringReference&) final;
    19931993#endif
    19941994#if ENABLE(APPLE_PAY) && PLATFORM(IOS_FAMILY)
    19951995    UIViewController *paymentCoordinatorPresentingViewController(const WebPaymentCoordinatorProxy&) final;
    1996     const String& paymentCoordinatorCTDataConnectionServiceType(const WebPaymentCoordinatorProxy&) final;
     1996    const String& paymentCoordinatorCTDataConnectionServiceType(const WebPaymentCoordinatorProxy&, PAL::SessionID) final;
    19971997    std::unique_ptr<PaymentAuthorizationPresenter> paymentCoordinatorAuthorizationPresenter(WebPaymentCoordinatorProxy&, PKPaymentRequest *) final;
    19981998#endif
  • trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm

    r242616 r242748  
    11911191}
    11921192
    1193 const String& WebPageProxy::paymentCoordinatorCTDataConnectionServiceType(const WebPaymentCoordinatorProxy&)
    1194 {
     1193const String& WebPageProxy::paymentCoordinatorCTDataConnectionServiceType(const WebPaymentCoordinatorProxy&, PAL::SessionID sessionID)
     1194{
     1195    ASSERT_UNUSED(sessionID, sessionID == websiteDataStore().sessionID());
    11951196    return process().processPool().configuration().ctDataConnectionServiceType();
    11961197}
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r242696 r242748  
    12901290                A1798B49222E531D000764BD /* WKPaymentAuthorizationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = A1798B47222E530A000764BD /* WKPaymentAuthorizationDelegate.h */; };
    12911291                A1798B4C222F1BD4000764BD /* WebPaymentCoordinatorProxyCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = A1798B4B222F1BD4000764BD /* WebPaymentCoordinatorProxyCocoa.h */; };
     1292                A1798B512230A10E000764BD /* PaymentAuthorizationController.h in Headers */ = {isa = PBXBuildFile; fileRef = A1798B4F2230A0FE000764BD /* PaymentAuthorizationController.h */; };
    12921293                A181A79821ACC74B0059A316 /* WebKitAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = A181A79721ACAC610059A316 /* WebKitAdditions.mm */; };
    12931294                A182D5B51BE6BD250087A7CC /* AccessibilityIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = A182D5B31BE6BD250087A7CC /* AccessibilityIOS.h */; };
     
    38703871                A1798B4A222F133A000764BD /* PaymentAuthorizationPresenter.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PaymentAuthorizationPresenter.mm; sourceTree = "<group>"; };
    38713872                A1798B4B222F1BD4000764BD /* WebPaymentCoordinatorProxyCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebPaymentCoordinatorProxyCocoa.h; sourceTree = "<group>"; };
     3873                A1798B4F2230A0FE000764BD /* PaymentAuthorizationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaymentAuthorizationController.h; sourceTree = "<group>"; };
     3874                A1798B502230A0FE000764BD /* PaymentAuthorizationController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PaymentAuthorizationController.mm; sourceTree = "<group>"; };
     3875                A1798B5722332203000764BD /* NetworkConnectionToWebProcessIOS.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkConnectionToWebProcessIOS.mm; sourceTree = "<group>"; };
    38723876                A181A79721ACAC610059A316 /* WebKitAdditions.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKitAdditions.mm; sourceTree = "<group>"; };
    38733877                A182D5B21BE6BD250087A7CC /* AccessibilityIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AccessibilityIOS.mm; sourceTree = "<group>"; };
     
    59285932                        isa = PBXGroup;
    59295933                        children = (
     5934                                A1798B5722332203000764BD /* NetworkConnectionToWebProcessIOS.mm */,
    59305935                                2DA944BC188511E700ED86DB /* NetworkProcessIOS.mm */,
    59315936                        );
     
    71507155                                A182D5B31BE6BD250087A7CC /* AccessibilityIOS.h */,
    71517156                                A182D5B21BE6BD250087A7CC /* AccessibilityIOS.mm */,
     7157                                A1798B4F2230A0FE000764BD /* PaymentAuthorizationController.h */,
     7158                                A1798B502230A0FE000764BD /* PaymentAuthorizationController.mm */,
    71527159                        );
    71537160                        path = ios;
     
    92869293                                1A8B66B01BC43C860082DF77 /* PageLoadStateObserver.h in Headers */,
    92879294                                C574A58112E66681002DFE98 /* PasteboardTypes.h in Headers */,
     9295                                A1798B512230A10E000764BD /* PaymentAuthorizationController.h in Headers */,
    92889296                                A1798B3E222D97A2000764BD /* PaymentAuthorizationPresenter.h in Headers */,
    92899297                                A1798B43222D98DF000764BD /* PaymentAuthorizationViewController.h in Headers */,
     
    1022810236                                                ProvisioningStyle = Automatic;
    1022910237                                        };
     10238                                        A1798B59223464C4000764BD = {
     10239                                                CreatedOnToolsVersion = 10.2;
     10240                                        };
    1023010241                                        E1AC2E2720F7B94C00B0897D = {
    1023110242                                                CreatedOnToolsVersion = 9.3;
  • trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp

    r242681 r242748  
    5252}
    5353
     54void WebPaymentCoordinator::networkProcessConnectionClosed()
     55{
     56#if ENABLE(APPLE_PAY_REMOTE_UI)
     57    if (remoteUIEnabled())
     58        didCancelPaymentSession();
     59#endif
     60}
     61
    5462const WebPaymentCoordinator::AvailablePaymentNetworksSet& WebPaymentCoordinator::availablePaymentNetworks()
    5563{
     
    6169    Vector<String> availablePaymentNetworks;
    6270    using AvailablePaymentNetworksMessage = Messages::WebPaymentCoordinatorProxy::AvailablePaymentNetworks;
    63     if (m_webPage.sendSync(AvailablePaymentNetworksMessage(), AvailablePaymentNetworksMessage::Reply(availablePaymentNetworks))) {
     71    if (sendSync(AvailablePaymentNetworksMessage(), AvailablePaymentNetworksMessage::Reply(availablePaymentNetworks))) {
    6472        for (auto& network : availablePaymentNetworks)
    6573            m_availablePaymentNetworks->add(network);
     
    8189{
    8290    bool canMakePayments;
    83     if (!m_webPage.sendSync(Messages::WebPaymentCoordinatorProxy::CanMakePayments(), Messages::WebPaymentCoordinatorProxy::CanMakePayments::Reply(canMakePayments)))
     91    if (!sendSync(Messages::WebPaymentCoordinatorProxy::CanMakePayments(), Messages::WebPaymentCoordinatorProxy::CanMakePayments::Reply(canMakePayments)))
    8492        return false;
    8593
     
    8997void WebPaymentCoordinator::canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&& completionHandler)
    9098{
    91     m_webPage.sendWithAsyncReply(Messages::WebPaymentCoordinatorProxy::CanMakePaymentsWithActiveCard(merchantIdentifier, domainName), WTFMove(completionHandler));
     99    sendWithAsyncReply(Messages::WebPaymentCoordinatorProxy::CanMakePaymentsWithActiveCard(merchantIdentifier, domainName, m_webPage.sessionID()), WTFMove(completionHandler));
    92100}
    93101
    94102void WebPaymentCoordinator::openPaymentSetup(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&& completionHandler)
    95103{
    96     m_webPage.sendWithAsyncReply(Messages::WebPaymentCoordinatorProxy::OpenPaymentSetup(merchantIdentifier, domainName), WTFMove(completionHandler));
     104    sendWithAsyncReply(Messages::WebPaymentCoordinatorProxy::OpenPaymentSetup(merchantIdentifier, domainName), WTFMove(completionHandler));
    97105}
    98106
     
    104112
    105113    bool result;
    106     if (!m_webPage.sendSync(Messages::WebPaymentCoordinatorProxy::ShowPaymentUI(originatingURL.string(), linkIconURLStrings, paymentRequest), Messages::WebPaymentCoordinatorProxy::ShowPaymentUI::Reply(result)))
     114    if (!sendSync(Messages::WebPaymentCoordinatorProxy::ShowPaymentUI(m_webPage.pageID(), m_webPage.sessionID(), originatingURL.string(), linkIconURLStrings, paymentRequest), Messages::WebPaymentCoordinatorProxy::ShowPaymentUI::Reply(result)))
    107115        return false;
    108116
     
    112120void WebPaymentCoordinator::completeMerchantValidation(const WebCore::PaymentMerchantSession& paymentMerchantSession)
    113121{
    114     m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteMerchantValidation(paymentMerchantSession));
     122    send(Messages::WebPaymentCoordinatorProxy::CompleteMerchantValidation(paymentMerchantSession));
    115123}
    116124
    117125void WebPaymentCoordinator::completeShippingMethodSelection(Optional<WebCore::ShippingMethodUpdate>&& update)
    118126{
    119     m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteShippingMethodSelection(update));
     127    send(Messages::WebPaymentCoordinatorProxy::CompleteShippingMethodSelection(update));
    120128}
    121129
    122130void WebPaymentCoordinator::completeShippingContactSelection(Optional<WebCore::ShippingContactUpdate>&& update)
    123131{
    124     m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteShippingContactSelection(update));
     132    send(Messages::WebPaymentCoordinatorProxy::CompleteShippingContactSelection(update));
    125133}
    126134
    127135void WebPaymentCoordinator::completePaymentMethodSelection(Optional<WebCore::PaymentMethodUpdate>&& update)
    128136{
    129     m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompletePaymentMethodSelection(update));
     137    send(Messages::WebPaymentCoordinatorProxy::CompletePaymentMethodSelection(update));
    130138}
    131139
    132140void WebPaymentCoordinator::completePaymentSession(Optional<WebCore::PaymentAuthorizationResult>&& result)
    133141{
    134     m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompletePaymentSession(result));
     142    send(Messages::WebPaymentCoordinatorProxy::CompletePaymentSession(result));
    135143}
    136144
    137145void WebPaymentCoordinator::abortPaymentSession()
    138146{
    139     m_webPage.send(Messages::WebPaymentCoordinatorProxy::AbortPaymentSession());
     147    send(Messages::WebPaymentCoordinatorProxy::AbortPaymentSession());
    140148}
    141149
    142150void WebPaymentCoordinator::cancelPaymentSession()
    143151{
    144     m_webPage.send(Messages::WebPaymentCoordinatorProxy::CancelPaymentSession());
     152    send(Messages::WebPaymentCoordinatorProxy::CancelPaymentSession());
    145153}
    146154
     
    150158}
    151159
     160IPC::Connection* WebPaymentCoordinator::messageSenderConnection() const
     161{
     162#if ENABLE(APPLE_PAY_REMOTE_UI)
     163    if (remoteUIEnabled())
     164        return &WebProcess::singleton().ensureNetworkProcessConnection().connection();
     165#endif
     166    return WebProcess::singleton().parentProcessConnection();
     167}
     168
     169uint64_t WebPaymentCoordinator::messageSenderDestinationID() const
     170{
     171    return m_webPage.pageID();
     172}
     173
    152174void WebPaymentCoordinator::validateMerchant(const String& validationURLString)
    153175{
     
    185207}
    186208
    187 }
    188 
    189 #endif
     209#if ENABLE(APPLE_PAY_REMOTE_UI)
     210bool WebPaymentCoordinator::remoteUIEnabled() const
     211{
     212    if (auto page = m_webPage.corePage())
     213        return page->settings().applePayRemoteUIEnabled();
     214    return false;
     215}
     216#endif
     217
     218}
     219
     220#endif
  • trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h

    r242681 r242748  
    2929
    3030#include "MessageReceiver.h"
     31#include "MessageSender.h"
    3132#include <WebCore/PaymentCoordinatorClient.h>
    3233#include <WebCore/PaymentHeaders.h>
     
    4748namespace WebKit {
    4849
     50class NetworkProcessConnection;
    4951class WebPage;
    5052
    51 class WebPaymentCoordinator final : public WebCore::PaymentCoordinatorClient, private IPC::MessageReceiver {
     53class WebPaymentCoordinator final : public WebCore::PaymentCoordinatorClient, private IPC::MessageReceiver, private IPC::MessageSender {
    5254public:
     55    friend class NetworkProcessConnection;
    5356    explicit WebPaymentCoordinator(WebPage&);
    5457    ~WebPaymentCoordinator();
     58
     59    void networkProcessConnectionClosed();
    5560
    5661private:
     
    7277    void paymentCoordinatorDestroyed() override;
    7378
     79    bool isWebPaymentCoordinator() const override { return true; }
     80
    7481    // IPC::MessageReceiver.
    7582    void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
     83   
     84    // IPC::MessageSender.
     85    IPC::Connection* messageSenderConnection() const final;
     86    uint64_t messageSenderDestinationID() const final;
    7687
    7788    // Message handlers.
     
    8495
    8596    WebCore::PaymentCoordinator& paymentCoordinator();
    86    
     97
     98#if ENABLE(APPLE_PAY_REMOTE_UI)
     99    bool remoteUIEnabled() const;
     100#endif
     101
    87102    using AvailablePaymentNetworksSet = HashSet<String, ASCIICaseInsensitiveHash>;
    88103    const AvailablePaymentNetworksSet& availablePaymentNetworks();
     
    97112};
    98113
    99 }
     114} // namespace WebKit
     115
     116SPECIALIZE_TYPE_TRAITS_BEGIN(WebKit::WebPaymentCoordinator)
     117static bool isType(const WebCore::PaymentCoordinatorClient& paymentCoordinatorClient) { return paymentCoordinatorClient.isWebPaymentCoordinator(); }
     118SPECIALIZE_TYPE_TRAITS_END()
     119
    100120#endif
  • trunk/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp

    r238655 r242748  
    11/*
    2  * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4040#include "WebPage.h"
    4141#include "WebPageMessages.h"
     42#include "WebPaymentCoordinator.h"
    4243#include "WebProcess.h"
    4344#include "WebRTCMonitor.h"
     
    5859#include <pal/SessionID.h>
    5960
     61#if ENABLE(APPLE_PAY_REMOTE_UI)
     62#include "WebPaymentCoordinatorMessages.h"
     63#endif
     64
    6065namespace WebKit {
    6166using namespace WebCore;
     
    142147#endif
    143148
     149#if ENABLE(APPLE_PAY_REMOTE_UI)
     150    if (decoder.messageReceiverName() == Messages::WebPaymentCoordinator::messageReceiverName()) {
     151        if (auto webPage = WebProcess::singleton().webPage(decoder.destinationID()))
     152            webPage->paymentCoordinator()->didReceiveMessage(connection, decoder);
     153        return;
     154    }
     155#endif
     156
    144157    didReceiveNetworkProcessConnectionMessage(connection, decoder);
    145158}
     
    152165        if (auto* contextManagerConnection = SWContextManager::singleton().connection())
    153166            static_cast<WebSWContextManagerConnection&>(*contextManagerConnection).didReceiveSyncMessage(connection, decoder, replyEncoder);
     167        return;
     168    }
     169#endif
     170
     171#if ENABLE(APPLE_PAY_REMOTE_UI)
     172    if (decoder.messageReceiverName() == Messages::WebPaymentCoordinator::messageReceiverName()) {
     173        if (auto webPage = WebProcess::singleton().webPage(decoder.destinationID()))
     174            webPage->paymentCoordinator()->didReceiveSyncMessage(connection, decoder, replyEncoder);
    154175        return;
    155176    }
  • trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm

    r241721 r242748  
    11/*
    2  * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3131#import "PluginView.h"
    3232#import "WebPageProxyMessages.h"
     33#import "WebPaymentCoordinator.h"
    3334#import <WebCore/DictionaryLookup.h>
    3435#import <WebCore/Editor.h>
     
    3839#import <WebCore/HitTestResult.h>
    3940#import <WebCore/NodeRenderStyle.h>
     41#import <WebCore/PaymentCoordinator.h>
    4042#import <WebCore/PlatformMediaSessionManager.h>
    4143#import <WebCore/RenderElement.h>
     
    190192}
    191193
     194#if ENABLE(APPLE_PAY)
     195WebPaymentCoordinator* WebPage::paymentCoordinator()
     196{
     197    if (!m_page)
     198        return nullptr;
     199    auto& client = m_page->paymentCoordinator().client();
     200    return is<WebPaymentCoordinator>(client) ? downcast<WebPaymentCoordinator>(&client) : nullptr;
     201}
     202#endif
     203
    192204} // namespace WebKit
    193205
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r242714 r242748  
    233233class WebPageInspectorTargetController;
    234234class WebPageOverlay;
     235class WebPaymentCoordinator;
    235236class WebPopupMenu;
    236237class WebTouchEvent;
     
    11611162    void resumeAllMediaBuffering();
    11621163
     1164#if ENABLE(APPLE_PAY)
     1165    WebPaymentCoordinator* paymentCoordinator();
     1166#endif
     1167
    11631168private:
    11641169    WebPage(uint64_t pageID, WebPageCreationParameters&&);
  • trunk/Source/WebKit/WebProcess/WebProcess.cpp

    r242230 r242748  
    11/*
    2  * Copyright (C) 2009-2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2009-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5858#include "WebPage.h"
    5959#include "WebPageGroupProxy.h"
     60#include "WebPaymentCoordinator.h"
    6061#include "WebPlatformStrategies.h"
    6162#include "WebPluginInfoProvider.h"
     
    12871288    WebSocketStream::networkProcessCrashed();
    12881289
    1289     for (auto& page : m_pageMap.values())
     1290    for (auto& page : m_pageMap.values()) {
    12901291        page->stopAllURLSchemeTasks();
     1292#if ENABLE(APPLE_PAY)
     1293        if (auto paymentCoordinator = page->paymentCoordinator())
     1294            paymentCoordinator->networkProcessConnectionClosed();
     1295#endif
     1296    }
    12911297}
    12921298
Note: See TracChangeset for help on using the changeset viewer.