Changeset 260717 in webkit


Ignore:
Timestamp:
Apr 25, 2020 8:03:30 PM (4 years ago)
Author:
achristensen@apple.com
Message:

Move ApplePay code from WebKitAdditions to WebCore and WebKit
https://bugs.webkit.org/show_bug.cgi?id=210521

Reviewed by Andy Estes.

Source/WebCore:

Only 4 minor modifications were necessary, as follows:

  1. PaymentSetupFeatures's RetainPtr<NSArray<PKPaymentSetupFeature *>> was changed to RetainPtr<NSArray> to work with C++.
  2. WebPaymentCoordinatorProxyAdditions messages were moved to WebPaymentCoordinatorProxy, removing the need for the extra message receiver, the Optional<WebPaymentCoordinatorProxyAdditions>, and the finishConstruction.
  3. WebMediaSessionManager.cpp's macros that collided with other macros were renamed. This was necessary because of different source unification.
  4. PaymentSetupFeatures.h was renamed to ApplePayPaymentSetupFeatures.h to be able to build with PaymentSetupFeatures.h in the SDK.

The rest is just copy and paste.

There isn't a good way to land this without breaking the build without removing the files from WebKitAdditions at the same time,
so I'll do the two at the same time late at night to not cause disruption.

  • DerivedSources.make:
  • Modules/applepay/ApplePayInstallmentConfiguration.h: Added.
  • Modules/applepay/ApplePayInstallmentConfiguration.idl: Added.
  • Modules/applepay/ApplePayPayment.h:
  • Modules/applepay/ApplePayPayment.idl:
  • Modules/applepay/ApplePayPaymentMethod.h:
  • Modules/applepay/ApplePayPaymentMethod.idl:
  • Modules/applepay/ApplePayPaymentMethodUpdate.h:
  • Modules/applepay/ApplePayPaymentMethodUpdate.idl:
  • Modules/applepay/ApplePayRequestBase.cpp:

(WebCore::finishConverting):
(WebCore::requiresSupportedNetworks):

  • Modules/applepay/ApplePayRequestBase.h:
  • Modules/applepay/ApplePaySession.cpp:

(WebCore::finishConverting):

  • Modules/applepay/ApplePaySessionPaymentRequest.h:

(WebCore::ApplePaySessionPaymentRequest::installmentConfiguration const):
(WebCore::ApplePaySessionPaymentRequest::setInstallmentConfiguration):

  • Modules/applepay/ApplePaySetup.cpp: Added.

(WebCore::shouldDiscloseFeatures):
(WebCore::ApplePaySetup::getSetupFeatures):
(WebCore::ApplePaySetup::begin):
(WebCore::ApplePaySetup::ApplePaySetup):
(WebCore::ApplePaySetup::stop):
(WebCore::ApplePaySetup::suspend):

  • Modules/applepay/ApplePaySetup.h: Added.

(WebCore::ApplePaySetup::create):

  • Modules/applepay/ApplePaySetup.idl: Added.
  • Modules/applepay/ApplePaySetupFeature.h: Added.

(WebCore::ApplePaySetupFeature::create):
(WebCore::ApplePaySetupFeature::platformFeature const):

  • Modules/applepay/ApplePaySetupFeature.idl: Added.
  • Modules/applepay/ApplePaySetupFeature.mm: Added.

(WebCore::ApplePaySetupFeature::type const):
(WebCore::ApplePaySetupFeature::state const):
(WebCore::ApplePaySetupFeature::supportsInstallments const):
(WebCore::ApplePaySetupFeature::ApplePaySetupFeature):

  • Modules/applepay/ApplePaySetupFeatureType.h: Added.
  • Modules/applepay/ApplePaySetupFeatureType.idl: Added.
  • Modules/applepay/PaymentCoordinatorClient.h:

(WebCore::PaymentCoordinatorClient::getSetupFeatures):
(WebCore::PaymentCoordinatorClient::beginApplePaySetup):
(WebCore::PaymentCoordinatorClient::endApplePaySetup):

  • Modules/applepay/PaymentInstallmentConfiguration.h: Added.
  • Modules/applepay/PaymentInstallmentConfiguration.mm: Added.

(WebCore::toDecimalNumber):
(WebCore::platformFeatureType):
(WebCore::createPlatformConfiguration):
(WebCore::PaymentInstallmentConfiguration::PaymentInstallmentConfiguration):
(WebCore::PaymentInstallmentConfiguration::platformConfiguration const):

  • Modules/applepay/PaymentMethodUpdate.h:
  • Modules/applepay/cocoa/PaymentCocoa.mm:

(WebCore::finishConverting):

  • Modules/applepay/cocoa/PaymentMethodCocoa.mm:

(WebCore::finishConverting):

  • Modules/applepay/cocoa/PaymentMethodUpdateCocoa.mm:

(WebCore::PaymentMethodUpdate::setInstallmentGroupIdentifier):

  • Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm:

(WebCore::additionalError):

  • Modules/applepay/paymentrequest/ApplePayRequest.idl:
  • Modules/mediasession/WebMediaSessionManager.cpp:

(WebCore::WebMediaSessionManager::setMockMediaPlaybackTargetPickerEnabled):
(WebCore::WebMediaSessionManager::setMockMediaPlaybackTargetPickerState):
(WebCore::WebMediaSessionManager::mockMediaPlaybackTargetPickerDismissPopup):
(WebCore::WebMediaSessionManager::addPlaybackTargetPickerClient):
(WebCore::WebMediaSessionManager::removePlaybackTargetPickerClient):
(WebCore::WebMediaSessionManager::removeAllPlaybackTargetPickerClients):
(WebCore::WebMediaSessionManager::showPlaybackTargetPicker):
(WebCore::WebMediaSessionManager::clientStateDidChange):
(WebCore::WebMediaSessionManager::setPlaybackTarget):
(WebCore::WebMediaSessionManager::externalOutputDeviceAvailableDidChange):
(WebCore::WebMediaSessionManager::playbackTargetPickerWasDismissed):
(WebCore::WebMediaSessionManager::configurePlaybackTargetClients):
(WebCore::WebMediaSessionManager::configurePlaybackTargetMonitoring):
(WebCore::WebMediaSessionManager::configureWatchdogTimer):
(WebCore::WebMediaSessionManager::watchdogTimerFired):

  • SourcesCocoa.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • platform/cocoa/WebCoreAdditions.mm:

Source/WebCore/PAL:

  • pal/cocoa/PassKitSoftLink.h:
  • pal/cocoa/PassKitSoftLink.mm:
  • pal/spi/cocoa/PassKitSPI.h:

Source/WebKit:

  • DerivedSources.make:
  • Scripts/webkit/messages.py:
  • Shared/ApplePay/ApplePayPaymentSetupFeatures.h: Added.

(WebKit::PaymentSetupFeatures::platformFeatures const):

  • Shared/ApplePay/ApplePayPaymentSetupFeatures.mm: Added.

(WebKit::PaymentSetupFeatures::PaymentSetupFeatures):
(WebKit::PaymentSetupFeatures::encode const):
(WebKit::PaymentSetupFeatures::decode):
(WebKit::PaymentSetupFeatures::operator Vector<Ref<WebCore::ApplePaySetupFeature>> const):

  • Shared/ApplePay/PaymentSetupConfiguration.h: Added.

(WebKit::PaymentSetupConfiguration::platformConfiguration const):

  • Shared/ApplePay/PaymentSetupConfiguration.mm: Added.

(WebKit::toPlatformConfiguration):
(WebKit::PaymentSetupConfiguration::PaymentSetupConfiguration):
(WebKit::PaymentSetupConfiguration::encode const):
(WebKit::PaymentSetupConfiguration::decode):

  • Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
  • Shared/ApplePay/WebPaymentCoordinatorProxy.h:

(WebKit::WebPaymentCoordinatorProxy::finishConstruction): Deleted.

  • Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
  • Shared/ApplePay/cocoa/PaymentSetupConfiguration.mm: Added.

(WebKitAdditions::toPlatformConfiguration):
(WebKitAdditions::PaymentSetupConfiguration::PaymentSetupConfiguration):
(WebKitAdditions::PaymentSetupConfiguration::encode const):
(WebKitAdditions::PaymentSetupConfiguration::decode):

  • Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:

(WebKit::finishCreating):
(WebKit::WebPaymentCoordinatorProxy::getSetupFeatures):
(WebKit::WebPaymentCoordinatorProxy::beginApplePaySetup):
(WebKit::WebPaymentCoordinatorProxy::endApplePaySetup):
(WebKit::WebPaymentCoordinatorProxy::platformBeginApplePaySetup):
(WebKit::WebPaymentCoordinatorProxy::platformEndApplePaySetup):

  • Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:

(IPC::finishDecoding):
(IPC::finishEncoding):
(IPC::ArgumentCoder<WebCore::PaymentInstallmentConfiguration>::encode):
(IPC::ArgumentCoder<WebCore::PaymentInstallmentConfiguration>::decode):

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

(WebKit::WebPaymentCoordinator::getSetupFeatures):
(WebKit::WebPaymentCoordinator::beginApplePaySetup):
(WebKit::WebPaymentCoordinator::endApplePaySetup):

  • WebProcess/ApplePay/WebPaymentCoordinator.h:
Location:
trunk/Source
Files:
17 added
39 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r260716 r260717  
     12020-04-25  Alex Christensen  <achristensen@webkit.org>
     2
     3        Move ApplePay code from WebKitAdditions to WebCore and WebKit
     4        https://bugs.webkit.org/show_bug.cgi?id=210521
     5
     6        Reviewed by Andy Estes.
     7
     8        Only 4 minor modifications were necessary, as follows:
     9
     10        1. PaymentSetupFeatures's RetainPtr<NSArray<PKPaymentSetupFeature *>> was changed to RetainPtr<NSArray> to work with C++.
     11        2. WebPaymentCoordinatorProxyAdditions messages were moved to WebPaymentCoordinatorProxy, removing the need for
     12           the extra message receiver, the Optional<WebPaymentCoordinatorProxyAdditions>, and the finishConstruction.
     13        3. WebMediaSessionManager.cpp's macros that collided with other macros were renamed.  This was necessary because of different source unification.
     14        4. PaymentSetupFeatures.h was renamed to ApplePayPaymentSetupFeatures.h to be able to build with PaymentSetupFeatures.h in the SDK.
     15
     16        The rest is just copy and paste.
     17
     18        There isn't a good way to land this without breaking the build without removing the files from WebKitAdditions at the same time,
     19        so I'll do the two at the same time late at night to not cause disruption.
     20
     21        * DerivedSources.make:
     22        * Modules/applepay/ApplePayInstallmentConfiguration.h: Added.
     23        * Modules/applepay/ApplePayInstallmentConfiguration.idl: Added.
     24        * Modules/applepay/ApplePayPayment.h:
     25        * Modules/applepay/ApplePayPayment.idl:
     26        * Modules/applepay/ApplePayPaymentMethod.h:
     27        * Modules/applepay/ApplePayPaymentMethod.idl:
     28        * Modules/applepay/ApplePayPaymentMethodUpdate.h:
     29        * Modules/applepay/ApplePayPaymentMethodUpdate.idl:
     30        * Modules/applepay/ApplePayRequestBase.cpp:
     31        (WebCore::finishConverting):
     32        (WebCore::requiresSupportedNetworks):
     33        * Modules/applepay/ApplePayRequestBase.h:
     34        * Modules/applepay/ApplePaySession.cpp:
     35        (WebCore::finishConverting):
     36        * Modules/applepay/ApplePaySessionPaymentRequest.h:
     37        (WebCore::ApplePaySessionPaymentRequest::installmentConfiguration const):
     38        (WebCore::ApplePaySessionPaymentRequest::setInstallmentConfiguration):
     39        * Modules/applepay/ApplePaySetup.cpp: Added.
     40        (WebCore::shouldDiscloseFeatures):
     41        (WebCore::ApplePaySetup::getSetupFeatures):
     42        (WebCore::ApplePaySetup::begin):
     43        (WebCore::ApplePaySetup::ApplePaySetup):
     44        (WebCore::ApplePaySetup::stop):
     45        (WebCore::ApplePaySetup::suspend):
     46        * Modules/applepay/ApplePaySetup.h: Added.
     47        (WebCore::ApplePaySetup::create):
     48        * Modules/applepay/ApplePaySetup.idl: Added.
     49        * Modules/applepay/ApplePaySetupFeature.h: Added.
     50        (WebCore::ApplePaySetupFeature::create):
     51        (WebCore::ApplePaySetupFeature::platformFeature const):
     52        * Modules/applepay/ApplePaySetupFeature.idl: Added.
     53        * Modules/applepay/ApplePaySetupFeature.mm: Added.
     54        (WebCore::ApplePaySetupFeature::type const):
     55        (WebCore::ApplePaySetupFeature::state const):
     56        (WebCore::ApplePaySetupFeature::supportsInstallments const):
     57        (WebCore::ApplePaySetupFeature::ApplePaySetupFeature):
     58        * Modules/applepay/ApplePaySetupFeatureType.h: Added.
     59        * Modules/applepay/ApplePaySetupFeatureType.idl: Added.
     60        * Modules/applepay/PaymentCoordinatorClient.h:
     61        (WebCore::PaymentCoordinatorClient::getSetupFeatures):
     62        (WebCore::PaymentCoordinatorClient::beginApplePaySetup):
     63        (WebCore::PaymentCoordinatorClient::endApplePaySetup):
     64        * Modules/applepay/PaymentInstallmentConfiguration.h: Added.
     65        * Modules/applepay/PaymentInstallmentConfiguration.mm: Added.
     66        (WebCore::toDecimalNumber):
     67        (WebCore::platformFeatureType):
     68        (WebCore::createPlatformConfiguration):
     69        (WebCore::PaymentInstallmentConfiguration::PaymentInstallmentConfiguration):
     70        (WebCore::PaymentInstallmentConfiguration::platformConfiguration const):
     71        * Modules/applepay/PaymentMethodUpdate.h:
     72        * Modules/applepay/cocoa/PaymentCocoa.mm:
     73        (WebCore::finishConverting):
     74        * Modules/applepay/cocoa/PaymentMethodCocoa.mm:
     75        (WebCore::finishConverting):
     76        * Modules/applepay/cocoa/PaymentMethodUpdateCocoa.mm:
     77        (WebCore::PaymentMethodUpdate::setInstallmentGroupIdentifier):
     78        * Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm:
     79        (WebCore::additionalError):
     80        * Modules/applepay/paymentrequest/ApplePayRequest.idl:
     81        * Modules/mediasession/WebMediaSessionManager.cpp:
     82        (WebCore::WebMediaSessionManager::setMockMediaPlaybackTargetPickerEnabled):
     83        (WebCore::WebMediaSessionManager::setMockMediaPlaybackTargetPickerState):
     84        (WebCore::WebMediaSessionManager::mockMediaPlaybackTargetPickerDismissPopup):
     85        (WebCore::WebMediaSessionManager::addPlaybackTargetPickerClient):
     86        (WebCore::WebMediaSessionManager::removePlaybackTargetPickerClient):
     87        (WebCore::WebMediaSessionManager::removeAllPlaybackTargetPickerClients):
     88        (WebCore::WebMediaSessionManager::showPlaybackTargetPicker):
     89        (WebCore::WebMediaSessionManager::clientStateDidChange):
     90        (WebCore::WebMediaSessionManager::setPlaybackTarget):
     91        (WebCore::WebMediaSessionManager::externalOutputDeviceAvailableDidChange):
     92        (WebCore::WebMediaSessionManager::playbackTargetPickerWasDismissed):
     93        (WebCore::WebMediaSessionManager::configurePlaybackTargetClients):
     94        (WebCore::WebMediaSessionManager::configurePlaybackTargetMonitoring):
     95        (WebCore::WebMediaSessionManager::configureWatchdogTimer):
     96        (WebCore::WebMediaSessionManager::watchdogTimerFired):
     97        * SourcesCocoa.txt:
     98        * WebCore.xcodeproj/project.pbxproj:
     99        * platform/cocoa/WebCoreAdditions.mm:
     100
    11012020-04-25  Simon Fraser  <simon.fraser@apple.com>
    2102
  • trunk/Source/WebCore/DerivedSources.make

    r260505 r260717  
    104104    $(WebCore)/Modules/applepay/ApplePayErrorCode.idl \
    105105    $(WebCore)/Modules/applepay/ApplePayErrorContactField.idl \
     106    $(WebCore)/Modules/applepay/ApplePayInstallmentConfiguration.idl \
    106107    $(WebCore)/Modules/applepay/ApplePayLineItem.idl \
    107108    $(WebCore)/Modules/applepay/ApplePayMerchantCapability.idl \
     
    119120    $(WebCore)/Modules/applepay/ApplePaySession.idl \
    120121    $(WebCore)/Modules/applepay/ApplePaySessionError.idl \
     122    $(WebCore)/Modules/applepay/ApplePaySetup.idl \
     123    $(WebCore)/Modules/applepay/ApplePaySetupFeature.idl \
     124    $(WebCore)/Modules/applepay/ApplePaySetupFeatureType.idl \
    121125    $(WebCore)/Modules/applepay/ApplePayShippingContactSelectedEvent.idl \
    122126    $(WebCore)/Modules/applepay/ApplePayShippingContactUpdate.idl \
     
    12651269ADDITIONAL_EVENT_TARGET_FACTORY =
    12661270
    1267 -include WebCoreDerivedSourcesAdditions.make
    1268 
    12691271JS_BINDING_IDLS += $(ADDITIONAL_BINDING_IDLS)
    12701272
  • trunk/Source/WebCore/Modules/applepay/ApplePayPayment.h

    r248692 r260717  
    3131#include "ApplePayPaymentMethod.h"
    3232
    33 #if USE(APPLE_INTERNAL_SDK)
    34 #include <WebKitAdditions/ApplePayPaymentAdditions.h>
    35 #endif
    36 
    3733namespace WebCore {
    3834
     
    4743    Optional<ApplePayPaymentContact> billingContact;
    4844    Optional<ApplePayPaymentContact> shippingContact;
    49 
    50 #if defined(APPLEPAYPAYMENT_ADDITIONS)
    51 APPLEPAYPAYMENT_ADDITIONS
    52 #undef APPLEPAYPAYMENT_ADDITIONS
    53 #endif
     45    String installmentAuthorizationToken;
    5446};
    5547
  • trunk/Source/WebCore/Modules/applepay/ApplePayPayment.idl

    r209927 r260717  
    3131    ApplePayPaymentContact billingContact;
    3232    ApplePayPaymentContact shippingContact;
     33    [Conditional=APPLE_PAY_INSTALLMENTS] DOMString installmentAuthorizationToken;
    3334};
    3435
  • trunk/Source/WebCore/Modules/applepay/ApplePayPaymentMethod.h

    r256041 r260717  
    3131#include <wtf/Optional.h>
    3232
    33 #if USE(APPLE_INTERNAL_SDK)
    34 #include <WebKitAdditions/ApplePayPaymentMethodAdditions.h>
    35 #endif
    36 
    3733namespace WebCore {
    3834
     
    4743    Optional<ApplePayPaymentPass> paymentPass;
    4844    Optional<ApplePayPaymentContact> billingContact;
    49 
    50 #if defined(APPLEPAYPAYMENTMETHOD_ADDITIONS)
    51 APPLEPAYPAYMENTMETHOD_ADDITIONS
    52 #undef APPLEPAYPAYMENTMETHOD_ADDITIONS
    53 #endif
     45    String bindToken;
    5446};
    5547
  • trunk/Source/WebCore/Modules/applepay/ApplePayPaymentMethod.idl

    r256041 r260717  
    3434    ApplePayPaymentPass paymentPass;
    3535    ApplePayPaymentContact billingContact;
     36    [Conditional=APPLE_PAY_INSTALLMENTS] DOMString bindToken;
    3637};
  • trunk/Source/WebCore/Modules/applepay/ApplePayPaymentMethodUpdate.h

    r250179 r260717  
    3030#include "ApplePayLineItem.h"
    3131
    32 #if USE(APPLE_INTERNAL_SDK)
    33 #include <WebKitAdditions/ApplePayPaymentMethodUpdateAdditions.h>
    34 #endif
    35 
    3632namespace WebCore {
    3733
     
    3935    ApplePayLineItem newTotal;
    4036    Vector<ApplePayLineItem> newLineItems;
    41 
    42 #if defined(APPLEPAYPAYMENTMETHODUPDATE_ADDITIONS)
    43 APPLEPAYPAYMENTMETHODUPDATE_ADDITIONS
    44 #undef APPLEPAYPAYMENTMETHODUPDATE_ADDITIONS
    45 #endif
     37    String installmentGroupIdentifier;
    4638};
    4739
  • trunk/Source/WebCore/Modules/applepay/ApplePayPaymentMethodUpdate.idl

    r217626 r260717  
    2929    required ApplePayLineItem newTotal;
    3030    sequence<ApplePayLineItem> newLineItems;
     31    [Conditional=APPLE_PAY_INSTALLMENTS] DOMString installmentGroupIdentifier;
    3132};
  • trunk/Source/WebCore/Modules/applepay/ApplePayRequestBase.cpp

    r250026 r260717  
    3232#include <wtf/text/StringConcatenateNumbers.h>
    3333
    34 #if USE(APPLE_INTERNAL_SDK)
    35 #include <WebKitAdditions/ApplePayRequestBaseAdditions.cpp>
     34namespace WebCore {
     35
     36static void finishConverting(ApplePaySessionPaymentRequest& result, ApplePayRequestBase& request)
     37{
     38#if ENABLE(APPLE_PAY_INSTALLMENTS)
     39    if (request.installmentConfiguration)
     40        result.setInstallmentConfiguration(WTFMove(*request.installmentConfiguration));
    3641#else
    37 namespace WebCore {
    38 static void finishConverting(ApplePaySessionPaymentRequest&, ApplePayRequestBase&) { }
    39 static bool requiresSupportedNetworks(unsigned, const ApplePayRequestBase&) { return true; }
     42    UNUSED_PARAM(result);
     43    UNUSED_PARAM(request);
     44#endif
    4045}
     46
     47static bool requiresSupportedNetworks(unsigned version, const ApplePayRequestBase& request)
     48{
     49#if ENABLE(APPLE_PAY_INSTALLMENTS)
     50    return version < 8 || !request.installmentConfiguration;
     51#else
     52    UNUSED_PARAM(version);
     53    UNUSED_PARAM(request);
     54    return true;
    4155#endif
    42 
    43 namespace WebCore {
     56}
    4457
    4558static ExceptionOr<Vector<String>> convertAndValidate(Document& document, unsigned version, const Vector<String>& supportedNetworks, const PaymentCoordinator& paymentCoordinator)
  • trunk/Source/WebCore/Modules/applepay/ApplePayRequestBase.h

    r248692 r260717  
    2929
    3030#include "ApplePayContactField.h"
     31#include "ApplePayInstallmentConfiguration.h"
    3132#include "ApplePayMerchantCapability.h"
    3233#include "ApplePayPaymentContact.h"
    33 
    34 #if USE(APPLE_INTERNAL_SDK)
    35 #include <WebKitAdditions/ApplePayRequestBaseAdditions.h>
    36 #endif
    3734
    3835namespace WebCore {
     
    5552    Vector<String> supportedCountries;
    5653
    57 #if defined(APPLEPAYREQUESTBASE_ADDITIONS)
    58 APPLEPAYREQUESTBASE_ADDITIONS
    59 #undef APPLEPAYREQUESTBASE_ADDITIONS
     54#if ENABLE(APPLE_PAY_INSTALLMENTS)
     55    Optional<ApplePayInstallmentConfiguration> installmentConfiguration;
    6056#endif
    6157};
  • trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp

    r258679 r260717  
    6666#include <wtf/RunLoop.h>
    6767
    68 #if USE(APPLE_INTERNAL_SDK)
    69 #include <WebKitAdditions/ApplePaySessionAdditions.cpp>
     68namespace WebCore {
     69
     70static void finishConverting(PaymentMethodUpdate& convertedUpdate, ApplePayPaymentMethodUpdate&& update)
     71{
     72#if ENABLE(APPLE_PAY_INSTALLMENTS)
     73    convertedUpdate.setInstallmentGroupIdentifier(update.installmentGroupIdentifier);
    7074#else
    71 namespace WebCore {
    72 static void finishConverting(PaymentMethodUpdate&, ApplePayPaymentMethodUpdate&&) { }
    73 }
     75    UNUSED_PARAM(convertedUpdate);
     76    UNUSED_PARAM(update);
    7477#endif
    75 
    76 namespace WebCore {
     78}
    7779
    7880WTF_MAKE_ISO_ALLOCATED_IMPL(ApplePaySession);
  • trunk/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.h

    r250179 r260717  
    2929
    3030#include "PaymentContact.h"
     31#include "PaymentInstallmentConfiguration.h"
    3132#include <wtf/Optional.h>
    3233#include <wtf/Vector.h>
    3334#include <wtf/text/WTFString.h>
    34 
    35 #if USE(APPLE_INTERNAL_SDK)
    36 #include <WebKitAdditions/ApplePaySessionPaymentRequestAdditions.h>
    37 #endif
    3835
    3936namespace WebCore {
     
    142139    void setRequester(Requester requester) { m_requester = requester; }
    143140
    144 #if defined(APPLEPAYSESSIONPAYMENTREQUEST_PUBLIC_ADDITIONS)
    145 APPLEPAYSESSIONPAYMENTREQUEST_PUBLIC_ADDITIONS
    146 #undef APPLEPAYSESSIONPAYMENTREQUEST_PUBLIC_ADDITIONS
     141#if HAVE(PASSKIT_INSTALLMENTS)
     142    const PaymentInstallmentConfiguration& installmentConfiguration() const { return m_installmentConfiguration; }
     143    void setInstallmentConfiguration(PaymentInstallmentConfiguration&& installmentConfiguration) { m_installmentConfiguration = WTFMove(installmentConfiguration); }
    147144#endif
    148145
     
    173170    Requester m_requester { Requester::ApplePayJS };
    174171
    175 #if defined(APPLEPAYSESSIONPAYMENTREQUEST_PRIVATE_ADDITIONS)
    176 APPLEPAYSESSIONPAYMENTREQUEST_PRIVATE_ADDITIONS
    177 #undef APPLEPAYSESSIONPAYMENTREQUEST_PRIVATE_ADDITIONS
     172#if HAVE(PASSKIT_INSTALLMENTS)
     173    PaymentInstallmentConfiguration m_installmentConfiguration;
    178174#endif
    179175};
  • trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h

    r254015 r260717  
    2929
    3030#include "ApplePaySessionPaymentRequest.h"
     31#include "ApplePaySetup.h"
     32#include "ApplePaySetupFeature.h"
     33#include <wtf/CompletionHandler.h>
    3134#include <wtf/Forward.h>
    3235#include <wtf/Function.h>
    33 
    34 #if USE(APPLE_INTERNAL_SDK)
    35 #import <WebKitAdditions/PaymentCoordinatorClientAdditions.h>
    36 #endif
    3736
    3837namespace WebCore {
     
    7271    virtual bool isAlwaysOnLoggingAllowed() const { return false; }
    7372
     73#if ENABLE(APPLE_PAY_SETUP)
     74    virtual void getSetupFeatures(const ApplePaySetup::Configuration&, const URL&, CompletionHandler<void(Vector<Ref<ApplePaySetupFeature>>&&)>&& completionHandler) { completionHandler({ }); }
     75    virtual void beginApplePaySetup(const ApplePaySetup::Configuration&, const URL&, Vector<RefPtr<ApplePaySetupFeature>>&&, CompletionHandler<void(bool)>&& completionHandler) { completionHandler(false); }
     76    virtual void endApplePaySetup() { }
     77#endif
     78
    7479protected:
    7580    virtual ~PaymentCoordinatorClient() = default;
    76 
    77 #if defined(PAYMENTCOORDINATORCLIENT_ADDITIONS)
    78 PAYMENTCOORDINATORCLIENT_ADDITIONS
    79 #undef PAYMENTCOORDINATORCLIENT_ADDITIONS
    80 #endif
    8181};
    8282
  • trunk/Source/WebCore/Modules/applepay/PaymentMethodUpdate.h

    r250179 r260717  
    3131#include <wtf/RetainPtr.h>
    3232
    33 #if USE(APPLE_INTERNAL_SDK)
    34 #include <WebKitAdditions/PaymentMethodUpdateAdditions.h>
    35 #endif
    36 
    3733OBJC_CLASS PKPaymentRequestPaymentMethodUpdate;
    3834
     
    5147    PKPaymentRequestPaymentMethodUpdate *platformUpdate() const;
    5248
    53 #if defined(PAYMENTMETHODUPDATE_PUBLIC_ADDITIONS)
    54 PAYMENTMETHODUPDATE_PUBLIC_ADDITIONS
    55 #undef PAYMENTMETHODUPDATE_PUBLIC_ADDITIONS
     49#if HAVE(PASSKIT_INSTALLMENTS)
     50    void setInstallmentGroupIdentifier(const String&);
    5651#endif
    57    
     52
    5853private:
    5954    Optional<TotalAndLineItems> m_totalAndLineItems;
  • trunk/Source/WebCore/Modules/applepay/cocoa/PaymentCocoa.mm

    r248692 r260717  
    3434#import <pal/spi/cocoa/PassKitSPI.h>
    3535
    36 #if USE(APPLE_INTERNAL_SDK)
    37 #import <WebKitAdditions/PaymentCocoaAdditions.mm>
     36namespace WebCore {
     37
     38static void finishConverting(PKPayment *payment, ApplePayPayment& result)
     39{
     40#if HAVE(PASSKIT_INSTALLMENTS)
     41    if (NSString *installmentAuthorizationToken = payment.installmentAuthorizationToken)
     42        result.installmentAuthorizationToken = installmentAuthorizationToken;
    3843#else
    39 namespace WebCore {
    40 static void finishConverting(PKPayment *, ApplePayPayment&) { }
     44    UNUSED_PARAM(payment);
     45    UNUSED_PARAM(result);
     46#endif
    4147}
    42 #endif
    43 
    44 namespace WebCore {
    4548
    4649static ApplePayPayment::Token convert(PKPaymentToken *paymentToken)
  • trunk/Source/WebCore/Modules/applepay/cocoa/PaymentMethodCocoa.mm

    r259050 r260717  
    3333#import <pal/spi/cocoa/PassKitSPI.h>
    3434
    35 #if USE(APPLE_INTERNAL_SDK)
    36 #import <WebKitAdditions/PaymentMethodCocoaAdditions.mm>
     35namespace WebCore {
     36
     37static void finishConverting(PKPaymentMethod *paymentMethod, ApplePayPaymentMethod& result)
     38{
     39#if HAVE(PASSKIT_INSTALLMENTS)
     40    if (NSString *bindToken = paymentMethod.bindToken)
     41        result.bindToken = bindToken;
    3742#else
    38 namespace WebCore {
    39 static void finishConverting(PKPaymentMethod *, ApplePayPaymentMethod&) { }
     43    UNUSED_PARAM(paymentMethod);
     44    UNUSED_PARAM(result);
     45#endif
    4046}
    41 #endif
    42 
    43 namespace WebCore {
    4447
    4548static ApplePayPaymentPass::ActivationState convert(PKPaymentPassActivationState paymentPassActivationState)
  • trunk/Source/WebCore/Modules/applepay/cocoa/PaymentMethodUpdateCocoa.mm

    r250179 r260717  
    6060}
    6161
     62#if HAVE(PASSKIT_INSTALLMENTS)
     63void PaymentMethodUpdate::setInstallmentGroupIdentifier(const String& installmentGroupIdentifier)
     64{
     65    [m_platformUpdate setInstallmentGroupIdentifier:installmentGroupIdentifier];
     66}
     67#endif
     68
    6269} // namespace WebCore
    6370
  • trunk/Source/WebCore/Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm

    r250048 r260717  
    3232#import <pal/cocoa/PassKitSoftLink.h>
    3333
    34 #if USE(APPLE_INTERNAL_SDK)
    35 #import <WebKitAdditions/PaymentSessionErrorCocoaAdditions.mm>
     34namespace WebCore {
     35
     36static Optional<ApplePaySessionError> additionalError(NSError *error)
     37{
     38#if HAVE(PASSKIT_INSTALLMENTS)
     39    // FIXME: Replace with PKPaymentErrorBindTokenUserInfoKey and
     40    // PKPaymentAuthorizationFeatureApplicationError when they're available in an SDK.
     41    static NSString * const bindTokenKey = @"PKPaymentErrorBindToken";
     42    static constexpr NSInteger pkPaymentAuthorizationFeatureApplicationError = -2016;
     43
     44    if (error.code != pkPaymentAuthorizationFeatureApplicationError)
     45        return WTF::nullopt;
     46
     47    id bindTokenValue = error.userInfo[bindTokenKey];
     48    RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!bindTokenValue || [bindTokenValue isKindOfClass:NSString.class]);
     49    return ApplePaySessionError { "featureApplicationError"_s, { { "bindToken"_s, (NSString *)bindTokenValue } } };
    3650#else
    37 namespace WebCore {
    38 static Optional<ApplePaySessionError> additionalError(NSError *) { return WTF::nullopt; }
     51    UNUSED_PARAM(error);
     52    return WTF::nullopt;
     53#endif
    3954}
    40 #endif
    41 
    42 namespace WebCore {
    4355
    4456PaymentSessionError::PaymentSessionError(RetainPtr<NSError>&& error)
  • trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayRequest.idl

    r227140 r260717  
    2929    required unsigned long version;
    3030    required DOMString merchantIdentifier;
     31    [Conditional=APPLE_PAY_INSTALLMENTS] ApplePayInstallmentConfiguration installmentConfiguration;
    3132};
  • trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManager.cpp

    r255581 r260717  
    4141static const Seconds taskDelayInterval { 100_ms };
    4242
    43 #undef LOGIDENTIFIER
    44 #define LOGIDENTIFIER __func__
    45 
    46 #undef ALWAYS_LOG
    47 #define ALWAYS_LOG logger().logAlways
     43#define ALWAYS_LOG_MEDIASESSIONMANAGER logger().logAlways
    4844
    4945struct ClientState {
     
    162158        return;
    163159
    164     ALWAYS_LOG(LOGIDENTIFIER);
     160    ALWAYS_LOG_MEDIASESSIONMANAGER(__func__);
    165161    m_mockPickerEnabled = enabled;
    166162}
     
    168164void WebMediaSessionManager::setMockMediaPlaybackTargetPickerState(const String& name, MediaPlaybackTargetContext::State state)
    169165{
    170     ALWAYS_LOG(LOGIDENTIFIER);
     166    ALWAYS_LOG_MEDIASESSIONMANAGER(__func__);
    171167    mockPicker().setState(name, state);
    172168}
     
    174170void WebMediaSessionManager::mockMediaPlaybackTargetPickerDismissPopup()
    175171{
    176     ALWAYS_LOG(LOGIDENTIFIER);
     172    ALWAYS_LOG_MEDIASESSIONMANAGER(__func__);
    177173    mockPicker().dismissPopup();
    178174}
     
    209205        return 0;
    210206
    211     ALWAYS_LOG(LOGIDENTIFIER, contextId);
     207    ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, contextId);
    212208    m_clientState.append(makeUnique<ClientState>(client, contextId));
    213209
     
    225221        return;
    226222
    227     ALWAYS_LOG(LOGIDENTIFIER, m_clientState[index].get());
     223    ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, m_clientState[index].get());
    228224
    229225    m_clientState.remove(index);
     
    238234    for (size_t i = m_clientState.size(); i > 0; --i) {
    239235        if (&m_clientState[i - 1]->client == &client) {
    240             ALWAYS_LOG(LOGIDENTIFIER, m_clientState[i - 1].get());
     236            ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, m_clientState[i - 1].get());
    241237            m_clientState.remove(i - 1);
    242238        }
     
    258254    }
    259255
    260     ALWAYS_LOG(LOGIDENTIFIER, m_clientState[index].get());
     256    ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, m_clientState[index].get());
    261257
    262258    bool hasActiveRoute = flagsAreSet(m_clientState[index]->flags, MediaProducer::IsPlayingToExternalDevice);
     
    276272        return;
    277273
    278     ALWAYS_LOG(LOGIDENTIFIER, m_clientState[index].get(), "new flags = ", newFlags);
     274    ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, m_clientState[index].get(), "new flags = ", newFlags);
    279275
    280276    changedClientState->flags = newFlags;
     
    300296
    301297        if (flagsAreSet(state->flags, MediaProducer::IsPlayingToExternalDevice) && flagsAreSet(state->flags, MediaProducer::IsPlayingVideo)) {
    302             ALWAYS_LOG(LOGIDENTIFIER, state.get(), " returning early");
     298            ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, state.get(), " returning early");
    303299            return;
    304300        }
     
    307303    // Do not begin playing to the device unless playback has just started.
    308304    if (!flagsAreSet(newFlags, MediaProducer::IsPlayingVideo) || flagsAreSet(oldFlags, MediaProducer::IsPlayingVideo)) {
    309         ALWAYS_LOG(LOGIDENTIFIER, "returning early, playback didn't just start");
     305        ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, "returning early, playback didn't just start");
    310306        return;
    311307    }
     
    314310        if (state == changedClientState)
    315311            continue;
    316         ALWAYS_LOG(LOGIDENTIFIER, state.get(), " calling setShouldPlayToPlaybackTarget(false)");
     312        ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, state.get(), " calling setShouldPlayToPlaybackTarget(false)");
    317313        state->client.setShouldPlayToPlaybackTarget(state->contextId, false);
    318314    }
    319315
    320     ALWAYS_LOG(LOGIDENTIFIER, changedClientState.get(), " calling setShouldPlayToPlaybackTarget(true)");
     316    ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, changedClientState.get(), " calling setShouldPlayToPlaybackTarget(true)");
    321317    changedClientState->client.setShouldPlayToPlaybackTarget(changedClientState->contextId, true);
    322318
     
    327323void WebMediaSessionManager::setPlaybackTarget(Ref<MediaPlaybackTarget>&& target)
    328324{
    329     ALWAYS_LOG(LOGIDENTIFIER, "has active route = ", target->hasActiveRoute());
     325    ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, "has active route = ", target->hasActiveRoute());
    330326    m_playbackTarget = WTFMove(target);
    331327    m_targetChanged = true;
     
    335331void WebMediaSessionManager::externalOutputDeviceAvailableDidChange(bool available)
    336332{
    337     ALWAYS_LOG(LOGIDENTIFIER, available);
     333    ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, available);
    338334    m_externalOutputDeviceAvailable = available;
    339335    for (auto& state : m_clientState)
     
    343339void WebMediaSessionManager::playbackTargetPickerWasDismissed()
    344340{
    345     ALWAYS_LOG(LOGIDENTIFIER);
     341    ALWAYS_LOG_MEDIASESSIONMANAGER(__func__);
    346342    m_playbackTargetPickerDismissed = true;
    347343    scheduleDelayedTask(TargetClientsConfigurationTask);
     
    376372        auto& state = m_clientState[i];
    377373
    378         ALWAYS_LOG(LOGIDENTIFIER, state.get(), ", requestedPicker = ", state->requestedPicker);
     374        ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, state.get(), ", requestedPicker = ", state->requestedPicker);
    379375
    380376        if ((m_targetChanged || m_playbackTargetPickerDismissed) && state->requestedPicker)
     
    402398
    403399        if (i != indexOfClientWillPlayToTarget || !haveActiveRoute) {
    404             ALWAYS_LOG(LOGIDENTIFIER, state.get(), " calling setShouldPlayToPlaybackTarget(false)");
     400            ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, state.get(), " calling setShouldPlayToPlaybackTarget(false)");
    405401            state->client.setShouldPlayToPlaybackTarget(state->contextId, false);
    406402        }
    407403
    408404        if (state->requestedPicker && m_playbackTargetPickerDismissed) {
    409             ALWAYS_LOG(LOGIDENTIFIER, state.get(), " calling playbackTargetPickerWasDismissed");
     405            ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, state.get(), " calling playbackTargetPickerWasDismissed");
    410406            state->client.playbackTargetPickerWasDismissed(state->contextId);
    411407        }
     
    419415        auto& state = m_clientState[indexOfClientWillPlayToTarget];
    420416        if (!flagsAreSet(state->flags, MediaProducer::IsPlayingToExternalDevice)) {
    421             ALWAYS_LOG(LOGIDENTIFIER, state.get(), " calling setShouldPlayToPlaybackTarget(true)");
     417            ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, state.get(), " calling setShouldPlayToPlaybackTarget(true)");
    422418            state->client.setShouldPlayToPlaybackTarget(state->contextId, true);
    423419        }
     
    434430    bool haveClientWithMedia = false;
    435431    for (auto& state : m_clientState) {
    436         ALWAYS_LOG(LOGIDENTIFIER, state.get());
     432        ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, state.get());
    437433        if (state->flags & MediaProducer::RequiresPlaybackTargetMonitoring) {
    438434            monitoringRequired = true;
     
    446442
    447443    if (monitoringRequired || (hasAvailabilityListener && haveClientWithMedia)) {
    448         ALWAYS_LOG(LOGIDENTIFIER, "starting monitoring");
     444        ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, "starting monitoring");
    449445        targetPicker().startingMonitoringPlaybackTargets();
    450446    } else {
    451         ALWAYS_LOG(LOGIDENTIFIER, "stopping monitoring");
     447        ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, "stopping monitoring");
    452448        targetPicker().stopMonitoringPlaybackTargets();
    453449    }
     
    491487    if (!m_playbackTarget || !m_playbackTarget->hasActiveRoute()) {
    492488        if (m_watchdogTimer.isActive()) {
    493             ALWAYS_LOG(LOGIDENTIFIER, "stopping timer");
     489            ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, "stopping timer");
    494490            m_currentWatchdogInterval = { };
    495491            m_watchdogTimer.stop();
     
    503499    for (auto& state : m_clientState) {
    504500
    505         ALWAYS_LOG(LOGIDENTIFIER, state.get(), " playedToEnd = ", state->playedToEnd);
     501        ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, state.get(), " playedToEnd = ", state->playedToEnd);
    506502
    507503        if (flagsAreSet(state->flags, MediaProducer::IsPlayingToExternalDevice) && flagsAreSet(state->flags, MediaProducer::IsPlayingVideo))
     
    513509
    514510    if (stopTimer) {
    515         ALWAYS_LOG(LOGIDENTIFIER, "stopping timer");
     511        ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, "stopping timer");
    516512        m_currentWatchdogInterval = { };
    517513        m_watchdogTimer.stop();
     
    521517            m_watchdogTimer.startOneShot(interval);
    522518        }
    523         ALWAYS_LOG(LOGIDENTIFIER, "timer scheduled for ", interval.value(), " seconds");
     519        ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, "timer scheduled for ", interval.value(), " seconds");
    524520        m_currentWatchdogInterval = interval;
    525521    }
     
    531527        return;
    532528
    533     ALWAYS_LOG(LOGIDENTIFIER);
     529    ALWAYS_LOG_MEDIASESSIONMANAGER(__func__);
    534530    targetPicker().invalidatePlaybackTargets();
    535531}
  • trunk/Source/WebCore/PAL/ChangeLog

    r260712 r260717  
     12020-04-25  Alex Christensen  <achristensen@webkit.org>
     2
     3        Move ApplePay code from WebKitAdditions to WebCore and WebKit
     4        https://bugs.webkit.org/show_bug.cgi?id=210521
     5
     6        Reviewed by Andy Estes.
     7
     8        * pal/cocoa/PassKitSoftLink.h:
     9        * pal/cocoa/PassKitSoftLink.mm:
     10        * pal/spi/cocoa/PassKitSPI.h:
     11
    1122020-04-25  Darin Adler  <darin@apple.com>
    213
  • trunk/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.h

    r256648 r260717  
    4040SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentMerchantSession)
    4141SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentRequest)
     42SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentSetupConfiguration)
     43SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentSetupController)
     44SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentSetupFeature)
     45SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentSetupRequest)
     46SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentSetupViewController)
    4247SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentSummaryItem)
    4348SOFT_LINK_CLASS_FOR_HEADER(PAL, PKShippingMethod)
     49
     50#if HAVE(PASSKIT_INSTALLMENTS)
     51SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentInstallmentConfiguration)
     52#endif
    4453
    4554#if PLATFORM(IOS_FAMILY)
  • trunk/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.mm

    r256648 r260717  
    3333#if PLATFORM(MAC)
    3434SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PAL_EXPORT)
    35 #else
     35
     36SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL_WITH_EXPORT(PAL, PassKit, PKPaymentSetupConfiguration, PAL_EXPORT)
     37SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL_WITH_EXPORT(PAL, PassKit, PKPaymentSetupController, PAL_EXPORT)
     38SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL_WITH_EXPORT(PAL, PassKit, PKPaymentSetupFeature, PAL_EXPORT)
     39SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL_WITH_EXPORT(PAL, PassKit, PKPaymentSetupRequest, PAL_EXPORT)
     40
     41#if HAVE(PASSKIT_INSTALLMENTS)
     42SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL_WITH_EXPORT(PAL, PassKit, PKPaymentInstallmentConfiguration, PAL_EXPORT)
     43#endif
     44
     45#else // PLATFORM(MAC)
     46
    3647SOFT_LINK_FRAMEWORK_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PAL_EXPORT)
     48
     49SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentSetupConfiguration, PAL_EXPORT)
     50SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentSetupController, PAL_EXPORT)
     51SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentSetupFeature, PAL_EXPORT)
     52SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentSetupRequest, PAL_EXPORT)
     53SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentSetupViewController, PAL_EXPORT)
     54
     55#if HAVE(PASSKIT_INSTALLMENTS)
     56SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentInstallmentConfiguration, PAL_EXPORT)
    3757#endif
     58
     59#endif // PLATFORM(MAC)
    3860
    3961SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKContact, PAL_EXPORT)
  • trunk/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h

    r260366 r260717  
    4646#import <PassKit/PKPaymentMethod.h>
    4747#import <PassKit/PKPaymentRequest_Private.h>
     48#import <PassKit/PKPaymentSetupConfiguration_WebKit.h>
     49#import <PassKit/PKPaymentSetupController.h>
     50#import <PassKit/PKPaymentSetupRequest.h>
    4851#import <PassKitCore/PKPaymentRequestStatus_Private.h>
    4952#import <PassKitCore/PKPaymentRequest_WebKit.h>
    5053
     54#if HAVE(PASSKIT_INSTALLMENTS)
     55#import <PassKitCore/PKPayment_Private.h>
     56#import <PassKitCore/PKPaymentInstallmentConfiguration.h>
     57#import <PassKitCore/PKPaymentMethod_Private.h>
     58#endif
     59
    5160#if PLATFORM(IOS_FAMILY)
    5261#import <PassKit/PKPaymentAuthorizationController_Private.h>
     62#import <PassKit/PKPaymentSetupViewController.h>
     63#endif
     64
     65#if HAVE(PASSKIT_INSTALLMENT_IDENTIFIERS) && PLATFORM(MAC)
     66@interface PKPaymentInstallmentConfiguration (WebKitSPI)
     67@property (nonatomic, copy, nullable) NSString *installmentMerchantIdentifier;
     68@property (nonatomic, copy, nullable) NSString *referrerIdentifier;
     69@end
    5370#endif
    5471
  • trunk/Source/WebCore/SourcesCocoa.txt

    r260561 r260717  
    596596    Modules/applepay/ApplePayPaymentMethodSelectedEvent.cpp
    597597    Modules/applepay/ApplePayRequestBase.cpp
     598    Modules/applepay/ApplePaySetup.cpp
     599    Modules/applepay/ApplePaySetupFeature.mm
    598600    Modules/applepay/ApplePaySession.cpp
    599601    Modules/applepay/ApplePaySessionPaymentRequest.cpp
     
    603605    Modules/applepay/PaymentCoordinator.cpp
    604606    Modules/applepay/PaymentCoordinatorClient.cpp
     607    Modules/applepay/PaymentInstallmentConfiguration.mm
    605608    Modules/applepay/PaymentRequestValidator.mm
    606609    Modules/applepay/PaymentSession.cpp
     
    621624    JSApplePayErrorCode.cpp
    622625    JSApplePayErrorContactField.cpp
     626    JSApplePayInstallmentConfiguration.cpp
    623627    JSApplePayLineItem.cpp
    624628    JSApplePayMerchantCapability.cpp
     
    638642    JSApplePaySession.cpp
    639643    JSApplePaySessionError.cpp
     644    JSApplePaySetup.cpp
     645    JSApplePaySetupFeature.cpp
     646    JSApplePaySetupFeatureType.cpp
    640647    JSApplePayShippingContactSelectedEvent.cpp
    641648    JSApplePayShippingContactUpdate.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r260712 r260717  
    19011901                5C4304B1191AC908000E2BC0 /* EXTShaderTextureLOD.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C4304AE191AC908000E2BC0 /* EXTShaderTextureLOD.h */; };
    19021902                5C4304B6191AEF46000E2BC0 /* JSEXTShaderTextureLOD.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C4304B4191AEF46000E2BC0 /* JSEXTShaderTextureLOD.h */; };
     1903                5C53DCE124465DFC00A93124 /* ApplePaySetupFeature.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C53DCCF2446449900A93124 /* ApplePaySetupFeature.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1904                5C53DCE724468AD200A93124 /* PaymentInstallmentConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C53DCCE2446449900A93124 /* PaymentInstallmentConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1905                5C53DCEA24468FB400A93124 /* ApplePaySetup.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C53DCCB2446449800A93124 /* ApplePaySetup.h */; settings = {ATTRIBUTES = (Private, ); }; };
    19031906                5C5D2385227A0652000B9BDA /* CustomHeaderFields.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C5D2383227A063A000B9BDA /* CustomHeaderFields.h */; settings = {ATTRIBUTES = (Private, ); }; };
    19041907                5C7C88D81D0F1F4A009D2F6D /* SocketProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C7C88D71D0F1F2B009D2F6D /* SocketProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    90929095                5C5381B31D87E08100E2EBE6 /* JSURLSearchParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSURLSearchParams.cpp; sourceTree = "<group>"; };
    90939096                5C5381B41D87E08100E2EBE6 /* JSURLSearchParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSURLSearchParams.h; sourceTree = "<group>"; };
     9097                5C53DCC62446449700A93124 /* ApplePaySetup.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ApplePaySetup.idl; sourceTree = "<group>"; };
     9098                5C53DCC92446449800A93124 /* ApplePaySetupFeature.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ApplePaySetupFeature.mm; sourceTree = "<group>"; };
     9099                5C53DCCA2446449800A93124 /* ApplePaySetupFeature.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ApplePaySetupFeature.idl; sourceTree = "<group>"; };
     9100                5C53DCCB2446449800A93124 /* ApplePaySetup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplePaySetup.h; sourceTree = "<group>"; };
     9101                5C53DCCC2446449900A93124 /* PaymentInstallmentConfiguration.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PaymentInstallmentConfiguration.mm; sourceTree = "<group>"; };
     9102                5C53DCCE2446449900A93124 /* PaymentInstallmentConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaymentInstallmentConfiguration.h; sourceTree = "<group>"; };
     9103                5C53DCCF2446449900A93124 /* ApplePaySetupFeature.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplePaySetupFeature.h; sourceTree = "<group>"; };
     9104                5C53DCD02446449A00A93124 /* ApplePayInstallmentConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplePayInstallmentConfiguration.h; sourceTree = "<group>"; };
     9105                5C53DCD22446449A00A93124 /* ApplePaySetup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ApplePaySetup.cpp; sourceTree = "<group>"; };
     9106                5C53DCD42446449B00A93124 /* ApplePaySetupFeatureType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplePaySetupFeatureType.h; sourceTree = "<group>"; };
     9107                5C53DCD52446449B00A93124 /* ApplePayInstallmentConfiguration.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ApplePayInstallmentConfiguration.idl; sourceTree = "<group>"; };
     9108                5C53DCD62446449C00A93124 /* ApplePaySetupFeatureType.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ApplePaySetupFeatureType.idl; sourceTree = "<group>"; };
    90949109                5C5D2383227A063A000B9BDA /* CustomHeaderFields.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomHeaderFields.h; sourceTree = "<group>"; };
    90959110                5C5D2386227A077C000B9BDA /* CustomHeaderFields.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomHeaderFields.cpp; sourceTree = "<group>"; };
     
    1731217327                                A1BB85A02159AF570067E07D /* ApplePayErrorContactField.h */,
    1731317328                                A1BB85A22159AF570067E07D /* ApplePayErrorContactField.idl */,
     17329                                5C53DCD02446449A00A93124 /* ApplePayInstallmentConfiguration.h */,
     17330                                5C53DCD52446449B00A93124 /* ApplePayInstallmentConfiguration.idl */,
    1731417331                                7C6579E21E00827000E3A27A /* ApplePayLineItem.h */,
    1731517332                                7C6579E41E0082C800E3A27A /* ApplePayLineItem.idl */,
     
    1734917366                                1A58E8631D19D4DF00C0EA73 /* ApplePaySessionPaymentRequest.cpp */,
    1735017367                                1A58E8641D19D4DF00C0EA73 /* ApplePaySessionPaymentRequest.h */,
     17368                                5C53DCD22446449A00A93124 /* ApplePaySetup.cpp */,
     17369                                5C53DCCB2446449800A93124 /* ApplePaySetup.h */,
     17370                                5C53DCC62446449700A93124 /* ApplePaySetup.idl */,
     17371                                5C53DCCF2446449900A93124 /* ApplePaySetupFeature.h */,
     17372                                5C53DCCA2446449800A93124 /* ApplePaySetupFeature.idl */,
     17373                                5C53DCC92446449800A93124 /* ApplePaySetupFeature.mm */,
     17374                                5C53DCD42446449B00A93124 /* ApplePaySetupFeatureType.h */,
     17375                                5C53DCD62446449C00A93124 /* ApplePaySetupFeatureType.idl */,
    1735117376                                1A8A64471D19FCFB00D0E00F /* ApplePayShippingContactSelectedEvent.cpp */,
    1735217377                                1A8A64481D19FCFB00D0E00F /* ApplePayShippingContactSelectedEvent.h */,
     
    1737217397                                1A58E8621D19D3BF00C0EA73 /* PaymentCoordinatorClient.h */,
    1737317398                                7CF930E61E01F9AD00BAFFBE /* PaymentHeaders.h */,
     17399                                5C53DCCE2446449900A93124 /* PaymentInstallmentConfiguration.h */,
     17400                                5C53DCCC2446449900A93124 /* PaymentInstallmentConfiguration.mm */,
    1737417401                                1AE96A871D1A0CEB00B86768 /* PaymentMerchantSession.h */,
    1737517402                                1A8A64391D19FC5300D0E00F /* PaymentMethod.h */,
     
    2948829515                                A1956F202331A8C70057E9D2 /* ApplePaySessionError.h in Headers */,
    2948929516                                1A58E8651D19D4EB00C0EA73 /* ApplePaySessionPaymentRequest.h in Headers */,
     29517                                5C53DCEA24468FB400A93124 /* ApplePaySetup.h in Headers */,
     29518                                5C53DCE124465DFC00A93124 /* ApplePaySetupFeature.h in Headers */,
    2949029519                                1A8A645C1D19FCFC00D0E00F /* ApplePayShippingContactSelectedEvent.h in Headers */,
    2949129520                                A12C59F22035FCD60012236B /* ApplePayShippingContactUpdate.h in Headers */,
     
    3221332242                                A1DF5AA61F7F64BB0058A477 /* PaymentHandler.h in Headers */,
    3221432243                                7CF930E71E01F9B400BAFFBE /* PaymentHeaders.h in Headers */,
     32244                                5C53DCE724468AD200A93124 /* PaymentInstallmentConfiguration.h in Headers */,
    3221532245                                A1F76B311F44C55A0014C318 /* PaymentItem.h in Headers */,
    3221632246                                1AE96A891D1A0CEB00B86768 /* PaymentMerchantSession.h in Headers */,
  • trunk/Source/WebCore/platform/cocoa/WebCoreAdditions.mm

    r238739 r260717  
    2525
    2626#import "config.h"
    27 
    28 #if USE(APPLE_INTERNAL_SDK)
    29 #import <WebKitAdditions/WebCoreAdditions.mm>
    30 #endif
  • trunk/Source/WebKit/ChangeLog

    r260712 r260717  
     12020-04-25  Alex Christensen  <achristensen@webkit.org>
     2
     3        Move ApplePay code from WebKitAdditions to WebCore and WebKit
     4        https://bugs.webkit.org/show_bug.cgi?id=210521
     5
     6        Reviewed by Andy Estes.
     7
     8        * DerivedSources.make:
     9        * Scripts/webkit/messages.py:
     10        * Shared/ApplePay/ApplePayPaymentSetupFeatures.h: Added.
     11        (WebKit::PaymentSetupFeatures::platformFeatures const):
     12        * Shared/ApplePay/ApplePayPaymentSetupFeatures.mm: Added.
     13        (WebKit::PaymentSetupFeatures::PaymentSetupFeatures):
     14        (WebKit::PaymentSetupFeatures::encode const):
     15        (WebKit::PaymentSetupFeatures::decode):
     16        (WebKit::PaymentSetupFeatures::operator Vector<Ref<WebCore::ApplePaySetupFeature>> const):
     17        * Shared/ApplePay/PaymentSetupConfiguration.h: Added.
     18        (WebKit::PaymentSetupConfiguration::platformConfiguration const):
     19        * Shared/ApplePay/PaymentSetupConfiguration.mm: Added.
     20        (WebKit::toPlatformConfiguration):
     21        (WebKit::PaymentSetupConfiguration::PaymentSetupConfiguration):
     22        (WebKit::PaymentSetupConfiguration::encode const):
     23        (WebKit::PaymentSetupConfiguration::decode):
     24        * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
     25        * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
     26        (WebKit::WebPaymentCoordinatorProxy::finishConstruction): Deleted.
     27        * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
     28        * Shared/ApplePay/cocoa/PaymentSetupConfiguration.mm: Added.
     29        (WebKitAdditions::toPlatformConfiguration):
     30        (WebKitAdditions::PaymentSetupConfiguration::PaymentSetupConfiguration):
     31        (WebKitAdditions::PaymentSetupConfiguration::encode const):
     32        (WebKitAdditions::PaymentSetupConfiguration::decode):
     33        * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
     34        (WebKit::finishCreating):
     35        (WebKit::WebPaymentCoordinatorProxy::getSetupFeatures):
     36        (WebKit::WebPaymentCoordinatorProxy::beginApplePaySetup):
     37        (WebKit::WebPaymentCoordinatorProxy::endApplePaySetup):
     38        (WebKit::WebPaymentCoordinatorProxy::platformBeginApplePaySetup):
     39        (WebKit::WebPaymentCoordinatorProxy::platformEndApplePaySetup):
     40        * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
     41        (IPC::finishDecoding):
     42        (IPC::finishEncoding):
     43        (IPC::ArgumentCoder<WebCore::PaymentInstallmentConfiguration>::encode):
     44        (IPC::ArgumentCoder<WebCore::PaymentInstallmentConfiguration>::decode):
     45        * SourcesCocoa.txt:
     46        * WebKit.xcodeproj/project.pbxproj:
     47        * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
     48        (WebKit::WebPaymentCoordinator::getSetupFeatures):
     49        (WebKit::WebPaymentCoordinator::beginApplePaySetup):
     50        (WebKit::WebPaymentCoordinator::endApplePaySetup):
     51        * WebProcess/ApplePay/WebPaymentCoordinator.h:
     52
    1532020-04-25  Darin Adler  <darin@apple.com>
    254
  • trunk/Source/WebKit/DerivedSources.make

    r260102 r260717  
    254254HEADER_FLAGS = $(shell echo $(BUILT_PRODUCTS_DIR) $(HEADER_SEARCH_PATHS) $(SYSTEM_HEADER_SEARCH_PATHS) | perl -e 'print "-I" . join(" -I", split(" ", <>));')
    255255
    256 -include WebKitDerivedSourcesAdditions.make
    257 
    258256.PHONY : all
    259257
  • trunk/Source/WebKit/Scripts/webkit/messages.py

    r260381 r260717  
    645645        'WebKit::LayerHostingMode': ['"LayerTreeContext.h"'],
    646646        'WebKit::PageState': ['"SessionState.h"'],
     647        'WebKit::PaymentSetupFeatures': ['"ApplePayPaymentSetupFeatures.h"'],
    647648        'WebKit::RespectSelectionAnchor': ['"GestureTypes.h"'],
    648649        'WebKit::WebGestureEvent': ['"WebEvent.h"'],
  • trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp

    r256083 r260717  
    4646}
    4747
    48 WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy(WebPaymentCoordinatorProxy::Client& client)
    49     : m_client { client }
    50     , m_canMakePaymentsQueue { WorkQueue::create("com.apple.WebKit.CanMakePayments") }
    51 {
    52     m_client.paymentCoordinatorAddMessageReceiver(*this, Messages::WebPaymentCoordinatorProxy::messageReceiverName(), *this);
    53     finishConstruction(*this);
    54 }
    55 
    56 WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy()
    57 {
    58     if (m_state != State::Idle)
    59         hidePaymentUI();
    60 
    61     m_client.paymentCoordinatorRemoveMessageReceiver(*this, Messages::WebPaymentCoordinatorProxy::messageReceiverName());
    62 }
    63 
    6448IPC::Connection* WebPaymentCoordinatorProxy::messageSenderConnection() const
    6549{
  • trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h

    r250287 r260717  
    3535#include <wtf/Forward.h>
    3636#include <wtf/RetainPtr.h>
     37#include <wtf/WeakObjCPtr.h>
    3738#include <wtf/WeakPtr.h>
    3839#include <wtf/WorkQueue.h>
    3940
    40 #if USE(APPLE_INTERNAL_SDK)
    41 #include <WebKitAdditions/WebPaymentCoordinatorProxyAdditions.h>
     41#if HAVE(PASSKIT_PAYMENT_SETUP)
     42OBJC_CLASS PKPaymentSetupViewController;
     43OBJC_CLASS UIViewController;
    4244#endif
    4345
     
    6163OBJC_CLASS UIViewController;
    6264
     65#if PLATFORM(IOS)
     66OBJC_CLASS PKPaymentSetupViewController;
     67#endif
     68
    6369namespace WebKit {
    6470
     71class PaymentSetupConfiguration;
     72class PaymentSetupFeatures;
    6573class WebPageProxy;
    6674
     
    125133    void cancelPaymentSession();
    126134
     135#if HAVE(PASSKIT_PAYMENT_SETUP)
     136    void getSetupFeatures(const PaymentSetupConfiguration&, CompletionHandler<void(const PaymentSetupFeatures&)>&&);
     137    void beginApplePaySetup(const PaymentSetupConfiguration&, const PaymentSetupFeatures&, CompletionHandler<void(bool)>&&);
     138    void endApplePaySetup();
     139    void platformBeginApplePaySetup(const PaymentSetupConfiguration&, const PaymentSetupFeatures&, CompletionHandler<void(bool)>&&);
     140    void platformEndApplePaySetup();
     141#endif
     142
    127143    bool canBegin() const;
    128144    bool canCancel() const;
     
    192208    RetainPtr<NSObject> m_sheetWindowWillCloseObserver;
    193209#endif
    194    
    195 #if defined(WEBPAYMENTCOORDINATORPROXY_ADDITIONS)
    196 WEBPAYMENTCOORDINATORPROXY_ADDITIONS
    197 #undef WEBPAYMENTCOORDINATORPROXY_ADDITIONS
    198 #else
    199     void finishConstruction(WebPaymentCoordinatorProxy&) { }
     210#if PLATFORM(IOS)
     211    WeakObjCPtr<PKPaymentSetupViewController> m_paymentSetupViewController;
    200212#endif
    201213};
  • trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in

    r252655 r260717  
    3939    AbortPaymentSession()
    4040    CancelPaymentSession()
     41#if HAVE(PASSKIT_PAYMENT_SETUP)
     42    GetSetupFeatures(WebKit::PaymentSetupConfiguration configuration) -> (WebKit::PaymentSetupFeatures features) Async
     43    BeginApplePaySetup(WebKit::PaymentSetupConfiguration configuration, WebKit::PaymentSetupFeatures features) -> (bool result) Async
     44    EndApplePaySetup()
     45#endif
    4146}
    4247
  • trunk/Source/WebKit/Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm

    r260485 r260717  
    3131#import "WKPaymentAuthorizationDelegate.h"
    3232#import "WebPaymentCoordinatorProxy.h"
     33#import "WebPaymentCoordinatorProxyMessages.h"
    3334#import <WebCore/PaymentAuthorizationStatus.h>
    3435#import <WebCore/PaymentHeaders.h>
     
    3839#import <wtf/cocoa/VectorCocoa.h>
    3940
     41#if HAVE(PASSKIT_PAYMENT_SETUP)
     42#import "APIUIClient.h"
     43#import "ApplePayPaymentSetupFeatures.h"
     44#import "PaymentSetupConfiguration.h"
     45#import "WebPageProxy.h"
     46#import "WebProcessProxy.h"
     47#endif
     48
    4049#import <pal/cocoa/PassKitSoftLink.h>
    41 
    42 #if USE(APPLE_INTERNAL_SDK)
    43 #import <WebKitAdditions/WebPaymentCoordinatorProxyCocoaAdditions.mm>
    44 #else
    45 namespace WebKit {
    46 static void finishCreating(PKPaymentRequest *, const WebCore::ApplePaySessionPaymentRequest&) { }
    47 }
    48 #endif
    4950
    5051// FIXME: We don't support any platforms without -setThumbnailURLs:, so this can be removed.
     
    6162
    6263namespace WebKit {
     64
     65static void finishCreating(PKPaymentRequest *platformRequest, const WebCore::ApplePaySessionPaymentRequest& request)
     66{
     67#if HAVE(PASSKIT_INSTALLMENTS)
     68    if (PKPaymentInstallmentConfiguration *configuration = request.installmentConfiguration().platformConfiguration()) {
     69        platformRequest.installmentConfiguration = configuration;
     70        platformRequest.requestType = PKPaymentRequestTypeInstallment;
     71    }
     72#else
     73    UNUSED_PARAM(platformRequest);
     74    UNUSED_PARAM(request);
     75#endif
     76}
     77
     78WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy(WebPaymentCoordinatorProxy::Client& client)
     79    : m_client(client)
     80    , m_canMakePaymentsQueue(WorkQueue::create("com.apple.WebKit.CanMakePayments"))
     81{
     82    m_client.paymentCoordinatorAddMessageReceiver(*this, Messages::WebPaymentCoordinatorProxy::messageReceiverName(), *this);
     83}
     84
     85WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy()
     86{
     87    if (m_state != State::Idle)
     88        hidePaymentUI();
     89
     90    m_client.paymentCoordinatorRemoveMessageReceiver(*this, Messages::WebPaymentCoordinatorProxy::messageReceiverName());
     91}
    6392
    6493void WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void(bool)>&& completionHandler)
     
    271300}
    272301
     302#if HAVE(PASSKIT_PAYMENT_SETUP)
     303
     304void WebPaymentCoordinatorProxy::getSetupFeatures(const PaymentSetupConfiguration& configuration, Messages::WebPaymentCoordinatorProxy::GetSetupFeatures::AsyncReply&& reply)
     305{
     306#if PLATFORM(MAC)
     307    if (!PAL::getPKPaymentSetupControllerClass()) {
     308        reply({ });
     309        return;
     310    }
     311#endif
     312
     313    auto completion = makeBlockPtr([reply = WTFMove(reply)](NSArray<PKPaymentSetupFeature *> *features) mutable {
     314        RunLoop::main().dispatch([reply = WTFMove(reply), features = retainPtr(features)]() mutable {
     315            reply(PaymentSetupFeatures { WTFMove(features) });
     316        });
     317    });
     318
     319ALLOW_NEW_API_WITHOUT_GUARDS_BEGIN
     320    [PAL::getPKPaymentSetupControllerClass() paymentSetupFeaturesForConfiguration:configuration.platformConfiguration() completion:completion.get()];
     321ALLOW_NEW_API_WITHOUT_GUARDS_END
     322}
     323
     324void WebPaymentCoordinatorProxy::beginApplePaySetup(const PaymentSetupConfiguration& configuration, const PaymentSetupFeatures& features, Messages::WebPaymentCoordinatorProxy::BeginApplePaySetup::AsyncReply&& reply)
     325{
     326    platformBeginApplePaySetup(configuration, features, WTFMove(reply));
     327}
     328
     329void WebPaymentCoordinatorProxy::endApplePaySetup()
     330{
     331    platformEndApplePaySetup();
     332}
     333
     334#if PLATFORM(MAC)
     335
     336void WebPaymentCoordinatorProxy::platformBeginApplePaySetup(const PaymentSetupConfiguration& configuration, const PaymentSetupFeatures& features, Messages::WebPaymentCoordinatorProxy::BeginApplePaySetup::AsyncReply&& reply)
     337{
     338    if (!PAL::getPKPaymentSetupRequestClass()) {
     339        reply(false);
     340        return;
     341    }
     342
     343    auto request = adoptNS([PAL::allocPKPaymentSetupRequestInstance() init]);
     344    [request setConfiguration:configuration.platformConfiguration()];
     345    [request setPaymentSetupFeatures:features.platformFeatures()];
     346
     347    auto completion = makeBlockPtr([reply = WTFMove(reply)](BOOL success) mutable {
     348        RunLoop::main().dispatch([reply = WTFMove(reply), success]() mutable {
     349            reply(success);
     350        });
     351    });
     352
     353    auto paymentSetupController = adoptNS([PAL::allocPKPaymentSetupControllerInstance() init]);
     354
     355ALLOW_NEW_API_WITHOUT_GUARDS_BEGIN
     356    [paymentSetupController presentPaymentSetupRequest:request.get() completion:completion.get()];
     357ALLOW_NEW_API_WITHOUT_GUARDS_END
     358}
     359
     360void WebPaymentCoordinatorProxy::platformEndApplePaySetup()
     361{
     362}
     363
     364#else // PLATFORM(MAC)
     365
     366void WebPaymentCoordinatorProxy::platformBeginApplePaySetup(const PaymentSetupConfiguration& configuration, const PaymentSetupFeatures& features, Messages::WebPaymentCoordinatorProxy::BeginApplePaySetup::AsyncReply&& reply)
     367{
     368    UIViewController *presentingViewController = m_paymentCoordinatorProxy.m_client.paymentCoordinatorPresentingViewController(m_paymentCoordinatorProxy);
     369    if (!presentingViewController) {
     370        reply(false);
     371        return;
     372    }
     373
     374    auto request = adoptNS([PAL::allocPKPaymentSetupRequestInstance() init]);
     375    [request setConfiguration:configuration.platformConfiguration()];
     376    [request setPaymentSetupFeatures:features.platformFeatures()];
     377
     378    auto paymentSetupViewController = adoptNS([PAL::allocPKPaymentSetupViewControllerInstance() initWithPaymentSetupRequest:request.get()]);
     379    if (!paymentSetupViewController) {
     380        reply(false);
     381        return;
     382    }
     383
     384    auto completion = makeBlockPtr([reply = WTFMove(reply)]() mutable {
     385        RunLoop::main().dispatch([reply = WTFMove(reply)]() mutable {
     386            reply(true);
     387        });
     388    });
     389
     390    endApplePaySetup();
     391    [presentingViewController presentViewController:paymentSetupViewController.get() animated:YES completion:completion.get()];
     392    m_paymentSetupViewController = paymentSetupViewController.get();
     393}
     394
     395void WebPaymentCoordinatorProxy::platformEndApplePaySetup()
     396{
     397    [m_paymentSetupViewController dismissViewControllerAnimated:YES completion:nil];
     398    m_paymentSetupViewController = nil;
     399}
     400
     401#endif // PLATFORM(MAC)
     402
     403#endif // HAVE(PASSKIT_PAYMENT_SETUP)
     404
    273405} // namespace WebKit
    274406
  • trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm

    r255784 r260717  
    4242#endif
    4343
    44 #if USE(APPLE_INTERNAL_SDK)
    45 #import <WebKitAdditions/WebCoreArgumentCodersCocoaAdditions.mm>
    46 #elif ENABLE(APPLE_PAY)
    47 namespace IPC {
    48 static bool finishDecoding(Decoder&, WebCore::ApplePaySessionPaymentRequest&) { return true; }
    49 static void finishEncoding(Encoder&, const WebCore::ApplePaySessionPaymentRequest&) { }
    50 }
    51 #endif
    52 
    5344namespace IPC {
    5445using namespace WebCore;
    5546
    5647#if ENABLE(APPLE_PAY)
     48
     49static bool finishDecoding(Decoder& decoder, WebCore::ApplePaySessionPaymentRequest& request)
     50{
     51#if ENABLE(APPLE_PAY_INSTALLMENTS)
     52    Optional<WebCore::PaymentInstallmentConfiguration> installmentConfiguration;
     53    decoder >> installmentConfiguration;
     54    if (!installmentConfiguration)
     55        return false;
     56
     57    request.setInstallmentConfiguration(WTFMove(*installmentConfiguration));
     58    return true;
     59#else
     60    UNUSED_PARAM(decoder);
     61    UNUSED_PARAM(request);
     62    return true;
     63#endif
     64}
     65
     66static void finishEncoding(Encoder& encoder, const WebCore::ApplePaySessionPaymentRequest& request)
     67{
     68#if ENABLE(APPLE_PAY_INSTALLMENTS)
     69    encoder << request.installmentConfiguration();
     70#else
     71    UNUSED_PARAM(encoder);
     72    UNUSED_PARAM(request);
     73#endif
     74}
     75
     76#if HAVE(PASSKIT_INSTALLMENTS)
     77
     78void ArgumentCoder<WebCore::PaymentInstallmentConfiguration>::encode(Encoder& encoder, const WebCore::PaymentInstallmentConfiguration& configuration)
     79{
     80    encoder << configuration.platformConfiguration();
     81}
     82
     83Optional<WebCore::PaymentInstallmentConfiguration> ArgumentCoder<WebCore::PaymentInstallmentConfiguration>::decode(Decoder& decoder)
     84{
     85    auto configuration = IPC::decode<PKPaymentInstallmentConfiguration>(decoder, PAL::getPKPaymentInstallmentConfigurationClass());
     86    if (!configuration)
     87        return WTF::nullopt;
     88
     89    return { WTFMove(*configuration) };
     90}
     91
     92#endif // HAVE(PASSKIT_INSTALLMENTS)
    5793
    5894void ArgumentCoder<WebCore::Payment>::encode(Encoder& encoder, const WebCore::Payment& payment)
  • trunk/Source/WebKit/SourcesCocoa.txt

    r260182 r260717  
    123123Shared/API/Cocoa/WKRemoteObjectCoder.mm
    124124
     125Shared/ApplePay/ApplePayPaymentSetupFeatures.mm
     126Shared/ApplePay/PaymentSetupConfiguration.mm
    125127Shared/ApplePay/WebPaymentCoordinatorProxy.cpp
    126128Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r260712 r260717  
    40284028                5C46C0AE21B71AE200BC5991 /* _WKWebsiteDataStoreConfigurationInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKWebsiteDataStoreConfigurationInternal.h; sourceTree = "<group>"; };
    40294029                5C4B9D8A210A8C46008F14D1 /* UndoOrRedo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UndoOrRedo.h; sourceTree = "<group>"; };
     4030                5C53DCDD24465BF900A93124 /* ApplePayPaymentSetupFeatures.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ApplePayPaymentSetupFeatures.mm; sourceTree = "<group>"; };
     4031                5C53DCDE24465BF900A93124 /* PaymentSetupConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaymentSetupConfiguration.h; sourceTree = "<group>"; };
     4032                5C53DCDF24465BF900A93124 /* ApplePayPaymentSetupFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplePayPaymentSetupFeatures.h; sourceTree = "<group>"; };
     4033                5C53DCE024465BF900A93124 /* PaymentSetupConfiguration.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PaymentSetupConfiguration.mm; sourceTree = "<group>"; };
    40304034                5C5CEC382209583200D6BBB0 /* DaemonEntryPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DaemonEntryPoint.h; sourceTree = "<group>"; };
    40314035                5C5CEC392209583200D6BBB0 /* DaemonEntryPoint.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DaemonEntryPoint.mm; sourceTree = "<group>"; };
     
    62656269                                1AB1F77A1D1B30A9007C9BD1 /* ios */,
    62666270                                1AB1F77C1D1B30A9007C9BD1 /* mac */,
     6271                                5C53DCDF24465BF900A93124 /* ApplePayPaymentSetupFeatures.h */,
     6272                                5C53DCDD24465BF900A93124 /* ApplePayPaymentSetupFeatures.mm */,
     6273                                5C53DCDE24465BF900A93124 /* PaymentSetupConfiguration.h */,
     6274                                5C53DCE024465BF900A93124 /* PaymentSetupConfiguration.mm */,
    62676275                                1AB1F7881D1B3355007C9BD1 /* WebPaymentCoordinatorProxy.cpp */,
    62686276                                1AB1F7891D1B3355007C9BD1 /* WebPaymentCoordinatorProxy.h */,
  • trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp

    r254015 r260717  
    2929#if ENABLE(APPLE_PAY)
    3030
     31#include "ApplePayPaymentSetupFeatures.h"
    3132#include "DataReference.h"
     33#include "PaymentSetupConfiguration.h"
    3234#include "WebCoreArgumentCoders.h"
    3335#include "WebPage.h"
     
    221223#endif
    222224
    223 }
    224 
    225 #endif
     225#if ENABLE(APPLE_PAY_SETUP)
     226
     227void WebPaymentCoordinator::getSetupFeatures(const WebCore::ApplePaySetup::Configuration& configuration, const URL& url, CompletionHandler<void(Vector<Ref<WebCore::ApplePaySetupFeature>>&&)>&& completionHandler)
     228{
     229    m_webPage.sendWithAsyncReply(Messages::WebPaymentCoordinatorProxy::GetSetupFeatures(PaymentSetupConfiguration { configuration, url }), WTFMove(completionHandler));
     230}
     231
     232void WebPaymentCoordinator::beginApplePaySetup(const WebCore::ApplePaySetup::Configuration& configuration, const URL& url, Vector<RefPtr<WebCore::ApplePaySetupFeature>>&& features, CompletionHandler<void(bool)>&& completionHandler)
     233{
     234    m_webPage.sendWithAsyncReply(Messages::WebPaymentCoordinatorProxy::BeginApplePaySetup(PaymentSetupConfiguration { configuration, url }, PaymentSetupFeatures { WTFMove(features) }), WTFMove(completionHandler));
     235}
     236
     237void WebPaymentCoordinator::endApplePaySetup()
     238{
     239    m_webPage.send(Messages::WebPaymentCoordinatorProxy::EndApplePaySetup());
     240}
     241
     242#endif // ENABLE(APPLE_PAY_SETUP)
     243
     244}
     245
     246#endif
  • trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h

    r254015 r260717  
    8686    String userAgentScriptsBlockedErrorMessage() const final;
    8787
     88#if ENABLE(APPLE_PAY_SETUP)
     89    void getSetupFeatures(const WebCore::ApplePaySetup::Configuration&, const URL&, CompletionHandler<void(Vector<Ref<WebCore::ApplePaySetupFeature>>&&)>&&) final;
     90    void beginApplePaySetup(const WebCore::ApplePaySetup::Configuration&, const URL&, Vector<RefPtr<WebCore::ApplePaySetupFeature>>&&, CompletionHandler<void(bool)>&&) final;
     91    void endApplePaySetup() final;
     92#endif
     93
    8894    // IPC::MessageReceiver.
    8995    void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
     
    113119
    114120    Optional<AvailablePaymentNetworksSet> m_availablePaymentNetworks;
    115 
    116 #if USE(APPLE_INTERNAL_SDK)
    117 #import <WebKitAdditions/WebPaymentCoordinatorAdditions.h>
    118 #endif
    119121};
    120122
Note: See TracChangeset for help on using the changeset viewer.