WebKit Bugzilla
Attachment 357834 Details for
Bug 191298
: Payment process stub with feature flag
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch #2
bug-191298-20181220110042.patch (text/plain), 188.48 KB, created by
Zamiul Haque
on 2018-12-20 11:00:45 PST
(
hide
)
Description:
Patch #2
Filename:
MIME Type:
Creator:
Zamiul Haque
Created:
2018-12-20 11:00:45 PST
Size:
188.48 KB
patch
obsolete
>Subversion Revision: 239387 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 3443bb0989ea1fca78387f0490b794d3190d16ab..fd43faaecfcdb622f37e3bc925b994eb73018975 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,12 @@ >+2018-11-14 Zamiul Haque <zhaque@apple.com> >+ >+ Payment process stub with feature flag >+ https://bugs.webkit.org/show_bug.cgi?id=191298 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Configurations/FeatureDefines.xcconfig: >+ > 2018-11-27 Zamiul Haque <zhaque@apple.com> > > Payment process stub with feature flag >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 8a4d6176cc21a0e1630e352fa03556247b0d2d10..db7e60472185200dbe0f4e2cb5e92521aacc9960 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2018-12-20 Zamiul Haque <zhaque@apple.com> >+ >+ Payment process stub with feature flag >+ https://bugs.webkit.org/show_bug.cgi?id=191298 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebCore.xcodeproj/project.pbxproj: >+ >+2018-11-14 Zamiul Haque <zhaque@apple.com> >+ >+ Payment process stub with feature flag >+ https://bugs.webkit.org/show_bug.cgi?id=191298 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Configurations/FeatureDefines.xcconfig: >+ * en.lproj/Localizable.strings: >+ > 2018-11-27 Zamiul Haque <zhaque@apple.com> > > Payment process stub with feature flag >diff --git a/Source/WebCore/PAL/ChangeLog b/Source/WebCore/PAL/ChangeLog >index 8234ca6707ce0bcfdae52006e41edf586d402e22..76d50f471e6ac769f208755be017da506d06ee7d 100644 >--- a/Source/WebCore/PAL/ChangeLog >+++ b/Source/WebCore/PAL/ChangeLog >@@ -1,3 +1,23 @@ >+2018-12-20 Zamiul Haque <zhaque@apple.com> >+ >+ Payment process stub with feature flag >+ https://bugs.webkit.org/show_bug.cgi?id=191298 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * pal/cocoa/PassKitSoftLink.h: >+ * pal/cocoa/PassKitSoftLink.mm: >+ * pal/spi/cocoa/PassKitSPI.h: >+ >+2018-11-14 Zamiul Haque <zhaque@apple.com> >+ >+ Payment process stub with feature flag >+ https://bugs.webkit.org/show_bug.cgi?id=191298 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Configurations/FeatureDefines.xcconfig: >+ > 2018-11-27 Zamiul Haque <zhaque@apple.com> > > Payment process stub with feature flag >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 2d8f5278ee9f236460a0ce3ae83b6c3a1ba67008..7002b98434ac8205116b7556cd1f780667e14bbc 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,93 @@ >+2018-12-20 Zamiul Haque <zhaque@apple.com> >+ >+ Payment process stub with feature flag >+ https://bugs.webkit.org/show_bug.cgi?id=191298 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Configurations/PaymentService.xcconfig: >+ * DerivedSources.make: >+ * PaymentProcess/PaymentProcess.cpp: >+ (WebKit::PaymentProcess::PaymentProcess): >+ (WebKit::PaymentProcess::didReceiveSyncMessage): >+ (WebKit::PaymentProcess::createPaymentToWebProcessConnection): >+ (WebKit::PaymentProcess::destroySession): >+ * PaymentProcess/PaymentProcess.h: >+ * PaymentProcess/PaymentProcess.messages.in: >+ * PaymentProcess/PaymentProcessCoordinatorProxyCocoa.h: >+ * PaymentProcess/PaymentProcessCoordinatorProxyCocoa.mm: >+ (-[WKPaymentAuthorizationControllerDelegate initWithPaymentCoordinatorProxy:]): >+ (-[WKPaymentAuthorizationControllerDelegate invalidate]): >+ (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didRequestMerchantSession:]): >+ (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didAuthorizePayment:handler:]): >+ (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectPaymentMethod:handler:]): >+ (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingMethod:handler:]): >+ (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingContact:handler:]): >+ (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didAuthorizePayment:completion:]): >+ (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingMethod:completion:]): >+ (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectPaymentMethod:completion:]): >+ (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingContact:completion:]): >+ (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationControllerDidFinish:]): >+ (WebKit::toPKShippingMethod): >+ (WebKit::toPKPaymentRequest): >+ * PaymentProcess/PaymentToWebProcessConnection.cpp: >+ (WebKit::PaymentToWebProcessConnection::PaymentToWebProcessConnection): >+ (WebKit::PaymentToWebProcessConnection::didReceiveMessage): >+ (WebKit::PaymentToWebProcessConnection::didReceiveSyncMessage): >+ (WebKit::PaymentToWebProcessConnection::validateMerchant): >+ (WebKit::PaymentToWebProcessConnection::didAuthorizePayment): >+ (WebKit::PaymentToWebProcessConnection::didSelectShippingMethod): >+ (WebKit::PaymentToWebProcessConnection::didSelectShippingContact): >+ (WebKit::PaymentToWebProcessConnection::didSelectPaymentMethod): >+ (WebKit::PaymentToWebProcessConnection::didCancelPaymentSession): >+ (WebKit::PaymentToWebProcessConnection::canMakePaymentsWithActiveCardReply): >+ (WebKit::PaymentToWebProcessConnection::openPaymentSetupReply): >+ * PaymentProcess/PaymentToWebProcessConnection.h: >+ * Platform/ExtraPrivateSymbolsForTAPI.h: >+ * Sources.txt: >+ * SourcesCocoa.txt: >+ * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: >+ * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: >+ (WebKit::toPKPaymentRequest): >+ * UIProcess/Payments/PaymentProcessProxy.cpp: >+ (WebKit::PaymentProcessProxy::~PaymentProcessProxy): >+ (WebKit::PaymentProcessProxy::getPaymentProcessConnection): >+ (WebKit::PaymentProcessProxy::didClose): >+ (WebKit::PaymentProcessProxy::didCreatePaymentToWebProcessConnection): >+ (WebKit::PaymentProcessProxy::createPaymentToWebProcessConnection): >+ (WebKit::PaymentProcessProxy::didFinishLaunching): >+ * UIProcess/Payments/PaymentProcessProxy.h: >+ * UIProcess/WebProcessPool.cpp: >+ (WebKit::WebProcessPool::~WebProcessPool): >+ (WebKit::WebProcessPool::getPaymentProcessConnection): >+ (WebKit::WebProcessPool::paymentProcessCrashed): >+ (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled): >+ (WebKit::WebProcessPool::initializeNewWebProcess): >+ * UIProcess/WebProcessPool.h: >+ * UIProcess/WebProcessProxy.cpp: >+ (WebKit::WebProcessProxy::getPaymentProcessConnection): >+ * UIProcess/WebProcessProxy.h: >+ * UIProcess/WebProcessProxy.messages.in: >+ * UIProcess/WebsiteData/WebsiteDataStore.cpp: >+ (WebKit::WebsiteDataStore::removePrevalentDomains): >+ * WebKit.xcodeproj/project.pbxproj: >+ * WebProcess/Payments/WebToPaymentProcessConnection.cpp: >+ (WebKit::WebToPaymentProcessConnection::validateMerchant): >+ (WebKit::WebToPaymentProcessConnection::didAuthorizePayment): >+ (WebKit::WebToPaymentProcessConnection::didSelectShippingMethod): >+ (WebKit::WebToPaymentProcessConnection::didSelectShippingContact): >+ (WebKit::WebToPaymentProcessConnection::didSelectPaymentMethod): >+ (WebKit::WebToPaymentProcessConnection::didCancelPaymentSession): >+ (WebKit::WebToPaymentProcessConnection::canMakePaymentsWithActiveCardReply): >+ (WebKit::WebToPaymentProcessConnection::openPaymentSetupReply): >+ * WebProcess/Payments/WebToPaymentProcessConnection.h: >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::m_shouldAttachDrawingAreaOnPageTransition): >+ * WebProcess/WebProcess.cpp: >+ (WebKit::WebProcess::initializeWebProcess): >+ (WebKit::WebProcess::ensureWebToPaymentProcessConnection): >+ * WebProcess/WebProcess.h: >+ > 2018-11-27 Zamiul Haque <zhaque@apple.com> > > Payment process stub with feature flag >diff --git a/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.h b/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.h >index c08748955651d9cc3b7f3153df5529e1633d3ea1..53a372d04044898008304b906cef9b2549373a4e 100644 >--- a/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.h >+++ b/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.h >@@ -36,6 +36,7 @@ SOFT_LINK_CLASS_FOR_HEADER(PAL, PKContact) > SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPassLibrary) > SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPayment) > SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentAuthorizationViewController) >+SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentAuthorizationController) > SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentMethod) > SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentMerchantSession) > SOFT_LINK_CLASS_FOR_HEADER(PAL, PKPaymentRequest) >diff --git a/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.mm b/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.mm >index 32f7be09caac56f0f06f2d8773e77c0b84de8f93..086452babd9837adde19b4f4f8c49e0b02d878b9 100644 >--- a/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.mm >+++ b/Source/WebCore/PAL/pal/cocoa/PassKitSoftLink.mm >@@ -39,6 +39,7 @@ SOFT_LINK_FRAMEWORK_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PAL_EXPORT) > SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKContact, PAL_EXPORT) > SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPassLibrary, PAL_EXPORT) > SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPayment, PAL_EXPORT) >+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentAuthorizationController, PAL_EXPORT) > SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentAuthorizationViewController, PAL_EXPORT) > SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentMerchantSession, PAL_EXPORT) > SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, PassKit, PKPaymentMethod, PAL_EXPORT) >diff --git a/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h b/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h >index 18958e92614c1e3b6a4f04a68ad1433ab1971817..8b8baea6971c9863139e2a5129660b5ee06363af 100644 >--- a/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h >+++ b/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h >@@ -40,6 +40,7 @@ WTF_EXTERN_C_END > #if USE(APPLE_INTERNAL_SDK) > > #import <PassKit/PassKit.h> >+#import <PassKit/PKPaymentAuthorizationController_Private.h> > #import <PassKit/PKPaymentAuthorizationViewController_Private.h> > #import <PassKit/PKPaymentRequest_Private.h> > >diff --git a/Source/WebKit/Configurations/BaseTarget.xcconfig b/Source/WebKit/Configurations/BaseTarget.xcconfig >index 405d63bbb012a39e65da8ba8b8908358a258bd6c..eeb7a26ada1463d2ad5a8dcfdb206a4d63cf3e25 100644 >--- a/Source/WebKit/Configurations/BaseTarget.xcconfig >+++ b/Source/WebKit/Configurations/BaseTarget.xcconfig >@@ -111,6 +111,8 @@ WK_HAVE_CORE_PREDICTION[sdk=macosx*][arch=i386] = NO; > WK_CORE_PREDICTION_DEFINES = $(WK_CORE_PREDICTION_DEFINES_$(WK_HAVE_CORE_PREDICTION)); > WK_CORE_PREDICTION_DEFINES_YES = HAVE_CORE_PREDICTION; > >+WK_PAYMENT_SERVICE_PRODUCT_NAME = com.apple.WebKit.Payments; >+ > WK_STORAGE_SERVICE_PRODUCT_NAME = $(WK_STORAGE_SERVICE_PRODUCT_NAME_$(WK_USE_LEGACY_STORAGE_SERVICE_NAME)); > WK_STORAGE_SERVICE_PRODUCT_NAME_ = $(WK_STORAGE_SERVICE_PRODUCT_NAME_NO); > WK_STORAGE_SERVICE_PRODUCT_NAME_NO = com.apple.WebKit.Storage; >diff --git a/Source/WebKit/Configurations/PaymentService.xcconfig b/Source/WebKit/Configurations/PaymentService.xcconfig >index 74d3888c8df0bdabd3a32714e610cb2efe57438d..acb5c3d8bbf6e16332cb8a2660510feb41573657 100644 >--- a/Source/WebKit/Configurations/PaymentService.xcconfig >+++ b/Source/WebKit/Configurations/PaymentService.xcconfig >@@ -25,9 +25,14 @@ > > WK_PAYMENT_ENTITLEMENTS_RESTRICTED_NO = ; > >+WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE = $(WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_$(WK_PLATFORM_NAME)); >+WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_iphoneos = Payments-iOS; >+WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_iphonesimulator = Payments-iOS; >+ >+CODE_SIGN_ENTITLEMENTS_COCOA_TOUCH_NO = $(WK_PAYMENT_ENTITLEMENTS_RESTRICTED_$(WK_USE_RESTRICTED_ENTITLEMENTS)); > CODE_SIGN_ENTITLEMENTS_COCOA_TOUCH_NO = $(WK_PAYMENT_ENTITLEMENTS_RESTRICTED_$(WK_USE_RESTRICTED_ENTITLEMENTS)); > OTHER_CODE_SIGN_FLAGS = $(WK_LIBRARY_VALIDATION_CODE_SIGN_FLAGS); > >-PRODUCT_NAME = $(WK_PAYMENT_SERVICE_PRODUCT_NAME); >+PRODUCT_NAME = com.apple.WebKit.Payments; > PRODUCT_BUNDLE_IDENTIFIER = $(PRODUCT_NAME); > INFOPLIST_FILE[sdk=iphone*] = PaymentProcess/EntryPoint/ios/XPCService/PaymentService/Info-iOS.plist; >diff --git a/Source/WebKit/Configurations/Payments-iOS-minimalsimulator.entitlements b/Source/WebKit/Configurations/Payments-iOS-minimalsimulator.entitlements >new file mode 100644 >index 0000000000000000000000000000000000000000..2d7aa325e8989090e7d942e4f0aead288c3e6c3f >--- /dev/null >+++ b/Source/WebKit/Configurations/Payments-iOS-minimalsimulator.entitlements >@@ -0,0 +1,10 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> >+<plist version="1.0"> >+<dict> >+ <key>seatbelt-profiles</key> >+ <array> >+ <string>com.apple.WebKit.Payments</string> >+ </array> >+</dict> >+</plist> >diff --git a/Source/WebKit/Configurations/Payments-iOS.entitlements b/Source/WebKit/Configurations/Payments-iOS.entitlements >new file mode 100644 >index 0000000000000000000000000000000000000000..0ea40bbdc68b26f04c44a19dac8a15c3d5fcad52 >--- /dev/null >+++ b/Source/WebKit/Configurations/Payments-iOS.entitlements >@@ -0,0 +1,14 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> >+<plist version="1.0"> >+<dict> >+ <key>com.apple.payment.all-access</key> >+ <true/> >+ <key>com.apple.private.in-app-payments</key> >+ <true/> >+ <key>seatbelt-profiles</key> >+ <array> >+ <string>com.apple.WebKit.Payments</string> >+ </array> >+</dict> >+</plist> >diff --git a/Source/WebKit/DerivedSources.make b/Source/WebKit/DerivedSources.make >index 8605e7b6ccadedab9c8d77ea7da0782d3e534838..920c089ab9e4056404d3ea1ec6a839863f23eea3 100644 >--- a/Source/WebKit/DerivedSources.make >+++ b/Source/WebKit/DerivedSources.make >@@ -52,6 +52,7 @@ VPATH = \ > $(WebKit2)/WebProcess/Network/webrtc \ > $(WebKit2)/WebProcess/Notifications \ > $(WebKit2)/WebProcess/OriginData \ >+ $(WebKit2)/WebProcess/Payments \ > $(WebKit2)/WebProcess/Plugins \ > $(WebKit2)/WebProcess/ResourceCache \ > $(WebKit2)/WebProcess/Storage \ >@@ -122,6 +123,8 @@ MESSAGE_RECEIVERS = \ > PlaybackSessionManagerProxy \ > PaymentProcess \ > PaymentProcessProxy \ >+ PaymentProcessCoordinator \ >+ PaymentProcessCoordinatorProxy \ > PaymentToWebProcessConnection \ > PluginControllerProxy \ > PluginProcess \ >@@ -187,6 +190,7 @@ MESSAGE_RECEIVERS = \ > WebSWServerConnection \ > WebSWServerToContextConnection \ > WebSocketStream \ >+ WebToPaymentProcessConnection \ > WebUserContentController \ > WebUserContentControllerProxy \ > # >diff --git a/Source/WebKit/PaymentProcess/PaymentProcess.cpp b/Source/WebKit/PaymentProcess/PaymentProcess.cpp >index 32a34121029852973c68518ba0cb56ae4cbdf1cf..5b8c6fbff4721df77be12a998e6ff86c7e28d36b 100644 >--- a/Source/WebKit/PaymentProcess/PaymentProcess.cpp >+++ b/Source/WebKit/PaymentProcess/PaymentProcess.cpp >@@ -28,6 +28,16 @@ > > #if ENABLE(PAYMENT_PROCESS) > >+#include "ChildProcessMessages.h" >+#include "Logging.h" >+#include "PaymentProcessCoordinatorProxy.h" >+#include "PaymentProcessCoordinatorProxyMessages.h" >+#include "PaymentProcessMessages.h" >+#include "PaymentProcessProxyMessages.h" >+#include "PaymentToWebProcessConnection.h" >+#include <WebCore/NotImplemented.h> >+#include <wtf/Ref.h> >+ > using namespace WebCore; > > namespace WebKit { >@@ -39,6 +49,8 @@ PaymentProcess& PaymentProcess::singleton() > } > > PaymentProcess::PaymentProcess() >+ : m_paymentCoordinator(std::make_unique<PaymentProcessCoordinatorProxy>(*this)) >+ , m_connection(nullptr) > { > } > >@@ -55,14 +67,11 @@ bool PaymentProcess::shouldTerminate() > { > return true; > } >- >-void PaymentProcess::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder) >+ >+void PaymentProcess::didReceiveSyncMessage(IPC::Connection& connection, IPC::Decoder& decoder, std::unique_ptr<IPC::Encoder>& replyEncoder) > { >- if (messageReceiverMap().dispatchMessage(connection, decoder)) >- return; >- >- if (decoder.messageReceiverName() == Messages::PaymentProcess::messageReceiverName()) { >- didReceivePaymentProcessMessage(connection, decoder); >+ if (decoder.messageReceiverName() == Messages::PaymentProcessCoordinatorProxy::messageReceiverName()) { >+ m_paymentCoordinator->didReceiveSyncMessage(connection, decoder, replyEncoder); > return; > } > >@@ -70,11 +79,33 @@ void PaymentProcess::didReceiveMessage(IPC::Connection& connection, IPC::Decoder > ChildProcess::didReceiveMessage(connection, decoder); > return; > } >-} > >-void PaymentProcess::createPaymentToWebProcessConnection(bool isServiceWorkerProcess, WebCore::SecurityOriginData&& securityOrigin) >+} >+ >+void PaymentProcess::createPaymentToWebProcessConnection() >+{ >+ // Create the listening port. >+ mach_port_t listeningPort = MACH_PORT_NULL; >+ auto kr = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort); >+ if (kr != KERN_SUCCESS) { >+ RELEASE_LOG_ERROR(Process, "PaymentProcess::createPaymentToWebProcessConnection: Could not allocate mach port, error %x", kr); >+ CRASH(); >+ } >+ if (!MACH_PORT_VALID(listeningPort)) { >+ RELEASE_LOG_ERROR(Process, "PaymentProcess::createPaymentToWebProcessConnection: Could not allocate mach port, returned port was invalid"); >+ CRASH(); >+ } >+ >+ // Create a listening connection. >+ m_connection = PaymentToWebProcessConnection::create(IPC::Connection::Identifier(listeningPort)); >+ >+ IPC::Attachment clientPort(listeningPort, MACH_MSG_TYPE_MAKE_SEND); >+ parentProcessConnection()->send(Messages::PaymentProcessProxy::DidCreatePaymentToWebProcessConnection(clientPort), 0); >+} >+ >+void PaymentProcess::destroySession() > { >- notImplemented(); >+ // TODO: delete coordinator proxy > } > > } // namespace WebKit >diff --git a/Source/WebKit/PaymentProcess/PaymentProcess.h b/Source/WebKit/PaymentProcess/PaymentProcess.h >index 2f6de47e001740715dc6767ce610f476127ea5b6..42eeefa114ced0b5d66b021c4283abc9b9aaa824 100644 >--- a/Source/WebKit/PaymentProcess/PaymentProcess.h >+++ b/Source/WebKit/PaymentProcess/PaymentProcess.h >@@ -36,6 +36,7 @@ > namespace WebKit { > > class PaymentToWebProcessConnection; >+class PaymentProcessCoordinatorProxy; > > class PaymentProcess : public ChildProcess { > WTF_MAKE_NONCOPYABLE(PaymentProcess); >@@ -46,8 +47,16 @@ public: > > ~PaymentProcess(); > >- void didReceivePaymentProcessMessage(IPC::Connection&, IPC::Decoder&); >+ void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; >+ void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override; >+ >+ void initializeProcess(const ChildProcessInitializationParameters&) override; >+ void initializeProcessName(const ChildProcessInitializationParameters&) override; >+ void initializeSandbox(const ChildProcessInitializationParameters&, SandboxInitializationParameters&) override; > >+ std::unique_ptr<PaymentProcessCoordinatorProxy> m_paymentCoordinator; >+ RefPtr<PaymentToWebProcessConnection> m_connection; >+ > private: > PaymentProcess(); > >@@ -55,11 +64,10 @@ private: > void initializeConnection(IPC::Connection*) override; > bool shouldTerminate() override; > >- // IPC::Connection::Client >- void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; >- > // Message Handlers >- void createPaymentToWebProcessConnection(bool isServiceWorkerProcess, WebCore::SecurityOriginData&&); >+ void createPaymentToWebProcessConnection(); >+ void destroySession(); >+ > > }; > >diff --git a/Source/WebKit/PaymentProcess/PaymentProcess.messages.in b/Source/WebKit/PaymentProcess/PaymentProcess.messages.in >index 98b914fc4a8f44718cfa12576d338dae592aa0e3..694e6e63d3c18f560d1c8b4b7eaccb8e9f8cba2d 100644 >--- a/Source/WebKit/PaymentProcess/PaymentProcess.messages.in >+++ b/Source/WebKit/PaymentProcess/PaymentProcess.messages.in >@@ -24,5 +24,7 @@ > > messages -> PaymentProcess { > >+ CreatePaymentToWebProcessConnection() >+ DestroySession() > } > #endif // ENABLE(PAYMENT_PROCESS) >diff --git a/Source/WebKit/PaymentProcess/PaymentProcessCoordinatorProxy.cpp b/Source/WebKit/PaymentProcess/PaymentProcessCoordinatorProxy.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..b93b30b7e0c5823291fc6f2c6232700c73b6096f >--- /dev/null >+++ b/Source/WebKit/PaymentProcess/PaymentProcessCoordinatorProxy.cpp >@@ -0,0 +1,343 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "PaymentProcessCoordinatorProxy.h" >+ >+#if ENABLE(APPLE_PAY) && ENABLE(PAYMENT_PROCESS) >+ >+#include "PaymentProcess.h" >+#include "PaymentProcessCoordinatorMessages.h" >+#include "PaymentProcessCoordinatorProxyMessages.h" >+#include "WebCoreArgumentCoders.h" >+#include "WebToPaymentProcessConnectionMessages.h" >+ >+#include <WebCore/PaymentAuthorizationStatus.h> >+ >+namespace WebKit { >+ >+static PaymentProcessCoordinatorProxy* activePaymentCoordinatorProxy; >+ >+PaymentProcessCoordinatorProxy::PaymentProcessCoordinatorProxy(PaymentProcess& paymentProcess) >+ : m_paymentProcess(paymentProcess) >+ , m_state(State::Idle) >+ , m_merchantValidationState(MerchantValidationState::Idle) >+{ >+ m_paymentProcess.addMessageReceiver(Messages::PaymentProcessCoordinatorProxy::messageReceiverName(), *this); >+} >+ >+PaymentProcessCoordinatorProxy::~PaymentProcessCoordinatorProxy() >+{ >+ if (activePaymentCoordinatorProxy == this) >+ activePaymentCoordinatorProxy = nullptr; >+ >+ if (m_state != State::Idle) >+ hidePaymentUI(); >+ >+ m_paymentProcess.removeMessageReceiver(Messages::PaymentProcessCoordinatorProxy::messageReceiverName()); >+} >+ >+void PaymentProcessCoordinatorProxy::availablePaymentNetworks(Vector<String>& networks) >+{ >+ networks = platformAvailablePaymentNetworks(); >+} >+ >+void PaymentProcessCoordinatorProxy::canMakePayments(bool& reply) >+{ >+ reply = platformCanMakePayments(); >+} >+ >+void PaymentProcessCoordinatorProxy::canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, uint64_t requestID) >+{ >+ auto weakThis = makeWeakPtr(*this); >+ platformCanMakePaymentsWithActiveCard(merchantIdentifier, domainName, [weakThis, requestID](bool canMakePayments) { >+ auto paymentCoordinatorProxy = weakThis.get(); >+ if (!paymentCoordinatorProxy) >+ return; >+ >+ paymentCoordinatorProxy->m_paymentProcess.m_connection->canMakePaymentsWithActiveCardReply(requestID, canMakePayments); >+ }); >+} >+ >+void PaymentProcessCoordinatorProxy::openPaymentSetup(const String& merchantIdentifier, const String& domainName, uint64_t requestID) >+{ >+ auto weakThis = makeWeakPtr(*this); >+ platformOpenPaymentSetup(merchantIdentifier, domainName, [weakThis, requestID](bool result) { >+ auto paymentCoordinatorProxy = weakThis.get(); >+ if (!paymentCoordinatorProxy) >+ return; >+ >+ paymentCoordinatorProxy->m_paymentProcess.m_connection->openPaymentSetupReply(requestID, result); >+ }); >+} >+ >+void PaymentProcessCoordinatorProxy::showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest& paymentRequest, bool& result) >+{ >+ // FIXME: Make this a message check. >+ ASSERT(canBegin()); >+ >+ if (activePaymentCoordinatorProxy) { >+ activePaymentCoordinatorProxy->hidePaymentUI(); >+ activePaymentCoordinatorProxy->didCancelPaymentSession(); >+ } >+ >+ activePaymentCoordinatorProxy = this; >+ >+ m_state = State::Activating; >+ >+ WebCore::URL originatingURL(WebCore::URL(), originatingURLString); >+ >+ Vector<WebCore::URL> linkIconURLs; >+ for (const auto& linkIconURLString : linkIconURLStrings) >+ linkIconURLs.append(WebCore::URL(WebCore::URL(), linkIconURLString)); >+ >+ platformShowPaymentUI(originatingURL, linkIconURLs, paymentRequest, [this](bool result) { >+ ASSERT(m_state == State::Activating); >+ if (!result) { >+ didCancelPaymentSession(); >+ return; >+ } >+ >+ m_state = State::Active; >+ }); >+ >+ result = true; >+} >+ >+void PaymentProcessCoordinatorProxy::completeMerchantValidation(const WebCore::PaymentMerchantSession& paymentMerchantSession) >+{ >+ // It's possible that the payment has been canceled already. >+ if (m_state == State::Idle) >+ return; >+ >+ // FIXME: This should be a MESSAGE_CHECK. >+ ASSERT(m_merchantValidationState == MerchantValidationState::Validating); >+ >+ platformCompleteMerchantValidation(paymentMerchantSession); >+ m_merchantValidationState = MerchantValidationState::ValidationComplete; >+} >+ >+void PaymentProcessCoordinatorProxy::completeShippingMethodSelection(const std::optional<WebCore::ShippingMethodUpdate>& update) >+{ >+ // It's possible that the payment has been canceled already. >+ if (m_state == State::Idle) >+ return; >+ >+ // FIXME: This should be a MESSAGE_CHECK. >+ ASSERT(m_state == State::ShippingMethodSelected); >+ >+ platformCompleteShippingMethodSelection(update); >+ m_state = State::Active; >+} >+ >+void PaymentProcessCoordinatorProxy::completeShippingContactSelection(const std::optional<WebCore::ShippingContactUpdate>& update) >+{ >+ // It's possible that the payment has been canceled already. >+ if (m_state == State::Idle) >+ return; >+ >+ // FIXME: This should be a MESSAGE_CHECK. >+ ASSERT(m_state == State::ShippingContactSelected); >+ >+ platformCompleteShippingContactSelection(update); >+ m_state = State::Active; >+} >+ >+void PaymentProcessCoordinatorProxy::completePaymentMethodSelection(const std::optional<WebCore::PaymentMethodUpdate>& update) >+{ >+ // It's possible that the payment has been canceled already. >+ if (m_state == State::Idle) >+ return; >+ >+ // FIXME: This should be a MESSAGE_CHECK. >+ ASSERT(m_state == State::PaymentMethodSelected); >+ >+ platformCompletePaymentMethodSelection(update); >+ m_state = State::Active; >+} >+ >+void PaymentProcessCoordinatorProxy::completePaymentSession(const std::optional<WebCore::PaymentAuthorizationResult>& result) >+{ >+ // It's possible that the payment has been canceled already. >+ if (!canCompletePayment()) >+ return; >+ >+ bool isFinalStateResult = WebCore::isFinalStateResult(result); >+ >+ platformCompletePaymentSession(result); >+ >+ if (!isFinalStateResult) { >+ m_state = State::Active; >+ return; >+ } >+ >+ didReachFinalState(); >+} >+ >+void PaymentProcessCoordinatorProxy::abortPaymentSession() >+{ >+ // It's possible that the payment has been canceled already. >+ if (!canAbort()) >+ return; >+ >+ hidePaymentUI(); >+ >+ didReachFinalState(); >+} >+ >+void PaymentProcessCoordinatorProxy::cancelPaymentSession() >+{ >+ if (!canCancel()) >+ return; >+ >+ hidePaymentUI(); >+ didCancelPaymentSession(); >+} >+ >+void PaymentProcessCoordinatorProxy::didCancelPaymentSession() >+{ >+ ASSERT(canCancel()); >+ >+ m_paymentProcess.m_connection->didCancelPaymentSession(); >+ >+ didReachFinalState(); >+} >+ >+void PaymentProcessCoordinatorProxy::validateMerchant(const WebCore::URL& url) >+{ >+ ASSERT(m_merchantValidationState == MerchantValidationState::Idle); >+ >+ m_merchantValidationState = MerchantValidationState::Validating; >+ m_paymentProcess.m_connection->validateMerchant(url.string()); >+} >+ >+void PaymentProcessCoordinatorProxy::didAuthorizePayment(const WebCore::Payment& payment) >+{ >+ m_state = State::Authorized; >+ m_paymentProcess.m_connection->didAuthorizePayment(payment); >+ >+} >+ >+void PaymentProcessCoordinatorProxy::didSelectShippingMethod(const WebCore::ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod) >+{ >+ ASSERT(m_state == State::Active); >+ >+ m_state = State::ShippingMethodSelected; >+ m_paymentProcess.m_connection->didSelectShippingMethod(shippingMethod); >+} >+ >+void PaymentProcessCoordinatorProxy::didSelectShippingContact(const WebCore::PaymentContact& shippingContact) >+{ >+ ASSERT(m_state == State::Active); >+ >+ m_state = State::ShippingContactSelected; >+ m_paymentProcess.m_connection->didSelectShippingContact(shippingContact); >+} >+ >+void PaymentProcessCoordinatorProxy::didSelectPaymentMethod(const WebCore::PaymentMethod& paymentMethod) >+{ >+ ASSERT(m_state == State::Active); >+ >+ m_state = State::PaymentMethodSelected; >+ m_paymentProcess.m_connection->didSelectPaymentMethod(paymentMethod); >+ >+} >+ >+bool PaymentProcessCoordinatorProxy::canBegin() const >+{ >+ switch (m_state) { >+ case State::Idle: >+ return true; >+ >+ case State::Activating: >+ case State::Active: >+ case State::Authorized: >+ case State::ShippingMethodSelected: >+ case State::ShippingContactSelected: >+ case State::PaymentMethodSelected: >+ return false; >+ } >+} >+ >+bool PaymentProcessCoordinatorProxy::canCancel() const >+{ >+ switch (m_state) { >+ case State::Activating: >+ case State::Active: >+ case State::Authorized: >+ case State::ShippingMethodSelected: >+ case State::ShippingContactSelected: >+ case State::PaymentMethodSelected: >+ return true; >+ >+ case State::Idle: >+ return false; >+ } >+} >+ >+bool PaymentProcessCoordinatorProxy::canCompletePayment() const >+{ >+ switch (m_state) { >+ case State::Authorized: >+ return true; >+ >+ case State::Idle: >+ case State::Activating: >+ case State::Active: >+ case State::ShippingMethodSelected: >+ case State::ShippingContactSelected: >+ case State::PaymentMethodSelected: >+ return false; >+ } >+} >+ >+bool PaymentProcessCoordinatorProxy::canAbort() const >+{ >+ switch (m_state) { >+ case State::Activating: >+ case State::Active: >+ case State::Authorized: >+ case State::ShippingMethodSelected: >+ case State::ShippingContactSelected: >+ case State::PaymentMethodSelected: >+ return true; >+ >+ case State::Idle: >+ return false; >+ } >+} >+ >+void PaymentProcessCoordinatorProxy::didReachFinalState() >+{ >+ m_state = State::Idle; >+ m_merchantValidationState = MerchantValidationState::Idle; >+ >+ ASSERT(activePaymentCoordinatorProxy == this); >+ activePaymentCoordinatorProxy = nullptr; >+} >+ >+} >+ >+#endif >diff --git a/Source/WebKit/PaymentProcess/PaymentProcessCoordinatorProxy.h b/Source/WebKit/PaymentProcess/PaymentProcessCoordinatorProxy.h >new file mode 100644 >index 0000000000000000000000000000000000000000..0237f6483c992ce6d826635b0421dc11bd442860 >--- /dev/null >+++ b/Source/WebKit/PaymentProcess/PaymentProcessCoordinatorProxy.h >@@ -0,0 +1,159 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(APPLE_PAY) && ENABLE(PAYMENT_PROCESS) >+ >+#include "MessageReceiver.h" >+#include <WebCore/PaymentHeaders.h> >+#include <wtf/Forward.h> >+#include <wtf/RetainPtr.h> >+#include <wtf/WeakPtr.h> >+ >+namespace IPC { >+class DataReference; >+} >+ >+namespace WebCore { >+enum class PaymentAuthorizationStatus; >+class Payment; >+class PaymentContact; >+class PaymentMerchantSession; >+class PaymentMethod; >+class URL; >+} >+ >+OBJC_CLASS NSObject; >+OBJC_CLASS NSWindow; >+OBJC_CLASS PKPaymentAuthorizationController; >+OBJC_CLASS WKPaymentAuthorizationControllerDelegate; >+ >+namespace WebKit { >+ >+class WebPageProxy; >+class PaymentProcess; >+ >+class PaymentProcessCoordinatorProxy : private IPC::MessageReceiver, public CanMakeWeakPtr<PaymentProcessCoordinatorProxy> { >+public: >+ explicit PaymentProcessCoordinatorProxy(PaymentProcess&); >+ ~PaymentProcessCoordinatorProxy(); >+ >+ void didCancelPaymentSession(); >+ void validateMerchant(const WebCore::URL&); >+ void didAuthorizePayment(const WebCore::Payment&); >+ void didSelectShippingMethod(const WebCore::ApplePaySessionPaymentRequest::ShippingMethod&); >+ void didSelectShippingContact(const WebCore::PaymentContact&); >+ void didSelectPaymentMethod(const WebCore::PaymentMethod&); >+ >+ void hidePaymentUI(); >+ >+ void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override; >+ >+private: >+ // IPC::MessageReceiver. >+ void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; >+ >+ // Message handlers. >+ void availablePaymentNetworks(Vector<String>&); >+ void canMakePayments(bool& reply); >+ void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, uint64_t requestID); >+ void openPaymentSetup(const String& merchantIdentifier, const String& domainName, uint64_t requestID); >+ void showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest&, bool& result); >+ void completeMerchantValidation(const WebCore::PaymentMerchantSession&); >+ void completeShippingMethodSelection(const std::optional<WebCore::ShippingMethodUpdate>&); >+ void completeShippingContactSelection(const std::optional<WebCore::ShippingContactUpdate>&); >+ void completePaymentMethodSelection(const std::optional<WebCore::PaymentMethodUpdate>&); >+ void completePaymentSession(const std::optional<WebCore::PaymentAuthorizationResult>&); >+ void abortPaymentSession(); >+ void cancelPaymentSession(); >+ >+ bool canBegin() const; >+ bool canCancel() const; >+ bool canCompletePayment() const; >+ bool canAbort() const; >+ >+ void didReachFinalState(); >+ >+ Vector<String> platformAvailablePaymentNetworks(); >+ bool platformCanMakePayments(); >+ void platformCanMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void(bool)>&& completionHandler); >+ void platformOpenPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void(bool)>&& completionHandler); >+ void platformShowPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&, WTF::Function<void(bool)>&& completionHandler); >+ void platformCompleteMerchantValidation(const WebCore::PaymentMerchantSession&); >+ void platformCompleteShippingMethodSelection(const std::optional<WebCore::ShippingMethodUpdate>&); >+ void platformCompleteShippingContactSelection(const std::optional<WebCore::ShippingContactUpdate>&); >+ void platformCompletePaymentMethodSelection(const std::optional<WebCore::PaymentMethodUpdate>&); >+ void platformCompletePaymentSession(const std::optional<WebCore::PaymentAuthorizationResult>&); >+ >+ PaymentProcess& m_paymentProcess; >+ >+ enum class State { >+ // Idle - Nothing's happening. >+ Idle, >+ >+ // Activating - Waiting to show the payment UI. >+ Activating, >+ >+ // Active - Showing payment UI. >+ Active, >+ >+ // Authorized - Dispatching the authorized event and waiting for the paymentSessionCompleted message. >+ Authorized, >+ >+ // ShippingMethodSelected - Dispatching the shippingmethodselected event and waiting for a reply. >+ ShippingMethodSelected, >+ >+ // ShippingContactSelected - Dispatching the shippingcontactselected event and waiting for a reply. >+ ShippingContactSelected, >+ >+ // PaymentMethodSelected - Dispatching the paymentmethodselected event and waiting for a reply. >+ PaymentMethodSelected, >+ } m_state; >+ >+ enum class MerchantValidationState { >+ // Idle - Nothing's happening. >+ Idle, >+ >+ // Validating - Dispatching the validatemerchant event and waiting for a reply. >+ Validating, >+ >+ // ValidationComplete - A merchant session has been sent along to PassKit. >+ ValidationComplete >+ } m_merchantValidationState; >+ >+ RetainPtr<PKPaymentAuthorizationController> m_paymentAuthorizationController; >+ RetainPtr<WKPaymentAuthorizationControllerDelegate> m_paymentAuthorizationControllerDelegate; >+ >+#if PLATFORM(MAC) >+ uint64_t m_showPaymentUIRequestSeed { 0 }; >+ RetainPtr<NSWindow> m_sheetWindow; >+ RetainPtr<NSObject *> m_sheetWindowWillCloseObserver; >+#endif >+}; >+ >+} >+ >+#endif >diff --git a/Source/WebKit/PaymentProcess/PaymentProcessCoordinatorProxy.messages.in b/Source/WebKit/PaymentProcess/PaymentProcessCoordinatorProxy.messages.in >new file mode 100644 >index 0000000000000000000000000000000000000000..0a75acdd290759c0a4d45cdda773bde86b3faac2 >--- /dev/null >+++ b/Source/WebKit/PaymentProcess/PaymentProcessCoordinatorProxy.messages.in >@@ -0,0 +1,45 @@ >+/* >+* Copyright (C) 2018 Apple Inc. All rights reserved. >+* >+* Redistribution and use in source and binary forms, with or without >+* modification, are permitted provided that the following conditions >+* are met: >+* 1. Redistributions of source code must retain the above copyright >+* notice, this list of conditions and the following disclaimer. >+* 2. Redistributions in binary form must reproduce the above copyright >+* notice, this list of conditions and the following disclaimer in the >+* documentation and/or other materials provided with the distribution. >+* >+* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+* THE POSSIBILITY OF SUCH DAMAGE. >+*/ >+ >+#if ENABLE(APPLE_PAY) && ENABLE(PAYMENT_PROCESS) >+ >+messages -> PaymentProcessCoordinatorProxy { >+ >+ AvailablePaymentNetworks() -> (Vector<String> availablePaymentNetworks) LegacySync >+ CanMakePayments() -> (bool result) LegacySync >+ CanMakePaymentsWithActiveCard(String merchantIdentifier, String domainName, uint64_t requestID) >+ OpenPaymentSetup(String merchantIdentifier, String domainName, uint64_t requestID) >+ >+ ShowPaymentUI(String originatingURLString, Vector<String> linkIconURLStrings, WebCore::ApplePaySessionPaymentRequest paymentRequest) -> (bool result) LegacySync >+ CompleteMerchantValidation(WebCore::PaymentMerchantSession paymentMerchantSession) >+ CompleteShippingMethodSelection(std::optional<WebCore::ShippingMethodUpdate> update) >+ CompleteShippingContactSelection(std::optional<WebCore::ShippingContactUpdate> update) >+ CompletePaymentMethodSelection(std::optional<WebCore::PaymentMethodUpdate> update) >+ CompletePaymentSession(std::optional<WebCore::PaymentAuthorizationResult> result) >+ AbortPaymentSession() >+ CancelPaymentSession() >+} >+ >+#endif >diff --git a/Source/WebKit/PaymentProcess/PaymentProcessCoordinatorProxyCocoa.h b/Source/WebKit/PaymentProcess/PaymentProcessCoordinatorProxyCocoa.h >new file mode 100644 >index 0000000000000000000000000000000000000000..ed707cebfa21748f65429234744e9144bceee027 >--- /dev/null >+++ b/Source/WebKit/PaymentProcess/PaymentProcessCoordinatorProxyCocoa.h >@@ -0,0 +1,75 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(APPLE_PAY) && ENABLE(PAYMENT_PROCESS) >+ >+#import <WebCore/PaymentHeaders.h> >+#import <pal/spi/cocoa/PassKitSPI.h> >+#import <wtf/BlockPtr.h> >+ >+namespace WebCore { >+class URL; >+} >+ >+namespace WebKit { >+class WebPageProxy; >+class PaymentProcessCoordinatorProxy; >+ >+RetainPtr<PKPaymentRequest> toPKPaymentRequest(const URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&); >+ >+} >+ >+@interface WKPaymentAuthorizationControllerDelegate : NSObject <PKPaymentAuthorizationControllerDelegate, >+ PKPaymentAuthorizationControllerPrivateDelegate> { >+@package >+ WebKit::PaymentProcessCoordinatorProxy* _paymentProessCoordinatorProxy; >+ RetainPtr<NSArray> _paymentSummaryItems; >+ RetainPtr<NSArray> _shippingMethods; >+ >+ BlockPtr<void(PKPaymentMerchantSession *, NSError *)> _sessionBlock; >+ >+ BOOL _didReachFinalState; >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) >+ BlockPtr<void(PKPaymentAuthorizationResult *)> _paymentAuthorizedCompletion; >+ BlockPtr<void(PKPaymentRequestPaymentMethodUpdate *)> _didSelectPaymentMethodCompletion; >+ BlockPtr<void(PKPaymentRequestShippingMethodUpdate *)> _didSelectShippingMethodCompletion; >+ BlockPtr<void(PKPaymentRequestShippingContactUpdate *)> _didSelectShippingContactCompletion; >+#else >+ BlockPtr<void(PKPaymentAuthorizationStatus)> _paymentAuthorizedCompletion; >+ BlockPtr<void(NSArray *)> _didSelectPaymentMethodCompletion; >+ BlockPtr<void(PKPaymentAuthorizationStatus, NSArray *)> _didSelectShippingMethodCompletion; >+ BlockPtr<void(PKPaymentAuthorizationStatus, NSArray *, NSArray *)> _didSelectShippingContactCompletion; >+#endif >+} >+ >+- (instancetype)initWithPaymentCoordinatorProxy:(WebKit::PaymentProcessCoordinatorProxy&)webPaymentCoordinatorProxy; >+ >+- (void)invalidate; >+ >+@end >+ >+#endif >diff --git a/Source/WebKit/PaymentProcess/PaymentProcessCoordinatorProxyCocoa.mm b/Source/WebKit/PaymentProcess/PaymentProcessCoordinatorProxyCocoa.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..cad1bd7b2092a5211eda7165c6f4485bfffd0178 >--- /dev/null >+++ b/Source/WebKit/PaymentProcess/PaymentProcessCoordinatorProxyCocoa.mm >@@ -0,0 +1,698 @@ >+/* >+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "PaymentProcessCoordinatorProxyCocoa.h" >+ >+#if ENABLE(APPLE_PAY) && ENABLE(PAYMENT_PROCESS) >+ >+#import "PaymentProcessCoordinatorProxy.h" >+#import "WebProcessPool.h" >+#import <WebCore/PaymentAuthorizationStatus.h> >+#import <WebCore/PaymentHeaders.h> >+#import <WebCore/URL.h> >+#import <pal/cocoa/PassKitSoftLink.h> >+#import <wtf/BlockPtr.h> >+#import <wtf/RunLoop.h> >+ >+#if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300) >+SOFT_LINK_FRAMEWORK(Contacts) >+SOFT_LINK_CONSTANT(Contacts, CNPostalAddressStreetKey, NSString *); >+SOFT_LINK_CONSTANT(Contacts, CNPostalAddressSubLocalityKey, NSString *); >+SOFT_LINK_CONSTANT(Contacts, CNPostalAddressCityKey, NSString *); >+SOFT_LINK_CONSTANT(Contacts, CNPostalAddressSubAdministrativeAreaKey, NSString *); >+SOFT_LINK_CONSTANT(Contacts, CNPostalAddressStateKey, NSString *); >+SOFT_LINK_CONSTANT(Contacts, CNPostalAddressPostalCodeKey, NSString *); >+SOFT_LINK_CONSTANT(Contacts, CNPostalAddressCountryKey, NSString *); >+SOFT_LINK_CONSTANT(Contacts, CNPostalAddressISOCountryCodeKey, NSString *); >+SOFT_LINK_CONSTANT(PAL::PassKit, PKPaymentErrorDomain, NSString *); >+#endif >+ >+@implementation WKPaymentAuthorizationControllerDelegate >+ >+- (instancetype)initWithPaymentCoordinatorProxy:(WebKit::PaymentProcessCoordinatorProxy&)webPaymentCoordinatorProxy >+{ >+ if (!(self = [super init])) >+ return nullptr; >+ >+ _paymentProessCoordinatorProxy = &webPaymentCoordinatorProxy; >+ >+ return self; >+} >+ >+- (void)invalidate >+{ >+ _paymentProessCoordinatorProxy = nullptr; >+ if (_paymentAuthorizedCompletion) { >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) >+ _paymentAuthorizedCompletion(adoptNS([PAL::allocPKPaymentAuthorizationResultInstance() initWithStatus:PKPaymentAuthorizationStatusFailure errors:@[ ]]).get()); >+#else >+ _paymentAuthorizedCompletion(PKPaymentAuthorizationStatusFailure); >+#endif >+ _paymentAuthorizedCompletion = nullptr; >+ } >+} >+ >+- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller willFinishWithError:(NSError *)error >+{ >+} >+ >+- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller didRequestMerchantSession:(void(^)(PKPaymentMerchantSession *, NSError *))sessionBlock >+{ >+ ASSERT(!_sessionBlock); >+ _sessionBlock = sessionBlock; >+ >+ [PAL::getPKPaymentAuthorizationViewControllerClass() paymentServicesMerchantURL:^(NSURL *merchantURL, NSError *error) { >+ if (error) >+ LOG_ERROR("PKCanMakePaymentsWithMerchantIdentifierAndDomain error %@", error); >+ >+ dispatch_async(dispatch_get_main_queue(), ^{ >+ ASSERT(_sessionBlock); >+ >+ if (!_paymentProessCoordinatorProxy) { >+ _sessionBlock(nullptr, nullptr); >+ return; >+ } >+ >+ _paymentProessCoordinatorProxy->validateMerchant(merchantURL); >+ }); >+ }]; >+} >+ >+static WebCore::ApplePaySessionPaymentRequest::ShippingMethod toShippingMethod(PKShippingMethod *shippingMethod) >+{ >+ ASSERT(shippingMethod); >+ >+ WebCore::ApplePaySessionPaymentRequest::ShippingMethod result; >+ result.label = shippingMethod.label; >+ result.detail = shippingMethod.detail; >+ result.amount = shippingMethod.amount.stringValue; >+ result.identifier = shippingMethod.identifier; >+ >+ return result; >+} >+ >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300) || PLATFORM(IOS_FAMILY) >+ >+- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller didAuthorizePayment:(PKPayment *)payment handler:(void (^)(PKPaymentAuthorizationResult *result))completion >+{ >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) >+ if (!_paymentProessCoordinatorProxy) { >+ completion(adoptNS([PAL::allocPKPaymentAuthorizationResultInstance() initWithStatus:PKPaymentAuthorizationStatusFailure errors:@[ ]]).get()); >+ return; >+ } >+ >+ ASSERT(!_paymentAuthorizedCompletion); >+ _paymentAuthorizedCompletion = completion; >+ >+ _paymentProessCoordinatorProxy->didAuthorizePayment(WebCore::Payment(payment)); >+#endif >+} >+ >+- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller didSelectPaymentMethod:(PKPaymentMethod *)paymentMethod handler:(void (^)(PKPaymentRequestPaymentMethodUpdate *update))completion >+{ >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) >+ if (!_paymentProessCoordinatorProxy) { >+ completion(adoptNS([PAL::allocPKPaymentRequestPaymentMethodUpdateInstance() initWithPaymentSummaryItems:@[ ]]).get()); >+ return; >+ } >+ >+ ASSERT(!_didSelectPaymentMethodCompletion); >+ _didSelectPaymentMethodCompletion = completion; >+ _paymentProessCoordinatorProxy->didSelectPaymentMethod(WebCore::PaymentMethod(paymentMethod)); >+#endif >+} >+ >+- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller didSelectShippingMethod:(PKShippingMethod *)shippingMethod handler:(void (^)(PKPaymentRequestShippingMethodUpdate *update))completion { >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) >+ if (!_paymentProessCoordinatorProxy) { >+ completion(adoptNS([PAL::allocPKPaymentRequestShippingMethodUpdateInstance() initWithPaymentSummaryItems:@[ ]]).get()); >+ return; >+ } >+ >+ ASSERT(!_didSelectShippingMethodCompletion); >+ _didSelectShippingMethodCompletion = completion; >+ _paymentProessCoordinatorProxy->didSelectShippingMethod(toShippingMethod(shippingMethod)); >+#endif >+} >+ >+- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller didSelectShippingContact:(PKContact *)contact handler:(void (^)(PKPaymentRequestShippingContactUpdate *update))completion >+{ >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) >+ if (!_paymentProessCoordinatorProxy) { >+ completion(adoptNS([PAL::allocPKPaymentRequestShippingContactUpdateInstance() initWithErrors:@[ ] paymentSummaryItems:@[ ] shippingMethods:@[ ]]).get()); >+ return; >+ } >+ >+ ASSERT(!_didSelectShippingContactCompletion); >+ _didSelectShippingContactCompletion = completion; >+ _paymentProessCoordinatorProxy->didSelectShippingContact(WebCore::PaymentContact(contact)); >+#endif >+} >+ >+#endif >+ >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED < 110000) >+ >+- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller didAuthorizePayment:(PKPayment *)payment completion:(void (^)(PKPaymentAuthorizationStatus))completion >+{ >+ if (!_paymentProessCoordinatorProxy) { >+ completion(PKPaymentAuthorizationStatusFailure); >+ return; >+ } >+ >+ ASSERT(!_paymentAuthorizedCompletion); >+ _paymentAuthorizedCompletion = completion; >+ >+ _paymentProessCoordinatorProxy->didAuthorizePayment(WebCore::Payment(payment)); >+} >+ >+- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller didSelectShippingMethod:(PKShippingMethod *)shippingMethod completion:(void (^)(PKPaymentAuthorizationStatus status, NSArray<PKPaymentSummaryItem *> *summaryItems))completion >+{ >+ if (!_paymentProessCoordinatorProxy) { >+ completion(PKPaymentAuthorizationStatusFailure, @[ ]); >+ return; >+ } >+ >+ ASSERT(!_didSelectShippingMethodCompletion); >+ _didSelectShippingMethodCompletion = completion; >+ _paymentProessCoordinatorProxy->didSelectShippingMethod(toShippingMethod(shippingMethod)); >+} >+ >+- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller didSelectPaymentMethod:(PKPaymentMethod *)paymentMethod completion:(void (^)(NSArray<PKPaymentSummaryItem *> *summaryItems))completion >+{ >+ if (!_paymentProessCoordinatorProxy) { >+ completion(@[ ]); >+ return; >+ } >+ >+ ASSERT(!_didSelectPaymentMethodCompletion); >+ _didSelectPaymentMethodCompletion = completion; >+ >+ _paymentProessCoordinatorProxy->didSelectPaymentMethod(WebCore::PaymentMethod(paymentMethod)); >+} >+ >+- (void)paymentAuthorizationController:(PKPaymentAuthorizationController *)controller didSelectShippingContact:(PKContact *)contact completion:(void (^)(PKPaymentAuthorizationStatus status, NSArray<PKShippingMethod *> *shippingMethods, NSArray<PKPaymentSummaryItem *> *summaryItems))completion >+{ >+ if (!_paymentProessCoordinatorProxy) { >+ completion(PKPaymentAuthorizationStatusFailure, @[ ], @[ ]); >+ return; >+ } >+ >+ ASSERT(!_didSelectShippingContactCompletion); >+ _didSelectShippingContactCompletion = completion; >+ _paymentProessCoordinatorProxy->didSelectShippingContact(WebCore::PaymentContact(contact)); >+} >+ >+#endif >+ >+- (void)paymentAuthorizationControllerDidFinish:(PKPaymentAuthorizationController *)controller >+{ >+ if (!_paymentProessCoordinatorProxy) >+ return; >+ >+ if (!_didReachFinalState) >+ _paymentProessCoordinatorProxy->didCancelPaymentSession(); >+ >+ _paymentProessCoordinatorProxy->hidePaymentUI(); >+} >+ >+@end >+ >+// FIXME: Once rdar://problem/24420024 has been fixed, import PKPaymentRequest_Private.h instead. >+@interface PKPaymentRequest () >+@property (nonatomic, retain) NSURL *originatingURL; >+@end >+ >+@interface PKPaymentRequest () >+// FIXME: Remove this once it's in an SDK. >+@property (nonatomic, strong) NSArray *thumbnailURLs; >+@property (nonatomic, strong) NSURL *thumbnailURL; >+ >+@property (nonatomic, assign) BOOL expectsMerchantSession; >+@end >+ >+namespace WebKit { >+ >+bool PaymentProcessCoordinatorProxy::platformCanMakePayments() >+{ >+ return [PAL::getPKPaymentAuthorizationViewControllerClass() canMakePayments]; >+} >+ >+void PaymentProcessCoordinatorProxy::platformCanMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void(bool)>&& completionHandler) >+{ >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) >+ PKCanMakePaymentsWithMerchantIdentifierDomainAndSourceApplication(merchantIdentifier, domainName, @"", BlockPtr<void(BOOL, NSError *)>::fromCallable([completionHandler = WTFMove(completionHandler)](BOOL canMakePayments, NSError *error) mutable { >+ if (error) >+ LOG_ERROR("PKCanMakePaymentsWithMerchantIdentifierAndDomain error %@", error); >+ >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), canMakePayments] { >+ completionHandler(canMakePayments); >+ }); >+ }).get()); >+#else >+ PKCanMakePaymentsWithMerchantIdentifierAndDomain(merchantIdentifier, domainName, BlockPtr<void(BOOL, NSError *)>::fromCallable([completionHandler = WTFMove(completionHandler)](BOOL canMakePayments, NSError *error) mutable { >+ if (error) >+ LOG_ERROR("PKCanMakePaymentsWithMerchantIdentifierAndDomain error %@", error); >+ >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), canMakePayments] { >+ completionHandler(canMakePayments); >+ }); >+ }).get()); >+#endif >+} >+ >+void PaymentProcessCoordinatorProxy::platformOpenPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void(bool)>&& completionHandler) >+{ >+ auto passLibrary = adoptNS([PAL::allocPKPassLibraryInstance() init]); >+ [passLibrary openPaymentSetupForMerchantIdentifier:merchantIdentifier domain:domainName completion:BlockPtr<void(BOOL)>::fromCallable([completionHandler = WTFMove(completionHandler)](BOOL result) mutable { >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), result] { >+ completionHandler(result); >+ }); >+ }).get()]; >+} >+ >+static PKPaymentSummaryItemType toPKPaymentSummaryItemType(WebCore::ApplePaySessionPaymentRequest::LineItem::Type type) >+{ >+ switch (type) { >+ case WebCore::ApplePaySessionPaymentRequest::LineItem::Type::Final: >+ return PKPaymentSummaryItemTypeFinal; >+ >+ case WebCore::ApplePaySessionPaymentRequest::LineItem::Type::Pending: >+ return PKPaymentSummaryItemTypePending; >+ } >+} >+ >+static NSDecimalNumber *toDecimalNumber(const String& amount) >+{ >+ if (!amount) >+ return [NSDecimalNumber zero]; >+ return [NSDecimalNumber decimalNumberWithString:amount locale:@{ NSLocaleDecimalSeparator : @"." }]; >+} >+ >+static RetainPtr<PKPaymentSummaryItem> toPKPaymentSummaryItem(const WebCore::ApplePaySessionPaymentRequest::LineItem& lineItem) >+{ >+ return [PAL::getPKPaymentSummaryItemClass() summaryItemWithLabel:lineItem.label amount:toDecimalNumber(lineItem.amount) type:toPKPaymentSummaryItemType(lineItem.type)]; >+} >+ >+static RetainPtr<NSArray> toPKPaymentSummaryItems(const WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems& totalAndLineItems) >+{ >+ auto paymentSummaryItems = adoptNS([[NSMutableArray alloc] init]); >+ for (auto& lineItem : totalAndLineItems.lineItems) { >+ if (auto summaryItem = toPKPaymentSummaryItem(lineItem)) >+ [paymentSummaryItems addObject:summaryItem.get()]; >+ } >+ >+ if (auto totalItem = toPKPaymentSummaryItem(totalAndLineItems.total)) >+ [paymentSummaryItems addObject:totalItem.get()]; >+ >+ return paymentSummaryItems; >+} >+ >+static RetainPtr<PKShippingMethod> toPKShippingMethod(const WebCore::ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod) >+{ >+ RetainPtr<PKShippingMethod> result = [PAL::getPKShippingMethodClass() summaryItemWithLabel:shippingMethod.label amount:toDecimalNumber(shippingMethod.amount)]; >+ [result setIdentifier:shippingMethod.identifier]; >+ [result setDetail:shippingMethod.detail]; >+ >+ return result; >+} >+ >+RetainPtr<PKPaymentRequest> toPKPaymentRequest(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest& paymentRequest) >+{ >+ auto result = adoptNS([PAL::allocPKPaymentRequestInstance() init]); >+ >+ [result setOriginatingURL:originatingURL]; >+ >+ if ([result respondsToSelector:@selector(setThumbnailURLs:)]) { >+ auto thumbnailURLs = adoptNS([[NSMutableArray alloc] init]); >+ for (auto& linkIconURL : linkIconURLs) >+ [thumbnailURLs addObject:static_cast<NSURL *>(linkIconURL)]; >+ >+ [result setThumbnailURLs:thumbnailURLs.get()]; >+ } else if (!linkIconURLs.isEmpty()) >+ [result setThumbnailURL:linkIconURLs[0]]; >+ >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300 && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101304) || PLATFORM(IOS_FAMILY) >+ [result setAPIType:toAPIType(paymentRequest.requester())]; >+#endif >+ >+ [result setCountryCode:paymentRequest.countryCode()]; >+ [result setCurrencyCode:paymentRequest.currencyCode()]; >+ [result setBillingContact:paymentRequest.billingContact().pkContact()]; >+ [result setShippingContact:paymentRequest.shippingContact().pkContact()]; >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) >+ [result setRequiredBillingContactFields:toPKContactFields(paymentRequest.requiredBillingContactFields()).get()]; >+ [result setRequiredShippingContactFields:toPKContactFields(paymentRequest.requiredShippingContactFields()).get()]; >+#else >+ [result setRequiredBillingAddressFields:toPKAddressField(paymentRequest.requiredBillingContactFields())]; >+ [result setRequiredShippingAddressFields:toPKAddressField(paymentRequest.requiredShippingContactFields())]; >+#endif >+ >+ [result setSupportedNetworks:toSupportedNetworks(paymentRequest.supportedNetworks()).get()]; >+ [result setMerchantCapabilities:toPKMerchantCapabilities(paymentRequest.merchantCapabilities())]; >+ >+ [result setShippingType:toPKShippingType(paymentRequest.shippingType())]; >+ >+ auto shippingMethods = adoptNS([[NSMutableArray alloc] init]); >+ for (auto& shippingMethod : paymentRequest.shippingMethods()) >+ [shippingMethods addObject:toPKShippingMethod(shippingMethod).get()]; >+ [result setShippingMethods:shippingMethods.get()]; >+ >+ auto paymentSummaryItems = adoptNS([[NSMutableArray alloc] init]); >+ for (auto& lineItem : paymentRequest.lineItems()) { >+ if (auto summaryItem = toPKPaymentSummaryItem(lineItem)) >+ [paymentSummaryItems addObject:summaryItem.get()]; >+ } >+ >+ if (auto totalItem = toPKPaymentSummaryItem(paymentRequest.total())) >+ [paymentSummaryItems addObject:totalItem.get()]; >+ >+ [result setPaymentSummaryItems:paymentSummaryItems.get()]; >+ >+ [result setExpectsMerchantSession:YES]; >+ >+ if (!paymentRequest.applicationData().isNull()) { >+ auto applicationData = adoptNS([[NSData alloc] initWithBase64EncodedString:paymentRequest.applicationData() options:0]); >+ [result setApplicationData:applicationData.get()]; >+ } >+ >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) >+ [result setSupportedCountries:toNSSet(paymentRequest.supportedCountries()).get()]; >+#endif >+ >+ // TODO: set primary and secondary application bundle identifier here >+ // like analogous function in WebPaymentCoordinatorProxyCocoa.mm >+ >+ return result; >+} >+ >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) >+static PKPaymentAuthorizationStatus toPKPaymentAuthorizationStatus(WebCore::PaymentAuthorizationStatus status) >+{ >+ switch (status) { >+ case WebCore::PaymentAuthorizationStatus::Success: >+ return PKPaymentAuthorizationStatusSuccess; >+ case WebCore::PaymentAuthorizationStatus::Failure: >+ return PKPaymentAuthorizationStatusFailure; >+ case WebCore::PaymentAuthorizationStatus::PINRequired: >+ return PKPaymentAuthorizationStatusPINRequired; >+ case WebCore::PaymentAuthorizationStatus::PINIncorrect: >+ return PKPaymentAuthorizationStatusPINIncorrect; >+ case WebCore::PaymentAuthorizationStatus::PINLockout: >+ return PKPaymentAuthorizationStatusPINLockout; >+ } >+} >+ >+static PKPaymentErrorCode toPKPaymentErrorCode(WebCore::PaymentError::Code code) >+{ >+ switch (code) { >+ case WebCore::PaymentError::Code::Unknown: >+ return PKPaymentUnknownError; >+ case WebCore::PaymentError::Code::ShippingContactInvalid: >+ return PKPaymentShippingContactInvalidError; >+ case WebCore::PaymentError::Code::BillingContactInvalid: >+ return PKPaymentBillingContactInvalidError; >+ case WebCore::PaymentError::Code::AddressUnserviceable: >+ return PKPaymentShippingAddressUnserviceableError; >+ } >+} >+ >+static RetainPtr<NSError> toNSError(const WebCore::PaymentError& error) >+{ >+ auto userInfo = adoptNS([[NSMutableDictionary alloc] init]); >+ [userInfo setObject:error.message forKey:NSLocalizedDescriptionKey]; >+ >+ if (error.contactField) { >+ NSString *pkContactField = nil; >+ NSString *postalAddressKey = nil; >+ >+ switch (*error.contactField) { >+ case WebCore::PaymentError::ContactField::PhoneNumber: >+ pkContactField = PAL::get_PassKit_PKContactFieldPhoneNumber(); >+ break; >+ >+ case WebCore::PaymentError::ContactField::EmailAddress: >+ pkContactField = PAL::get_PassKit_PKContactFieldEmailAddress(); >+ break; >+ >+ case WebCore::PaymentError::ContactField::Name: >+ pkContactField = PAL::get_PassKit_PKContactFieldName(); >+ break; >+ >+ case WebCore::PaymentError::ContactField::PhoneticName: >+ pkContactField = PAL::get_PassKit_PKContactFieldPhoneticName(); >+ break; >+ >+ case WebCore::PaymentError::ContactField::PostalAddress: >+ pkContactField = PAL::get_PassKit_PKContactFieldPostalAddress(); >+ break; >+ >+ case WebCore::PaymentError::ContactField::AddressLines: >+ pkContactField = PAL::get_PassKit_PKContactFieldPostalAddress(); >+ postalAddressKey = getCNPostalAddressStreetKey(); >+ break; >+ >+ case WebCore::PaymentError::ContactField::SubLocality: >+ pkContactField = PAL::get_PassKit_PKContactFieldPostalAddress(); >+ postalAddressKey = getCNPostalAddressSubLocalityKey(); >+ break; >+ >+ case WebCore::PaymentError::ContactField::Locality: >+ pkContactField = PAL::get_PassKit_PKContactFieldPostalAddress(); >+ postalAddressKey = getCNPostalAddressCityKey(); >+ break; >+ >+ case WebCore::PaymentError::ContactField::PostalCode: >+ pkContactField = PAL::get_PassKit_PKContactFieldPostalAddress(); >+ postalAddressKey = getCNPostalAddressPostalCodeKey(); >+ break; >+ >+ case WebCore::PaymentError::ContactField::SubAdministrativeArea: >+ pkContactField = PAL::get_PassKit_PKContactFieldPostalAddress(); >+ postalAddressKey = getCNPostalAddressSubAdministrativeAreaKey(); >+ break; >+ >+ case WebCore::PaymentError::ContactField::AdministrativeArea: >+ pkContactField = PAL::get_PassKit_PKContactFieldPostalAddress(); >+ postalAddressKey = getCNPostalAddressStateKey(); >+ break; >+ >+ case WebCore::PaymentError::ContactField::Country: >+ pkContactField = PAL::get_PassKit_PKContactFieldPostalAddress(); >+ postalAddressKey = getCNPostalAddressCountryKey(); >+ break; >+ >+ case WebCore::PaymentError::ContactField::CountryCode: >+ pkContactField = PAL::get_PassKit_PKContactFieldPostalAddress(); >+ postalAddressKey = getCNPostalAddressISOCountryCodeKey(); >+ break; >+ } >+ >+ [userInfo setObject:pkContactField forKey:PAL::get_PassKit_PKPaymentErrorContactFieldUserInfoKey()]; >+ if (postalAddressKey) >+ [userInfo setObject:postalAddressKey forKey:PAL::get_PassKit_PKPaymentErrorPostalAddressUserInfoKey()]; >+ } >+ >+ return adoptNS([[NSError alloc] initWithDomain:getPKPaymentErrorDomain() code:toPKPaymentErrorCode(error.code) userInfo:userInfo.get()]); >+} >+ >+static RetainPtr<NSArray> toNSErrors(const Vector<WebCore::PaymentError>& errors) >+{ >+ auto result = adoptNS([[NSMutableArray alloc] init]); >+ >+ for (auto error : errors) { >+ if (auto nsError = toNSError(error)) >+ [result addObject:nsError.get()]; >+ } >+ >+ return result; >+} >+#else >+static PKPaymentAuthorizationStatus toPKPaymentAuthorizationStatus(const std::optional<WebCore::PaymentAuthorizationResult>& result) >+{ >+ if (!result) >+ return PKPaymentAuthorizationStatusSuccess; >+ >+ if (result->errors.size() == 1) { >+ auto& error = result->errors[0]; >+ switch (error.code) { >+ case WebCore::PaymentError::Code::Unknown: >+ case WebCore::PaymentError::Code::AddressUnserviceable: >+ return PKPaymentAuthorizationStatusFailure; >+ >+ case WebCore::PaymentError::Code::BillingContactInvalid: >+ return PKPaymentAuthorizationStatusInvalidBillingPostalAddress; >+ >+ case WebCore::PaymentError::Code::ShippingContactInvalid: >+ if (error.contactField && error.contactField == WebCore::PaymentError::ContactField::PostalAddress) >+ return PKPaymentAuthorizationStatusInvalidShippingPostalAddress; >+ >+ return PKPaymentAuthorizationStatusInvalidShippingContact; >+ } >+ } >+ >+ switch (result->status) { >+ case WebCore::PaymentAuthorizationStatus::Success: >+ return PKPaymentAuthorizationStatusSuccess; >+ case WebCore::PaymentAuthorizationStatus::Failure: >+ return PKPaymentAuthorizationStatusFailure; >+ case WebCore::PaymentAuthorizationStatus::PINRequired: >+ return PKPaymentAuthorizationStatusPINRequired; >+ case WebCore::PaymentAuthorizationStatus::PINIncorrect: >+ return PKPaymentAuthorizationStatusPINIncorrect; >+ case WebCore::PaymentAuthorizationStatus::PINLockout: >+ return PKPaymentAuthorizationStatusPINLockout; >+ } >+ >+ return PKPaymentAuthorizationStatusFailure; >+} >+#endif >+ >+void PaymentProcessCoordinatorProxy::platformCompletePaymentSession(const std::optional<WebCore::PaymentAuthorizationResult>& result) >+{ >+ ASSERT(m_paymentAuthorizationController); >+ ASSERT(m_paymentAuthorizationControllerDelegate); >+ >+ m_paymentAuthorizationControllerDelegate->_didReachFinalState = WebCore::isFinalStateResult(result); >+ >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) >+ auto status = result ? result->status : WebCore::PaymentAuthorizationStatus::Success; >+ auto pkPaymentAuthorizationResult = adoptNS([PAL::allocPKPaymentAuthorizationResultInstance() initWithStatus:toPKPaymentAuthorizationStatus(status) errors:result ? toNSErrors(result->errors).get() : @[ ]]); >+ m_paymentAuthorizationControllerDelegate->_paymentAuthorizedCompletion(pkPaymentAuthorizationResult.get()); >+#else >+ m_paymentAuthorizationControllerDelegate->_paymentAuthorizedCompletion(toPKPaymentAuthorizationStatus(result)); >+#endif >+ m_paymentAuthorizationControllerDelegate->_paymentAuthorizedCompletion = nullptr; >+} >+ >+void PaymentProcessCoordinatorProxy::platformCompleteMerchantValidation(const WebCore::PaymentMerchantSession& paymentMerchantSession) >+{ >+ ASSERT(m_paymentAuthorizationController); >+ ASSERT(m_paymentAuthorizationControllerDelegate); >+ >+ m_paymentAuthorizationControllerDelegate->_sessionBlock(paymentMerchantSession.pkPaymentMerchantSession(), nullptr); >+ m_paymentAuthorizationControllerDelegate->_sessionBlock = nullptr; >+} >+ >+void PaymentProcessCoordinatorProxy::platformCompleteShippingMethodSelection(const std::optional<WebCore::ShippingMethodUpdate>& update) >+{ >+ ASSERT(m_paymentAuthorizationController); >+ ASSERT(m_paymentAuthorizationControllerDelegate); >+ >+ if (update) >+ m_paymentAuthorizationControllerDelegate->_paymentSummaryItems = toPKPaymentSummaryItems(update->newTotalAndLineItems); >+ >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) >+ auto pkShippingMethodUpdate = adoptNS([PAL::allocPKPaymentRequestShippingMethodUpdateInstance() initWithPaymentSummaryItems:m_paymentAuthorizationControllerDelegate->_paymentSummaryItems.get()]); >+ m_paymentAuthorizationControllerDelegate->_didSelectShippingMethodCompletion(pkShippingMethodUpdate.get()); >+#else >+ m_paymentAuthorizationControllerDelegate->_didSelectShippingMethodCompletion(PKPaymentAuthorizationStatusSuccess, m_paymentAuthorizationControllerDelegate->_paymentSummaryItems.get()); >+#endif >+ m_paymentAuthorizationControllerDelegate->_didSelectShippingMethodCompletion = nullptr; >+} >+ >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED < 110000) >+static PKPaymentAuthorizationStatus toPKPaymentAuthorizationStatus(const std::optional<WebCore::ShippingContactUpdate>& update) >+{ >+ if (!update || update->errors.isEmpty()) >+ return PKPaymentAuthorizationStatusSuccess; >+ >+ if (update->errors.size() == 1) { >+ auto& error = update->errors[0]; >+ switch (error.code) { >+ case WebCore::PaymentError::Code::Unknown: >+ case WebCore::PaymentError::Code::AddressUnserviceable: >+ return PKPaymentAuthorizationStatusFailure; >+ >+ case WebCore::PaymentError::Code::BillingContactInvalid: >+ return PKPaymentAuthorizationStatusInvalidBillingPostalAddress; >+ >+ case WebCore::PaymentError::Code::ShippingContactInvalid: >+ if (error.contactField && error.contactField == WebCore::PaymentError::ContactField::PostalAddress) >+ return PKPaymentAuthorizationStatusInvalidShippingPostalAddress; >+ >+ return PKPaymentAuthorizationStatusInvalidShippingContact; >+ } >+ } >+ >+ return PKPaymentAuthorizationStatusFailure; >+} >+#endif >+ >+void PaymentProcessCoordinatorProxy::platformCompleteShippingContactSelection(const std::optional<WebCore::ShippingContactUpdate>& update) >+{ >+ ASSERT(m_paymentAuthorizationController); >+ ASSERT(m_paymentAuthorizationControllerDelegate); >+ >+ if (update) { >+ m_paymentAuthorizationControllerDelegate->_paymentSummaryItems = toPKPaymentSummaryItems(update->newTotalAndLineItems); >+ >+ auto shippingMethods = adoptNS([[NSMutableArray alloc] init]); >+ for (auto& shippingMethod : update->newShippingMethods) >+ [shippingMethods addObject:toPKShippingMethod(shippingMethod).get()]; >+ >+ m_paymentAuthorizationControllerDelegate->_shippingMethods = WTFMove(shippingMethods); >+ } >+ >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) >+ auto pkShippingContactUpdate = adoptNS([PAL::allocPKPaymentRequestShippingContactUpdateInstance() initWithErrors:update ? toNSErrors(update->errors).get() : @[ ] paymentSummaryItems:m_paymentAuthorizationControllerDelegate->_paymentSummaryItems.get() shippingMethods:m_paymentAuthorizationControllerDelegate->_shippingMethods.get()]); >+ m_paymentAuthorizationControllerDelegate->_didSelectShippingContactCompletion(pkShippingContactUpdate.get()); >+#else >+ m_paymentAuthorizationControllerDelegate->_didSelectShippingContactCompletion(toPKPaymentAuthorizationStatus(update), m_paymentAuthorizationControllerDelegate->_shippingMethods.get(), m_paymentAuthorizationControllerDelegate->_paymentSummaryItems.get()); >+#endif >+ m_paymentAuthorizationControllerDelegate->_didSelectShippingContactCompletion = nullptr; >+} >+ >+void PaymentProcessCoordinatorProxy::platformCompletePaymentMethodSelection(const std::optional<WebCore::PaymentMethodUpdate>& update) >+{ >+ ASSERT(m_paymentAuthorizationController); >+ ASSERT(m_paymentAuthorizationControllerDelegate); >+ >+ if (update) >+ m_paymentAuthorizationControllerDelegate->_paymentSummaryItems = toPKPaymentSummaryItems(update->newTotalAndLineItems); >+ >+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) >+ auto pkPaymentMethodUpdate = adoptNS([PAL::allocPKPaymentRequestPaymentMethodUpdateInstance() initWithPaymentSummaryItems:m_paymentAuthorizationControllerDelegate->_paymentSummaryItems.get()]); >+ m_paymentAuthorizationControllerDelegate->_didSelectPaymentMethodCompletion(pkPaymentMethodUpdate.get()); >+#else >+ m_paymentAuthorizationControllerDelegate->_didSelectPaymentMethodCompletion(m_paymentAuthorizationControllerDelegate->_paymentSummaryItems.get()); >+#endif >+ m_paymentAuthorizationControllerDelegate->_didSelectPaymentMethodCompletion = nullptr; >+} >+ >+Vector<String> PaymentProcessCoordinatorProxy::platformAvailablePaymentNetworks() >+{ >+ NSArray<PKPaymentNetwork> *availableNetworks = [PAL::getPKPaymentRequestClass() availableNetworks]; >+ Vector<String> result; >+ result.reserveInitialCapacity(availableNetworks.count); >+ for (PKPaymentNetwork network in availableNetworks) >+ result.uncheckedAppend(network); >+ return result; >+} >+ >+} // namespace WebKit >+ >+#endif // ENABLE(APPLE_PAY) >diff --git a/Source/WebKit/PaymentProcess/PaymentProcessCoordinatorProxyIOS.mm b/Source/WebKit/PaymentProcess/PaymentProcessCoordinatorProxyIOS.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..8c0869f6ca6ad369e6b13c7bf0c126b952582fe5 >--- /dev/null >+++ b/Source/WebKit/PaymentProcess/PaymentProcessCoordinatorProxyIOS.mm >@@ -0,0 +1,79 @@ >+/* >+ * Copyright (C) 2016 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#import "config.h" >+#import "PaymentProcessCoordinatorProxy.h" >+ >+#if PLATFORM(IOS_FAMILY) && ENABLE(APPLE_PAY) && ENABLE(PAYMENT_PROCESS) >+ >+#import "APIUIClient.h" >+#import "PaymentProcessCoordinatorProxyCocoa.h" >+#import <PassKit/PassKit.h> >+#import <UIKit/UIViewController.h> >+#import <WebCore/PaymentAuthorizationStatus.h> >+#import <pal/cocoa/PassKitSoftLink.h> >+ >+namespace WebKit { >+ >+void PaymentProcessCoordinatorProxy::platformShowPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLStrings, const WebCore::ApplePaySessionPaymentRequest& request, WTF::Function<void(bool)>&& completionHandler) >+{ >+ ASSERT(!m_paymentAuthorizationController); >+ >+ auto paymentRequest = toPKPaymentRequest(originatingURL, linkIconURLStrings, request); >+ >+ m_paymentAuthorizationController = adoptNS([PAL::allocPKPaymentAuthorizationControllerInstance() initWithPaymentRequest:paymentRequest.get()]); >+ if (!m_paymentAuthorizationController) { >+ completionHandler(false); >+ return; >+ } >+ >+ m_paymentAuthorizationControllerDelegate = adoptNS([[WKPaymentAuthorizationControllerDelegate alloc] initWithPaymentCoordinatorProxy:*this]); >+ m_paymentAuthorizationControllerDelegate->_paymentSummaryItems = [paymentRequest paymentSummaryItems]; >+ m_paymentAuthorizationControllerDelegate->_shippingMethods = [paymentRequest shippingMethods]; >+ >+ [m_paymentAuthorizationController setDelegate:m_paymentAuthorizationControllerDelegate.get()]; >+ [m_paymentAuthorizationController setPrivateDelegate:m_paymentAuthorizationControllerDelegate.get()]; >+ [m_paymentAuthorizationController presentWithCompletion: nullptr]; >+ >+ completionHandler(true); >+} >+ >+void PaymentProcessCoordinatorProxy::hidePaymentUI() >+{ >+ ASSERT(m_paymentAuthorizationController); >+ ASSERT(m_paymentAuthorizationControllerDelegate); >+ >+ [m_paymentAuthorizationController dismissWithCompletion:nullptr]; >+ [m_paymentAuthorizationController setDelegate:nil]; >+ [m_paymentAuthorizationController setPrivateDelegate:nil]; >+ m_paymentAuthorizationController = nullptr; >+ >+ [m_paymentAuthorizationControllerDelegate invalidate]; >+ m_paymentAuthorizationControllerDelegate = nullptr; >+} >+ >+} >+ >+#endif >diff --git a/Source/WebKit/PaymentProcess/PaymentToWebProcessConnection.cpp b/Source/WebKit/PaymentProcess/PaymentToWebProcessConnection.cpp >index c31c4088a2d6bcd941bc777c9ea3951a9199e78e..c1610a535f3245a548ae14a4baf37445f5fd526b 100644 >--- a/Source/WebKit/PaymentProcess/PaymentToWebProcessConnection.cpp >+++ b/Source/WebKit/PaymentProcess/PaymentToWebProcessConnection.cpp >@@ -30,6 +30,7 @@ > > #include "Logging.h" > #include "PaymentProcess.h" >+#include "PaymentProcessCoordinatorProxyMessages.h" > #include "PaymentProcessMessages.h" > #include "PaymentToWebProcessConnectionMessages.h" > #include <wtf/RunLoop.h> >@@ -49,7 +50,7 @@ PaymentToWebProcessConnection::PaymentToWebProcessConnection(IPC::Connection::Id > { > // NOTE: we must set this to true because the WebContent process may re-enter when sending > // a sync IPC and this is a huge source of security bugs >- m_connection->setOnlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage(true) >+ m_connection->setOnlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage(true); > m_connection->open(); > } > >@@ -61,7 +62,12 @@ PaymentToWebProcessConnection::~PaymentToWebProcessConnection() > void PaymentToWebProcessConnection::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder) > { > if (decoder.messageReceiverName() == Messages::PaymentProcess::messageReceiverName()) { >- PaymentProcess::singleton().didReceivePaymentProcessMessage(connection, decoder); >+ PaymentProcess::singleton().didReceiveMessage(connection, decoder); >+ return; >+ } >+ >+ if (decoder.messageReceiverName() == Messages::PaymentProcessCoordinatorProxy::messageReceiverName()) { >+ PaymentProcess::singleton().didReceiveMessage(connection, decoder); > return; > } > >@@ -70,9 +76,61 @@ void PaymentToWebProcessConnection::didReceiveMessage(IPC::Connection& connectio > > void PaymentToWebProcessConnection::didReceiveSyncMessage(IPC::Connection& connection, IPC::Decoder& decoder, std::unique_ptr<IPC::Encoder>& replyEncoder) > { >+ if (decoder.messageReceiverName() == Messages::PaymentProcess::messageReceiverName()) { >+ PaymentProcess::singleton().didReceiveSyncMessage(connection, decoder, replyEncoder); >+ return; >+ >+ } >+ >+ if (decoder.messageReceiverName() == Messages::PaymentProcessCoordinatorProxy::messageReceiverName()) { >+ PaymentProcess::singleton().didReceiveSyncMessage(connection, decoder, replyEncoder); >+ return; >+ >+ } >+ > ASSERT_NOT_REACHED(); > } > >+void PaymentToWebProcessConnection::validateMerchant(const String& validationURLString) >+{ >+ m_connection->send(Messages::WebToPaymentProcessConnection::ValidateMerchant(validationURLString), 0); >+} >+ >+void PaymentToWebProcessConnection::didAuthorizePayment(const WebCore::Payment& payment) >+{ >+ m_connection->send(Messages::WebToPaymentProcessConnection::DidAuthorizePayment(payment), 0); >+} >+ >+void PaymentToWebProcessConnection::didSelectShippingMethod(const WebCore::ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod) >+{ >+ m_connection->send(Messages::WebToPaymentProcessConnection::DidSelectShippingMethod(shippingMethod), 0); >+} >+ >+void PaymentToWebProcessConnection::didSelectShippingContact(const WebCore::PaymentContact& shippingContact) >+{ >+ m_connection->send(Messages::WebToPaymentProcessConnection::DidSelectShippingContact(shippingContact), 0); >+} >+ >+void PaymentToWebProcessConnection::didSelectPaymentMethod(const WebCore::PaymentMethod& paymentMethod) >+{ >+ m_connection->send(Messages::WebToPaymentProcessConnection::DidSelectPaymentMethod(paymentMethod), 0); >+} >+ >+void PaymentToWebProcessConnection::didCancelPaymentSession() >+{ >+ m_connection->send(Messages::WebToPaymentProcessConnection::DidCancelPaymentSession(), 0); >+} >+ >+void PaymentToWebProcessConnection::canMakePaymentsWithActiveCardReply(uint64_t requestID, bool canMakePayments) >+{ >+ m_connection->send(Messages::WebToPaymentProcessConnection::CanMakePaymentsWithActiveCardReply(requestID, canMakePayments), 0); >+} >+ >+void PaymentToWebProcessConnection::openPaymentSetupReply(uint64_t requestID, bool result) >+{ >+ m_connection->send(Messages::WebToPaymentProcessConnection::OpenPaymentSetupReply(requestID, result), 0); >+} >+ > void PaymentToWebProcessConnection::didClose(IPC::Connection& connection) > { > UNUSED_PARAM(connection); >diff --git a/Source/WebKit/PaymentProcess/PaymentToWebProcessConnection.h b/Source/WebKit/PaymentProcess/PaymentToWebProcessConnection.h >index 849a9eb4a137644116caced038307ab34081cffc..7b314a02a8863bd3bdda90c1ddfdc6a8bbf11b04 100644 >--- a/Source/WebKit/PaymentProcess/PaymentToWebProcessConnection.h >+++ b/Source/WebKit/PaymentProcess/PaymentToWebProcessConnection.h >@@ -40,6 +40,15 @@ public: > ~PaymentToWebProcessConnection(); > > IPC::Connection& connection() { return m_connection.get(); } >+ >+ void validateMerchant(const String& validationURLString); >+ void didAuthorizePayment(const WebCore::Payment&); >+ void didSelectShippingMethod(const WebCore::ApplePaySessionPaymentRequest::ShippingMethod&); >+ void didSelectShippingContact(const WebCore::PaymentContact&); >+ void didSelectPaymentMethod(const WebCore::PaymentMethod&); >+ void didCancelPaymentSession(); >+ void canMakePaymentsWithActiveCardReply(uint64_t requestID, bool canMakePayments); >+ void openPaymentSetupReply(uint64_t requestID, bool result); > > private: > PaymentToWebProcessConnection(IPC::Connection::Identifier); >diff --git a/Source/WebKit/Platform/ExtraPrivateSymbolsForTAPI.h b/Source/WebKit/Platform/ExtraPrivateSymbolsForTAPI.h >index df08ea28af8ecb4064c99c7be33e72fd4d8b94c8..1a32ddad7d1da49d52b500ddddb39f64560899cb 100644 >--- a/Source/WebKit/Platform/ExtraPrivateSymbolsForTAPI.h >+++ b/Source/WebKit/Platform/ExtraPrivateSymbolsForTAPI.h >@@ -30,6 +30,7 @@ extern "C" { > #endif > > // FIXME: Remove these after <rdar://problem/30772033> is fixed. >+void PaymentServiceInitializer(); > void NetworkServiceInitializer(); > void PluginServiceInitializer(); > void WebContentServiceInitializer(); >diff --git a/Source/WebKit/Scripts/process-payments-sandbox-entitlements.sh b/Source/WebKit/Scripts/process-payments-sandbox-entitlements.sh >new file mode 100755 >index 0000000000000000000000000000000000000000..c04f280fb8637af13390858d2480bd949dacaea9 >--- /dev/null >+++ b/Source/WebKit/Scripts/process-payments-sandbox-entitlements.sh >@@ -0,0 +1,14 @@ >+#!/bin/sh >+set -e >+ >+PROCESSED_XCENT_FILE="${TEMP_FILE_DIR}/${FULL_PRODUCT_NAME}.xcent" >+ >+if [[ ${WK_PLATFORM_NAME} == "macosx" ]]; then >+ >+ if [[ ${WK_USE_RESTRICTED_ENTITLEMENTS} == "YES" ]]; then >+ echo "Processing restricted entitlements for Internal SDK"; >+ >+ echo "Adding sandbox entitlements for Payments process."; >+ /usr/libexec/PlistBuddy -c "Merge Configurations/Payments-ios.entitlements" "${PROCESSED_XCENT_FILE}"; >+ fi >+fi >diff --git a/Source/WebKit/Shared/ChildProcess.h b/Source/WebKit/Shared/ChildProcess.h >index 31e81f2b6ea959dcdc4e21686872449f8ab95a6c..de3e7aa8ad5d1c01bf1e881b18d328f859d10f7c 100644 >--- a/Source/WebKit/Shared/ChildProcess.h >+++ b/Source/WebKit/Shared/ChildProcess.h >@@ -52,6 +52,9 @@ public: > Payment, > #endif // ENABLE(PAYMENT_PROCESS) > Plugin >+#if ENABLE(PAYMENT_PROCESS) >+ Payment >+#endif // ENABLE(PAYMENT_PROCESS) > }; > > void initialize(const ChildProcessInitializationParameters&); >diff --git a/Source/WebKit/Shared/Payment/PaymentProcessCreationParameters.cpp b/Source/WebKit/Shared/Payment/PaymentProcessCreationParameters.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..57370973403d463408ed63bbcef4563bd009981f >--- /dev/null >+++ b/Source/WebKit/Shared/Payment/PaymentProcessCreationParameters.cpp >@@ -0,0 +1,53 @@ >+/* >+ * Copyright (C) 2013 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#if ENABLE(PAYMENT_PROCESS) >+ >+#include "config.h" >+#include "PaymentProcessCreationParameters.h" >+ >+#include "ArgumentCoders.h" >+ >+namespace WebKit { >+ >+PaymentProcessCreationParameters::PaymentProcessCreationParameters() >+{ >+} >+ >+void PaymentProcessCreationParameters::encode(IPC::Encoder& encoder) const >+{ >+ encoder << sessionID; >+} >+ >+bool PaymentProcessCreationParameters::decode(IPC::Decoder& decoder, PaymentProcessCreationParameters& result) >+{ >+ if (!decoder.decode(result.sessionID)) >+ return false; >+ >+ return true; >+} >+ >+} // namespace WebKit >+#endif // ENABLE(PAYMENT_PROCESS) >diff --git a/Source/WebKit/Shared/Payment/PaymentProcessCreationParameters.h b/Source/WebKit/Shared/Payment/PaymentProcessCreationParameters.h >new file mode 100644 >index 0000000000000000000000000000000000000000..bac863c00a8a407013512ca231c05583517b9eec >--- /dev/null >+++ b/Source/WebKit/Shared/Payment/PaymentProcessCreationParameters.h >@@ -0,0 +1,52 @@ >+/* >+ * Copyright (C) 2013 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ * >+ */ >+#if ENABLE(PAYMENT_PROCESS) >+ >+#pragma once >+ >+#include "SandboxExtension.h" >+#include <pal/SessionID.h> >+#include <wtf/text/WTFString.h> >+ >+namespace IPC { >+class Decoder; >+class Encoder; >+} >+ >+namespace WebKit { >+ >+struct PaymentProcessCreationParameters { >+ PaymentProcessCreationParameters(); >+ >+ void encode(IPC::Encoder&) const; >+ static bool decode(IPC::Decoder&, PaymentProcessCreationParameters&); >+ >+ PAL::SessionID sessionID; >+}; >+ >+} // namespace WebKit >+ >+#endif // !PAYMENT(PAYMENT_PROCESS >diff --git a/Source/WebKit/Sources.txt b/Source/WebKit/Sources.txt >index 27dfbf1d5e31ec9b5877d96ed8c3e9a986f69da1..de0b13c3d153f35c95b9a7758a1063b028b65f83 100644 >--- a/Source/WebKit/Sources.txt >+++ b/Source/WebKit/Sources.txt >@@ -73,9 +73,6 @@ NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp > > NetworkProcess/webrtc/NetworkMDNSRegister.cpp > >-PaymentProcess/PaymentProcess.cpp >-PaymentProcess/PaymentToWebProcessConnection.cpp >- > // TODO: We should unify these files once GTK's PluginProcess2 is removed. > Platform/Logging.cpp @no-unify > Platform/Module.cpp @no-unify >@@ -204,6 +201,7 @@ Shared/Databases/IndexedDB/WebIDBResult.cpp > > Shared/Gamepad/GamepadData.cpp > >+ > // TODO: These files should be unified once GTK's PluginProcess2 is removed. > Shared/Plugins/NPIdentifierData.cpp @no-unify > Shared/Plugins/NPObjectMessageReceiver.cpp @no-unify >@@ -377,8 +375,6 @@ UIProcess/Notifications/WebNotification.cpp > UIProcess/Notifications/WebNotificationManagerProxy.cpp > UIProcess/Notifications/WebNotificationProvider.cpp > >-UIProcess/Payments/PaymentProcessProxy.cpp >- > UIProcess/Plugins/PlugInAutoStartProvider.cpp > UIProcess/Plugins/PluginInfoStore.cpp > UIProcess/Plugins/PluginProcessManager.cpp >@@ -480,8 +476,6 @@ WebProcess/Network/webrtc/WebRTCSocket.cpp > WebProcess/Notifications/NotificationPermissionRequestManager.cpp > WebProcess/Notifications/WebNotificationManager.cpp > >-WebProcess/Payments/WebToPaymentProcessConnection.cpp >- > // TODO: These files should be unified once GTK's PluginProcess2 is removed. > WebProcess/Plugins/Plugin.cpp @no-unify > WebProcess/Plugins/PluginProcessConnection.cpp @no-unify >diff --git a/Source/WebKit/SourcesCocoa.txt b/Source/WebKit/SourcesCocoa.txt >index a3f5b91e1977244d1ec63403205bea03a841b0ef..d48cac3ebd6da04fc654bb2b441f9f34c9fbd355 100644 >--- a/Source/WebKit/SourcesCocoa.txt >+++ b/Source/WebKit/SourcesCocoa.txt >@@ -184,7 +184,13 @@ Shared/mac/WebGestureEvent.cpp > Shared/mac/WebHitTestResultData.mm > Shared/mac/WebMemorySampler.mac.mm > >+PaymentProcess/EntryPoint/ios/XPCService/PaymentServiceEntryPoint.mm > PaymentProcess/ios/PaymentProcessIOS.mm >+PaymentProcess/PaymentProcess.cpp >+PaymentProcess/PaymentProcessCoordinatorProxy.cpp >+PaymentProcess/PaymentToWebProcessConnection.cpp >+PaymentProcess/PaymentProcessCoordinatorProxyIOS.mm >+PaymentProcess/PaymentProcessCoordinatorProxyCocoa.mm > > Shared/Plugins/mac/PluginSandboxProfile.mm > >@@ -441,6 +447,8 @@ UIProcess/mac/WKViewLayoutStrategy.mm > > UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.cpp > >+UIProcess/Payments/PaymentProcessProxy.cpp >+ > UIProcess/Plugins/mac/PluginInfoStoreMac.mm > UIProcess/Plugins/mac/PluginProcessManagerMac.mm > UIProcess/Plugins/mac/PluginProcessProxyMac.mm >@@ -510,6 +518,9 @@ WebProcess/InjectedBundle/mac/InjectedBundleMac.mm > > WebProcess/MediaCache/WebMediaKeyStorageManager.cpp > >+WebProcess/Payments/PaymentProcessCoordinator.cpp >+WebProcess/Payments/WebToPaymentProcessConnection.cpp >+ > WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm > WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm > >diff --git a/Source/WebKit/UIProcess/API/C/WKContext.cpp b/Source/WebKit/UIProcess/API/C/WKContext.cpp >index e36fd4aa81046ee6abbad2d89fd04c9d0ecd91d9..cdf3a6b41ef6dd339de22b99d0560c2ef0377da0 100644 >--- a/Source/WebKit/UIProcess/API/C/WKContext.cpp >+++ b/Source/WebKit/UIProcess/API/C/WKContext.cpp >@@ -623,6 +623,13 @@ void WKContextTerminatePaymentProcess(WKContextRef context) > #endif // ENABLE(PAYMENT_PROCESS) > } > >+void WKContextTerminatePaymentProcess(WKContextRef context) >+{ >+#if ENABLE(PAYMENT_PROCESS) >+ toImpl(context)->terminatePaymentProcessForTesting(); >+#endif // ENABLE(PAYMENT_PROCESS) >+} >+ > ProcessID WKContextGetNetworkProcessIdentifier(WKContextRef contextRef) > { > return WebKit::toImpl(contextRef)->networkProcessIdentifier(); >@@ -637,6 +644,15 @@ ProcessID WKContextGetPaymentProcessIdentifier(WKContextRef contextRef) > #endif // ENABLE(PAYMENT_PROCESS) > } > >+ProcessID WKContextGetPaymentProcessIdentifier(WKContextRef contextRef) >+{ >+#if ENABLE(PAYMENT_PROCESS) >+ return toImpl(contextRef)->paymentProcessIdentifier(); >+#else >+ return 0; >+#endif // ENABLE(PAYMENT_PROCESS) >+} >+ > void WKContextAddSupportedPlugin(WKContextRef contextRef, WKStringRef domainRef, WKStringRef nameRef, WKArrayRef mimeTypesRef, WKArrayRef extensionsRef) > { > #if ENABLE(NETSCAPE_PLUGIN_API) >diff --git a/Source/WebKit/UIProcess/API/C/WKContextPrivate.h b/Source/WebKit/UIProcess/API/C/WKContextPrivate.h >index 8ed4b4f764151e1836b598ddba0a6c62c637dd5b..1512639794d4ddeae6715e44c7aa33f23a3b9b4e 100644 >--- a/Source/WebKit/UIProcess/API/C/WKContextPrivate.h >+++ b/Source/WebKit/UIProcess/API/C/WKContextPrivate.h >@@ -92,6 +92,7 @@ WK_EXPORT void WKContextSetUsesNetworkProcess(WKContextRef, bool); > > WK_EXPORT void WKContextTerminateNetworkProcess(WKContextRef); > WK_EXPORT void WKContextTerminateServiceWorkerProcess(WKContextRef); >+WK_EXPORT void WKContextTerminatePaymentProcess(WKContextRef); > > WK_EXPORT void WKContextTerminatePaymentProcess(WKContextRef); > >diff --git a/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h b/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h >index c4d79fe4c12c9ab854fbbd42513b785383072ae7..7dba5f54bac67c267c11717779d6a670f3779c18 100644 >--- a/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h >+++ b/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h >@@ -31,11 +31,15 @@ > #import <pal/spi/cocoa/PassKitSPI.h> > #import <wtf/BlockPtr.h> > >+namespace WebCore { >+class URL; >+} >+ > namespace WebKit { > class WebPageProxy; > class WebPaymentCoordinatorProxy; > >-RetainPtr<PKPaymentRequest> toPKPaymentRequest(WebPageProxy&, const URL& originatingURL, const Vector<URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&); >+RetainPtr<PKPaymentRequest> toPKPaymentRequest(const URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&); > > } > >diff --git a/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm b/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm >index a675ebdea975105ed4b9ea2bc50701d6aa1b408d..d12cb469f267290643ec9fae9715ed8c9a4f3f92 100644 >--- a/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm >+++ b/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm >@@ -441,8 +441,8 @@ static PKPaymentRequestAPIType toAPIType(WebCore::ApplePaySessionPaymentRequest: > } > } > #endif >- >-RetainPtr<PKPaymentRequest> toPKPaymentRequest(WebPageProxy& webPageProxy, const URL& originatingURL, const Vector<URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest& paymentRequest) >+ >+RetainPtr<PKPaymentRequest> toPKPaymentRequest(WebPageProxy& webPageProxy, const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest& paymentRequest) > { > auto result = adoptNS([PAL::allocPKPaymentRequestInstance() init]); > >diff --git a/Source/WebKit/UIProcess/Payments/PaymentProcessProxy.cpp b/Source/WebKit/UIProcess/Payments/PaymentProcessProxy.cpp >index 7e7b54552f69f5916acf4af376a55a340706e8dd..749ae9bb14f57761e945c8680da674ab1083a6c3 100644 >--- a/Source/WebKit/UIProcess/Payments/PaymentProcessProxy.cpp >+++ b/Source/WebKit/UIProcess/Payments/PaymentProcessProxy.cpp >@@ -35,6 +35,8 @@ > #include "WebsiteData.h" > #include <WebCore/NotImplemented.h> > >+#define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, connection()) >+ > namespace WebKit { > using namespace WebCore; > >@@ -48,6 +50,8 @@ PaymentProcessProxy::PaymentProcessProxy(WebProcessPool& processPool) > > PaymentProcessProxy::~PaymentProcessProxy() > { >+ for (auto& reply : m_pendingConnectionReplies) >+ reply({ }); > } > > void PaymentProcessProxy::terminateForTesting() >@@ -59,15 +63,14 @@ void PaymentProcessProxy::getPaymentProcessConnection(WebProcessProxy& webProces > { > m_pendingConnectionReplies.append(WTFMove(reply)); > >- if (state() == State::Launching) { >+ if (state() != State::Running) { > m_numPendingConnectionRequests++; > return; > } > >- bool isServiceWorkerProcess = false; >- SecurityOriginData securityOrigin; > >- send(Messages::PaymentProcess::CreatePaymentToWebProcessConnection(isServiceWorkerProcess, securityOrigin), 0, IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply); >+ connection()->send(Messages::PaymentProcess::CreatePaymentToWebProcessConnection(), 0); >+ > } > > void PaymentProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions) >@@ -81,14 +84,6 @@ void PaymentProcessProxy::processWillShutDown(IPC::Connection& connection) > ASSERT_UNUSED(connection, this->connection() == &connection); > } > >-void PaymentProcessProxy::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder) >-{ >- if (decoder.messageReceiverName() == Messages::PaymentProcessProxy::messageReceiverName()) { >- didReceivePaymentProcessProxyMessage(connection, decoder); >- return; >- } >-} >- > void PaymentProcessProxy::didClose(IPC::Connection&) > { > auto protectedProcessPool = makeRef(m_processPool); >@@ -99,25 +94,30 @@ void PaymentProcessProxy::didClose(IPC::Connection&) > notImplemented(); > } > // Tell ProcessPool to forget about this payment process. This may cause us to be deleted. >- m_processPool.paymentProcessCrashed(*this); >+ m_processPool.paymentProcessCrashed(this); > } > > void PaymentProcessProxy::didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference messageReceiverName, IPC::StringReference messageName) > { > } >- >-void didReceivePaymentProcessProxyMessage(IPC::Connection&, IPC::Decoder&) >+ >+void PaymentProcessProxy::didCreatePaymentToWebProcessConnection(const IPC::Attachment& connectionIdentifier) > { >+ ASSERT(!m_pendingConnectionReplies.isEmpty()); >+ >+ // Grab the first pending connection reply. >+ auto reply = m_pendingConnectionReplies.takeFirst(); >+ MESSAGE_CHECK(MACH_PORT_VALID(connectionIdentifier.port())); >+ reply(IPC::Attachment(connectionIdentifier.port(), MACH_MSG_TYPE_MOVE_SEND)); >+ > } > >-void PaymentProcessProxy::didCreatePaymentToWebProcessConnection(const IPC::Attachment& connectionIdentifier) >+void PaymentProcessProxy::createPaymentToWebProcessConnection() > { >- notImplemented(); > } > > void PaymentProcessProxy::didFinishLaunching(ProcessLauncher* launcher, IPC::Connection::Identifier connectionIdentifier) >-{ >- ChildProcessProxy::didFinishLaunching(launcher, connectionIdentifier); >+{ ChildProcessProxy::didFinishLaunching(launcher, connectionIdentifier); > > if (!IPC::Connection::identifierIsValid(connectionIdentifier)) { > // FIXME: Do better cleanup here. >@@ -125,10 +125,12 @@ void PaymentProcessProxy::didFinishLaunching(ProcessLauncher* launcher, IPC::Con > } > > for (unsigned i = 0; i < m_numPendingConnectionRequests; ++i) >- send(Messages::PaymentProcess::CreatePaymentToWebProcessConnection(false, { }), 0); >- >+ send(Messages::PaymentProcess::CreatePaymentToWebProcessConnection(), 0); >+ > m_numPendingConnectionRequests = 0; > } > > } // namespace WebKit >+#undef MESSAGE_CHECK > #endif // ENABLE(PAYMENT_PROCESS) >+ >diff --git a/Source/WebKit/UIProcess/Payments/PaymentProcessProxy.h b/Source/WebKit/UIProcess/Payments/PaymentProcessProxy.h >index e031c7c67b4f0e9426b11d10f1e554595784f05c..7bf1300491314786e32976cf8bd04236effa52c4 100644 >--- a/Source/WebKit/UIProcess/Payments/PaymentProcessProxy.h >+++ b/Source/WebKit/UIProcess/Payments/PaymentProcessProxy.h >@@ -66,10 +66,9 @@ private: > void didClose(IPC::Connection&) override; > void didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference messageReceiverName, IPC::StringReference messageName) override; > >- void didReceivePaymentProcessProxyMessage(IPC::Connection&, IPC::Decoder&); >- > // Message handlers > void didCreatePaymentToWebProcessConnection(const IPC::Attachment&); >+ void createPaymentToWebProcessConnection(); > > // ProcessLauncher::Client > void didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier) override; >diff --git a/Source/WebKit/UIProcess/WebProcessPool.cpp b/Source/WebKit/UIProcess/WebProcessPool.cpp >index 651020623a7ea6511b073366130c6569a74def07..c404ffcee71aebd161ab61d71f74ae55ce1c66ee 100644 >--- a/Source/WebKit/UIProcess/WebProcessPool.cpp >+++ b/Source/WebKit/UIProcess/WebProcessPool.cpp >@@ -331,6 +331,9 @@ WebProcessPool::~WebProcessPool() > > if (m_networkProcess) > m_networkProcess->shutDownProcess(); >+ >+ if (m_paymentProcess) >+ m_paymentProcess->shutDownProcess(); > > #if ENABLE(GAMEPAD) > if (!m_processesUsingGamepads.isEmpty()) >@@ -630,13 +633,13 @@ void WebProcessPool::ensurePaymentProcess() > m_paymentProcess = std::make_unique<PaymentProcessProxy>(*this); > } > >-void WebProcessPool::getPaymentProcessConnection(WebProcessProxy& webProcessProxy, PAL::SessionID initialSessionID, Messages::WebProcessProxy::GetPaymentProcessConnection::DelayedReply&& reply) >+void WebProcessPool::getPaymentProcessConnection(WebProcessProxy& webProcessProxy, Messages::WebProcessProxy::GetPaymentProcessConnection::DelayedReply&& reply) > { > ensurePaymentProcess(); > m_paymentProcess->getPaymentProcessConnection(webProcessProxy, WTFMove(reply)); > } > >-void WebProcessPool::paymentProcessCrashed(PaymentProcessProxy& paymentProcessProxy) >+void WebProcessPool::paymentProcessCrashed(PaymentProcessProxy* paymentProcessProxy) > { > ASSERT(m_paymentProcess); > ASSERT(paymentProcessProxy == m_paymentProcess.get()); >@@ -730,7 +733,7 @@ void WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled(bool private > } else { > networkProcess()->removeSession(PAL::SessionID::legacyPrivateSessionID()); > #if ENABLE(PAYMENT_PROCESS) >- sendToPaymentProcess(Messages::PaymentProcess::DestroySession(PAL::SessionID::defaultSessionID())); >+// sendToPaymentProcess(Messages::PaymentProcess::DestroySession(PAL::SessionID::defaultSessionID())); > #endif // ENABLE(PAYMENT_PROCESS) > sendToAllProcesses(Messages::WebProcess::DestroySession(PAL::SessionID::legacyPrivateSessionID())); > } >@@ -845,6 +848,9 @@ void WebProcessPool::initializeNewWebProcess(WebProcessProxy& process, WebsiteDa > }); > > ensureNetworkProcess(); >+#if ENABLE(PAYMENT_PROCESS) >+ ensurePaymentProcess(); >+#endif > > WebProcessCreationParameters parameters; > >@@ -1401,6 +1407,14 @@ ProcessID WebProcessPool::paymentProcessIdentifier() > > return m_paymentProcess->processIdentifier(); > } >+#if ENABLE(PAYMENT_PROCESS) >+ProcessID WebProcessPool::paymentProcessIdentifier() >+{ >+ if (!m_paymentProcess) >+ return 0; >+ >+ return m_paymentProcess->processIdentifier(); >+} > #endif // ENABLE(PAYMENT_PROCESS) > > void WebProcessPool::setAlwaysUsesComplexTextCodePath(bool alwaysUseComplexText) >diff --git a/Source/WebKit/UIProcess/WebProcessPool.h b/Source/WebKit/UIProcess/WebProcessPool.h >index 5f70033dadcff0abbc84e733d5643251e4b59815..3461fa34ce74514b1944994895e89d0a374a38b8 100644 >--- a/Source/WebKit/UIProcess/WebProcessPool.h >+++ b/Source/WebKit/UIProcess/WebProcessPool.h >@@ -177,6 +177,7 @@ public: > template<typename T> void sendToNetworkingProcessRelaunchingIfNecessary(T&& message); > > #if ENABLE(PAYMENT_PROCESS) >+ // Sends the message to WebProcess or PaymentProcess as approporiate for current process model. > template<typename T> void sendToPaymentProcess(T&& message); > template<typename T> void sendToPaymentProcessRelaunchingIfNecessary(T&& message); > #endif // ENABLE(PAYMENT_PROCESS) >@@ -361,7 +362,7 @@ public: > #if ENABLE(PAYMENT_PROCESS) > void ensurePaymentProcess(); > PaymentProcessProxy* paymentProcess() { return m_paymentProcess.get(); } >- void getPaymentProcessConnection(WebProcessProxy&, PAL::SessionID initialSessionID, Messages::WebProcessProxy::GetPaymentProcessConnection::DelayedReply&&); >+ void getPaymentProcessConnection(WebProcessProxy&, Messages::WebProcessProxy::GetPaymentProcessConnection::DelayedReply&&); > void paymentProcessCrashed(PaymentProcessProxy*); > #endif // ENABLE(PAYMENT_PROCESS) > #if ENABLE(SERVICE_WORKER) >diff --git a/Source/WebKit/UIProcess/WebProcessProxy.cpp b/Source/WebKit/UIProcess/WebProcessProxy.cpp >index 5cf1c5a486ccb75509f5ff55067d7072abf95f7e..6d76626430af182a750ee3681154bddb3dafd00b 100644 >--- a/Source/WebKit/UIProcess/WebProcessProxy.cpp >+++ b/Source/WebKit/UIProcess/WebProcessProxy.cpp >@@ -632,9 +632,9 @@ void WebProcessProxy::getNetworkProcessConnection(Messages::WebProcessProxy::Get > m_processPool->getNetworkProcessConnection(*this, WTFMove(reply)); > } > #if ENABLE(PAYMENT_PROCESS) >-void WebProcessProxy::getPaymentProcessConnection(PAL::SessionID initialSessionID, Messages::WebProcessProxy::GetPaymentProcessConnection::DelayedReply&& reply) >+void WebProcessProxy::getPaymentProcessConnection(Messages::WebProcessProxy::GetPaymentProcessConnection::DelayedReply&& reply) > { >- m_processPool->getPaymentProcessConnection(*this, initialSessionID, WTFMove(reply)); >+ m_processPool->getPaymentProcessConnection(*this, WTFMove(reply)); > } > #endif // ENABLE(PAYMENT_PROCESS) > >diff --git a/Source/WebKit/UIProcess/WebProcessProxy.h b/Source/WebKit/UIProcess/WebProcessProxy.h >index 229eea377fb5c7a1e7b20659c881c58bc7f4fc7c..529a870fdb30bbcbd1acb7e3c48525fc87916b18 100644 >--- a/Source/WebKit/UIProcess/WebProcessProxy.h >+++ b/Source/WebKit/UIProcess/WebProcessProxy.h >@@ -291,7 +291,7 @@ private: > void getNetworkProcessConnection(Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply&&); > > #if ENABLE(PAYMENT_PROCESS) >- void getPaymentProcessConnection(PAL::SessionID initialSessionID, Messages::WebProcessProxy::GetPaymentProcessConnection::DelayedReply&&); >+ void getPaymentProcessConnection(Messages::WebProcessProxy::GetPaymentProcessConnection::DelayedReply&&); > #endif // ENABLE(PAYMENT_PROCESS) > bool platformIsBeingDebugged() const; > bool shouldAllowNonValidInjectedCode() const; >diff --git a/Source/WebKit/UIProcess/WebProcessProxy.messages.in b/Source/WebKit/UIProcess/WebProcessProxy.messages.in >index 8f5e1d6660b150d75730a63e1f093d43f6a36d27..5a1482790e93c2c15db76751cf15184e9da18b2e 100644 >--- a/Source/WebKit/UIProcess/WebProcessProxy.messages.in >+++ b/Source/WebKit/UIProcess/WebProcessProxy.messages.in >@@ -38,7 +38,7 @@ messages -> WebProcessProxy LegacyReceiver { > #endif > GetNetworkProcessConnection() -> (IPC::Attachment connectionHandle) Delayed > #if ENABLE(PAYMENT_PROCESS) >- GetPaymentProcessConnection(PAL::SessionID initialSessionID) -> (IPC::Attachment connectionHandle) Delayed >+ GetPaymentProcessConnection() -> (IPC::Attachment connectionHandle) Delayed > #endif // ENABLE(PAYMENT_PROCESS) > ProcessReadyToSuspend() > DidCancelProcessSuspension() >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >index b97b9f920de9b5a50e714d4e5b94ed7e480ae0f1..f433dde748e4b8ce69cbfefed285b233b8fa915b 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >@@ -1329,7 +1329,7 @@ void WebsiteDataStore::removeAllStorageAccessHandler(CompletionHandler<void()>&& > void WebsiteDataStore::destroyPaymentProcessSession(WebProcessPool* pool) > { > #if ENABLE(PAYMENT_PROCESS) >- pool->sendToPaymentProcess(Messages::PaymentProcess::DestroySession(m_sessionID)); >+ pool->sendToPaymentProcess(Messages::PaymentProcess::DestroySession()); > #endif // ENABLE(PAYMENT_PROCESS) > } > >@@ -1637,6 +1637,19 @@ void WebsiteDataStore::clearResourceLoadStatisticsInWebProcesses(CompletionHandl > callback(); > } > >+#if ENABLE(PAYMENT_PROCESS) >+PaymentProcessCreationParameters WebsiteDataStore::paymentProcessParameters() >+{ >+ resolveDirectoriesIfNecessary(); >+ >+ PaymentProcessCreationParameters parameters; >+ >+ parameters.sessionID = m_sessionID; >+ >+ return parameters; >+} >+#endif // ENABLE(PAYMENT_PROCESS) >+ > Vector<WebCore::Cookie> WebsiteDataStore::pendingCookies() const > { > return copyToVector(m_pendingCookies); >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >index 7a09071cc61c2d9efa114883e2ce7eafafe5abb9..227c47727385579b8588863be14c03314b096c04 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >@@ -67,6 +67,9 @@ class WebResourceLoadStatisticsStore; > enum class WebsiteDataFetchOption; > enum class WebsiteDataType; > struct MockWebAuthenticationConfiguration; >+#if ENABLE(PAYMENT_PROCESS) >+struct PaymentProcessCreationParameters; >+#endif // ENABLE(PAYMENT_PROCESS) > struct WebsiteDataRecord; > struct WebsiteDataStoreParameters; > >diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >index 75ac6e554056570919631a05504dcedd8657b4c2..d26d2a4691d5e62c24a44f8c6498ec044955cc26 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -20,6 +20,7 @@ > BC77F95616D0459100F8F78A /* PBXTargetDependency */, > BC82844616B4FF6600A278FE /* PBXTargetDependency */, > BC8283D516B4C01F00A278FE /* PBXTargetDependency */, >+ 39E9ECA921B8764200BA5F19 /* PBXTargetDependency */, > ); > name = All; > productName = WebKit2; >@@ -849,7 +850,18 @@ > 37F90DE31376560E0051CF68 /* HTTPCookieAcceptPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = F638954F133BEF38008941D5 /* HTTPCookieAcceptPolicy.h */; }; > 37FC19471850FBF2008CFA47 /* WKBrowsingContextLoadDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 37FC19461850FBF2008CFA47 /* WKBrowsingContextLoadDelegatePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 37FC194B18510D6A008CFA47 /* WKNSURLAuthenticationChallenge.h in Headers */ = {isa = PBXBuildFile; fileRef = 37FC194918510D6A008CFA47 /* WKNSURLAuthenticationChallenge.h */; }; >- 391360252193C1430056492A /* com.apple.WebKit.Payments.sb in Resources */ = {isa = PBXBuildFile; fileRef = 391360242193C1430056492A /* com.apple.WebKit.Payments.sb */; }; >+ 393F259F21C8D46500E4CE85 /* WebToPaymentProcessConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 393F259D21C8D44000E4CE85 /* WebToPaymentProcessConnectionMessageReceiver.cpp */; }; >+ 393F25A021C8D46800E4CE85 /* WebToPaymentProcessConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 393F259E21C8D44100E4CE85 /* WebToPaymentProcessConnectionMessages.h */; }; >+ 395CDC5F21BB45D500766E4D /* PaymentProcessCoordinatorProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 395CDC5E21BB453300766E4D /* PaymentProcessCoordinatorProxyMessages.h */; }; >+ 395CDC6121BB46D700766E4D /* PaymentProcessCoordinatorMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 395CDC6021BB46CD00766E4D /* PaymentProcessCoordinatorMessages.h */; }; >+ 395CDC6421BB5E4E00766E4D /* PaymentProcessCoordinatorMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 395CDC6321BB5E2C00766E4D /* PaymentProcessCoordinatorMessageReceiver.cpp */; }; >+ 395CDC6521BB5E5100766E4D /* PaymentProcessCoordinatorProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 395CDC6221BB5E1B00766E4D /* PaymentProcessCoordinatorProxyMessageReceiver.cpp */; }; >+ 395CDC6D21C47B6800766E4D /* PaymentProcessProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5118E9A71F295963003EF9F5 /* PaymentProcessProxyMessageReceiver.cpp */; }; >+ 395CDC6E21C47C5E00766E4D /* PaymentProcessMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5118E9A51F295963003EF9F5 /* PaymentProcessMessageReceiver.cpp */; }; >+ 39E9EC9721B75ED700BA5F19 /* XPCServiceMain.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC82839616B47EC400A278FE /* XPCServiceMain.mm */; }; >+ 39E9EC9921B75ED700BA5F19 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3DE46815A91763008D26FC /* Foundation.framework */; }; >+ 39E9EC9A21B75ED700BA5F19 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* WebKit.framework */; }; >+ 39F8E43621B754ED00F2B96C /* com.apple.WebKit.Payments.sb in CopyFiles */ = {isa = PBXBuildFile; fileRef = 391360242193C1430056492A /* com.apple.WebKit.Payments.sb */; }; > 3F418EF91887BD97002795FD /* VideoFullscreenManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3F418EF51887BD97002795FD /* VideoFullscreenManagerMessageReceiver.cpp */; }; > 3F418EFB1887BD97002795FD /* VideoFullscreenManagerProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3F418EF71887BD97002795FD /* VideoFullscreenManagerProxyMessageReceiver.cpp */; }; > 3F87B9BE158940190090FF62 /* WebColorChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F87B9BB15893F630090FF62 /* WebColorChooser.h */; }; >@@ -909,9 +921,7 @@ > 510F59111DDE297000412FF5 /* _WKLinkIconParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C0C9791DDD78540032CAD3 /* _WKLinkIconParameters.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 510FBB9B1288C95E00AFFDF4 /* WebContextMenuItemData.h in Headers */ = {isa = PBXBuildFile; fileRef = 510FBB991288C95E00AFFDF4 /* WebContextMenuItemData.h */; }; > 5110AE0D133C16CB0072717A /* WKIconDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 5110AE0B133C16CB0072717A /* WKIconDatabase.h */; settings = {ATTRIBUTES = (Private, ); }; }; >- 5118E9A81F295977003EF9F5 /* PaymentProcessMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5118E9A51F295963003EF9F5 /* PaymentProcessMessageReceiver.cpp */; }; > 5118E9A91F295977003EF9F5 /* PaymentProcessMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 5118E9A61F295963003EF9F5 /* PaymentProcessMessages.h */; }; >- 5118E9AA1F295977003EF9F5 /* PaymentProcessProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5118E9A71F295963003EF9F5 /* PaymentProcessProxyMessageReceiver.cpp */; }; > 5118E9AB1F295977003EF9F5 /* PaymentProcessProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 5118E9A21F295963003EF9F5 /* PaymentProcessProxyMessages.h */; }; > 511F7D411EB1BCF500E47B83 /* WebsiteDataStoreParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 511F7D401EB1BCEE00E47B83 /* WebsiteDataStoreParameters.h */; }; > 511F8A7B138B460900A95F44 /* SecItemShimLibrary.h in Headers */ = {isa = PBXBuildFile; fileRef = 511F8A77138B460900A95F44 /* SecItemShimLibrary.h */; }; >@@ -992,8 +1002,6 @@ > 51DD9F2816367DA2001578E9 /* NetworkConnectionToWebProcessMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51DD9F2616367DA2001578E9 /* NetworkConnectionToWebProcessMessageReceiver.cpp */; }; > 51DD9F2916367DA2001578E9 /* NetworkConnectionToWebProcessMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 51DD9F2716367DA2001578E9 /* NetworkConnectionToWebProcessMessages.h */; }; > 51E351CB180F2CCC00E53BE9 /* IDBUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E351C9180F2CCC00E53BE9 /* IDBUtilities.h */; }; >- 51E351FF180F5D0F00E53BE9 /* PaymentProcess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51E351FA180F5D0B00E53BE9 /* PaymentProcess.cpp */; }; >- 51E35200180F5D0F00E53BE9 /* PaymentToWebProcessConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51E351FD180F5D0B00E53BE9 /* PaymentToWebProcessConnection.cpp */; }; > 51E6C1641F2935DD00FD3437 /* ResourceLoadStatisticsPersistentStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E6C1611F2935CD00FD3437 /* ResourceLoadStatisticsPersistentStorage.h */; }; > 51EFC1CF1524E62500C9A938 /* WKBundleDOMWindowExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FA2D541521118600C1BA0B /* WKBundleDOMWindowExtension.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 51F060E01654317F00F3281B /* WebResourceLoaderMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F060DE1654317500F3281B /* WebResourceLoaderMessages.h */; }; >@@ -1576,7 +1584,6 @@ > D3B9484711FF4B6500032B39 /* WebPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = D3B9484311FF4B6500032B39 /* WebPopupMenu.h */; }; > D3B9484911FF4B6500032B39 /* WebSearchPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = D3B9484511FF4B6500032B39 /* WebSearchPopupMenu.h */; }; > E105FE5418D7B9DE008F57A8 /* EditingRange.h in Headers */ = {isa = PBXBuildFile; fileRef = E105FE5318D7B9DE008F57A8 /* EditingRange.h */; }; >- E115C714190F89E400ECC516 /* PaymentProcessIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1FEF39C190F791C00731658 /* PaymentProcessIOS.mm */; }; > E11D35AE16B63D1B006D23D7 /* com.apple.WebProcess.sb in Resources */ = {isa = PBXBuildFile; fileRef = E1967E37150AB5E200C73169 /* com.apple.WebProcess.sb */; }; > E14A954A16E016A40068DE82 /* NetworkProcessPlatformStrategies.h in Headers */ = {isa = PBXBuildFile; fileRef = E14A954816E016A40068DE82 /* NetworkProcessPlatformStrategies.h */; }; > E1513C67166EABB200149FCB /* ChildProcessProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = E1513C65166EABB200149FCB /* ChildProcessProxy.h */; }; >@@ -1704,6 +1711,27 @@ > remoteGlobalIDString = C0CE72851247E66800BC0EC4; > remoteInfo = "Derived Sources"; > }; >+ 39E9EC9221B75ED700BA5F19 /* PBXContainerItemProxy */ = { >+ isa = PBXContainerItemProxy; >+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; >+ proxyType = 1; >+ remoteGlobalIDString = E1AC2E2720F7B94C00B0897D; >+ remoteInfo = "Unlock Keychain"; >+ }; >+ 39E9EC9421B75ED700BA5F19 /* PBXContainerItemProxy */ = { >+ isa = PBXContainerItemProxy; >+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; >+ proxyType = 1; >+ remoteGlobalIDString = 8DC2EF4F0486A6940098B216; >+ remoteInfo = WebKit; >+ }; >+ 39E9ECA821B8764200BA5F19 /* PBXContainerItemProxy */ = { >+ isa = PBXContainerItemProxy; >+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; >+ proxyType = 1; >+ remoteGlobalIDString = 39E9EC9021B75ED700BA5F19; >+ remoteInfo = Payments; >+ }; > BC77F95516D0459100F8F78A /* PBXContainerItemProxy */ = { > isa = PBXContainerItemProxy; > containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; >@@ -1852,6 +1880,7 @@ > dstSubfolderSpec = 0; > files = ( > A78CCDDB193AC9F8005ECC25 /* com.apple.WebKit.Networking.sb in CopyFiles */, >+ 39F8E43621B754ED00F2B96C /* com.apple.WebKit.Payments.sb in CopyFiles */, > A78CCDDC193AC9FB005ECC25 /* com.apple.WebKit.WebContent.sb in CopyFiles */, > ); > runOnlyForDeploymentPostprocessing = 0; >@@ -2994,10 +3023,29 @@ > 37FC194818510D6A008CFA47 /* WKNSURLAuthenticationChallenge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSURLAuthenticationChallenge.mm; sourceTree = "<group>"; }; > 37FC194918510D6A008CFA47 /* WKNSURLAuthenticationChallenge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNSURLAuthenticationChallenge.h; sourceTree = "<group>"; }; > 391360242193C1430056492A /* com.apple.WebKit.Payments.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.apple.WebKit.Payments.sb; sourceTree = "<group>"; }; >- 392E942B219A399A0050F982 /* WebToPaymentProcessConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebToPaymentProcessConnection.h; sourceTree = "<group>"; }; >- 392E942D219A399A0050F982 /* WebToPaymentProcessConnection.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebToPaymentProcessConnection.cpp; sourceTree = "<group>"; }; >+ 393F259D21C8D44000E4CE85 /* WebToPaymentProcessConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = WebToPaymentProcessConnectionMessageReceiver.cpp; path = DerivedSources/WebKit2/WebToPaymentProcessConnectionMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; >+ 393F259E21C8D44100E4CE85 /* WebToPaymentProcessConnectionMessages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WebToPaymentProcessConnectionMessages.h; path = DerivedSources/WebKit2/WebToPaymentProcessConnectionMessages.h; sourceTree = BUILT_PRODUCTS_DIR; }; >+ 395CDC4B21BA1FAD00766E4D /* PaymentProcessCoordinator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaymentProcessCoordinator.h; sourceTree = "<group>"; }; >+ 395CDC4C21BA1FAD00766E4D /* PaymentProcessCoordinator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PaymentProcessCoordinator.cpp; sourceTree = "<group>"; }; >+ 395CDC4F21BB0B0600766E4D /* PaymentProcessCoordinatorProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaymentProcessCoordinatorProxy.h; sourceTree = "<group>"; }; >+ 395CDC5021BB0B0600766E4D /* PaymentProcessCoordinatorProxy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PaymentProcessCoordinatorProxy.cpp; sourceTree = "<group>"; }; >+ 395CDC5121BB30D700766E4D /* PaymentProcessCoordinatorProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = PaymentProcessCoordinatorProxy.messages.in; sourceTree = "<group>"; }; >+ 395CDC5321BB33A600766E4D /* PaymentProcessCoordinator.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = PaymentProcessCoordinator.messages.in; sourceTree = "<group>"; }; >+ 395CDC5E21BB453300766E4D /* PaymentProcessCoordinatorProxyMessages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PaymentProcessCoordinatorProxyMessages.h; path = DerivedSources/WebKit2/PaymentProcessCoordinatorProxyMessages.h; sourceTree = BUILT_PRODUCTS_DIR; }; >+ 395CDC6021BB46CD00766E4D /* PaymentProcessCoordinatorMessages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PaymentProcessCoordinatorMessages.h; path = DerivedSources/WebKit2/PaymentProcessCoordinatorMessages.h; sourceTree = BUILT_PRODUCTS_DIR; }; >+ 395CDC6221BB5E1B00766E4D /* PaymentProcessCoordinatorProxyMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = PaymentProcessCoordinatorProxyMessageReceiver.cpp; path = DerivedSources/WebKit2/PaymentProcessCoordinatorProxyMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; >+ 395CDC6321BB5E2C00766E4D /* PaymentProcessCoordinatorMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = PaymentProcessCoordinatorMessageReceiver.cpp; path = DerivedSources/WebKit2/PaymentProcessCoordinatorMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; >+ 395CDC6721C19FE000766E4D /* WebToPaymentProcessConnection.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebToPaymentProcessConnection.messages.in; sourceTree = "<group>"; }; >+ 395CDC6821C1DDC900766E4D /* PaymentProcessCoordinatorProxyIOS.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PaymentProcessCoordinatorProxyIOS.mm; sourceTree = "<group>"; }; >+ 395CDC6921C1DDD400766E4D /* PaymentProcessCoordinatorProxyCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PaymentProcessCoordinatorProxyCocoa.mm; sourceTree = "<group>"; }; >+ 395CDC6A21C1DDE200766E4D /* PaymentProcessCoordinatorProxyCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaymentProcessCoordinatorProxyCocoa.h; sourceTree = "<group>"; }; > 39BD0AF521AE202E00E3243F /* Info-iOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = "<group>"; }; > 39BD0AF621AE202E00E3243F /* PaymentServiceEntryPoint.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PaymentServiceEntryPoint.mm; sourceTree = "<group>"; }; >+ 39BD0AFA21AF412A00E3243F /* WebToPaymentProcessConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebToPaymentProcessConnection.h; sourceTree = "<group>"; }; >+ 39BD0AFB21AF412A00E3243F /* WebToPaymentProcessConnection.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebToPaymentProcessConnection.cpp; sourceTree = "<group>"; }; >+ 39E9ECA221B75ED700BA5F19 /* com.apple.WebKit.Payments.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = com.apple.WebKit.Payments.xpc; sourceTree = BUILT_PRODUCTS_DIR; }; >+ 39E9ECA421B7688C00BA5F19 /* Payments-iOS-minimalsimulator.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = "Payments-iOS-minimalsimulator.entitlements"; sourceTree = "<group>"; }; >+ 39E9ECA521B7688C00BA5F19 /* Payments-iOS.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = "Payments-iOS.entitlements"; sourceTree = "<group>"; }; > 3F418EF51887BD97002795FD /* VideoFullscreenManagerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VideoFullscreenManagerMessageReceiver.cpp; path = DerivedSources/WebKit2/VideoFullscreenManagerMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; > 3F418EF61887BD97002795FD /* VideoFullscreenManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VideoFullscreenManagerMessages.h; path = DerivedSources/WebKit2/VideoFullscreenManagerMessages.h; sourceTree = BUILT_PRODUCTS_DIR; }; > 3F418EF71887BD97002795FD /* VideoFullscreenManagerProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VideoFullscreenManagerProxyMessageReceiver.cpp; path = DerivedSources/WebKit2/VideoFullscreenManagerProxyMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; >@@ -3148,13 +3196,9 @@ > 510FBB991288C95E00AFFDF4 /* WebContextMenuItemData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuItemData.h; sourceTree = "<group>"; }; > 5110AE0A133C16CB0072717A /* WKIconDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKIconDatabase.cpp; sourceTree = "<group>"; }; > 5110AE0B133C16CB0072717A /* WKIconDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKIconDatabase.h; sourceTree = "<group>"; }; >- 5118E9A21F295963003EF9F5 /* StorageProcessProxyMessages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = StorageProcessProxyMessages.h; path = DerivedSources/WebKit2/StorageProcessProxyMessages.h; sourceTree = BUILT_PRODUCTS_DIR; }; > 5118E9A21F295963003EF9F5 /* PaymentProcessProxyMessages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaymentProcessProxyMessages.h; sourceTree = "<group>"; }; > 5118E9A31F295963003EF9F5 /* StorageToWebProcessConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = StorageToWebProcessConnectionMessageReceiver.cpp; path = DerivedSources/WebKit2/StorageToWebProcessConnectionMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; > 5118E9A41F295963003EF9F5 /* StorageToWebProcessConnectionMessages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = StorageToWebProcessConnectionMessages.h; path = DerivedSources/WebKit2/StorageToWebProcessConnectionMessages.h; sourceTree = BUILT_PRODUCTS_DIR; }; >- 5118E9A51F295963003EF9F5 /* StorageProcessMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = StorageProcessMessageReceiver.cpp; path = DerivedSources/WebKit2/StorageProcessMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; >- 5118E9A61F295963003EF9F5 /* StorageProcessMessages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = StorageProcessMessages.h; path = DerivedSources/WebKit2/StorageProcessMessages.h; sourceTree = BUILT_PRODUCTS_DIR; }; >- 5118E9A71F295963003EF9F5 /* StorageProcessProxyMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = StorageProcessProxyMessageReceiver.cpp; path = DerivedSources/WebKit2/StorageProcessProxyMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; > 5118E9A51F295963003EF9F5 /* PaymentProcessMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PaymentProcessMessageReceiver.cpp; sourceTree = "<group>"; }; > 5118E9A61F295963003EF9F5 /* PaymentProcessMessages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaymentProcessMessages.h; sourceTree = "<group>"; }; > 5118E9A71F295963003EF9F5 /* PaymentProcessProxyMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PaymentProcessProxyMessageReceiver.cpp; sourceTree = "<group>"; }; >@@ -4568,6 +4612,15 @@ > ); > runOnlyForDeploymentPostprocessing = 0; > }; >+ 39E9EC9821B75ED700BA5F19 /* Frameworks */ = { >+ isa = PBXFrameworksBuildPhase; >+ buildActionMask = 2147483647; >+ files = ( >+ 39E9EC9921B75ED700BA5F19 /* Foundation.framework in Frameworks */, >+ 39E9EC9A21B75ED700BA5F19 /* WebKit.framework in Frameworks */, >+ ); >+ runOnlyForDeploymentPostprocessing = 0; >+ }; > 510031EE1379CACB00C8DFE4 /* Frameworks */ = { > isa = PBXFrameworksBuildPhase; > buildActionMask = 2147483647; >@@ -4630,6 +4683,7 @@ > isa = PBXGroup; > children = ( > BC8283B116B4BF7700A278FE /* com.apple.WebKit.Networking.xpc */, >+ 39E9ECA221B75ED700BA5F19 /* com.apple.WebKit.Payments.xpc */, > BC8283F916B4FDDE00A278FE /* com.apple.WebKit.Plugin.32.xpc */, > BC82841F16B4FDF600A278FE /* com.apple.WebKit.Plugin.64.xpc */, > 372EBB462017E64300085064 /* com.apple.WebKit.WebContent.Development.xpc */, >@@ -4861,6 +4915,8 @@ > 41D0FC7D20E43A5100076AE8 /* Network-OSX-sandbox.entitlements */, > 5C7ACFD1218DD8BD004CBB59 /* Network-OSX.entitlements */, > BC8283AB16B4BEAD00A278FE /* NetworkService.xcconfig */, >+ 39E9ECA421B7688C00BA5F19 /* Payments-iOS-minimalsimulator.entitlements */, >+ 39E9ECA521B7688C00BA5F19 /* Payments-iOS.entitlements */, > 51A60B29180CCD9000F3BF50 /* PaymentService.xcconfig */, > A1EDD2DB1884B96400BBFE98 /* PluginProcessShim.xcconfig */, > BC8283F216B4FC5300A278FE /* PluginService.32.xcconfig */, >@@ -6315,15 +6371,6 @@ > path = Resources/mac; > sourceTree = "<group>"; > }; >- 392E942A219A2E850050F982 /* Payments */ = { >- isa = PBXGroup; >- children = ( >- 392E942D219A399A0050F982 /* WebToPaymentProcessConnection.cpp */, >- 392E942B219A399A0050F982 /* WebToPaymentProcessConnection.h */, >- ); >- path = Payments; >- sourceTree = "<unknown>"; >- }; > 39BD0AF121AE202E00E3243F /* EntryPoint */ = { > isa = PBXGroup; > children = ( >@@ -6357,6 +6404,19 @@ > path = PaymentService; > sourceTree = "<group>"; > }; >+ 39BD0AF921AF412A00E3243F /* Payments */ = { >+ isa = PBXGroup; >+ children = ( >+ 395CDC4C21BA1FAD00766E4D /* PaymentProcessCoordinator.cpp */, >+ 395CDC4B21BA1FAD00766E4D /* PaymentProcessCoordinator.h */, >+ 395CDC5321BB33A600766E4D /* PaymentProcessCoordinator.messages.in */, >+ 39BD0AFB21AF412A00E3243F /* WebToPaymentProcessConnection.cpp */, >+ 39BD0AFA21AF412A00E3243F /* WebToPaymentProcessConnection.h */, >+ 395CDC6721C19FE000766E4D /* WebToPaymentProcessConnection.messages.in */, >+ ); >+ path = Payments; >+ sourceTree = "<group>"; >+ }; > 413075971DE84ED70039EC69 /* webrtc */ = { > isa = PBXGroup; > children = ( >@@ -6751,6 +6811,12 @@ > 51E351FA180F5D0B00E53BE9 /* PaymentProcess.cpp */, > 51E351FB180F5D0B00E53BE9 /* PaymentProcess.h */, > 51E351FC180F5D0B00E53BE9 /* PaymentProcess.messages.in */, >+ 395CDC5021BB0B0600766E4D /* PaymentProcessCoordinatorProxy.cpp */, >+ 395CDC4F21BB0B0600766E4D /* PaymentProcessCoordinatorProxy.h */, >+ 395CDC5121BB30D700766E4D /* PaymentProcessCoordinatorProxy.messages.in */, >+ 395CDC6A21C1DDE200766E4D /* PaymentProcessCoordinatorProxyCocoa.h */, >+ 395CDC6921C1DDD400766E4D /* PaymentProcessCoordinatorProxyCocoa.mm */, >+ 395CDC6821C1DDC900766E4D /* PaymentProcessCoordinatorProxyIOS.mm */, > 51E351FD180F5D0B00E53BE9 /* PaymentToWebProcessConnection.cpp */, > 51E351FE180F5D0B00E53BE9 /* PaymentToWebProcessConnection.h */, > 51032F1A180F74F100961BB7 /* PaymentToWebProcessConnection.messages.in */, >@@ -6758,27 +6824,6 @@ > path = PaymentProcess; > sourceTree = "<group>"; > }; >- 539BD5B21DADB0BA00F2E4E1 /* capture */ = { >- isa = PBXGroup; >- children = ( >- 53DEA3651DDE422E00E82648 /* json.hpp */, >- 530258301DCBBD1D00DA89C2 /* NetworkCaptureEvent.cpp */, >- 530258311DCBBD1D00DA89C2 /* NetworkCaptureEvent.h */, >- 530258321DCBBD1D00DA89C2 /* NetworkCaptureLogging.h */, >- 530258331DCBBD1D00DA89C2 /* NetworkCaptureManager.cpp */, >- 530258341DCBBD1D00DA89C2 /* NetworkCaptureManager.h */, >- 530258351DCBBD1D00DA89C2 /* NetworkCaptureRecorder.cpp */, >- 530258361DCBBD1D00DA89C2 /* NetworkCaptureRecorder.h */, >- 530258371DCBBD1D00DA89C2 /* NetworkCaptureReplayer.cpp */, >- 530258381DCBBD1D00DA89C2 /* NetworkCaptureReplayer.h */, >- 5302582E1DCBBD1D00DA89C2 /* NetworkCaptureResource.cpp */, >- 5302582F1DCBBD1D00DA89C2 /* NetworkCaptureResource.h */, >- 530258391DCBBD1D00DA89C2 /* NetworkDataTaskReplay.cpp */, >- 5302583A1DCBBD1D00DA89C2 /* NetworkDataTaskReplay.h */, >- ); >- path = capture; >- sourceTree = "<group>"; >- }; > 570AB8F620AE81AB00B8BE87 /* cocoa */ = { > isa = PBXGroup; > children = ( >@@ -7232,7 +7277,7 @@ > 4A410F4119AF7B27002EBAB5 /* MediaStream */, > 5105B0D2162F7A5E00E27709 /* Network */, > 31099974146C8AA80029DEB9 /* Notifications (User) */, >- 392E942A219A2E850050F982 /* Payments */, >+ 39BD0AF921AF412A00E3243F /* Payments */, > 1A6FB7AA11E64B4900DB1371 /* Plugins */, > 5118E9981F295259003EF9F5 /* Storage */, > 1AAF08AA1926930B00B6390C /* UserContent */, >@@ -8498,6 +8543,19 @@ > 5118E9A61F295963003EF9F5 /* PaymentProcessMessages.h */, > 5118E9A71F295963003EF9F5 /* PaymentProcessProxyMessageReceiver.cpp */, > 5118E9A21F295963003EF9F5 /* PaymentProcessProxyMessages.h */, >+ 395CDC6021BB46CD00766E4D /* PaymentProcessCoordinatorMessages.h */, >+ 395CDC6321BB5E2C00766E4D /* PaymentProcessCoordinatorMessageReceiver.cpp */, >+ 395CDC6021BB46CD00766E4D /* PaymentProcessCoordinatorMessages.h */, >+ 395CDC6221BB5E1B00766E4D /* PaymentProcessCoordinatorProxyMessageReceiver.cpp */, >+ 395CDC5E21BB453300766E4D /* PaymentProcessCoordinatorProxyMessages.h */, >+ 5118E9A51F295963003EF9F5 /* PaymentProcessMessageReceiver.cpp */, >+ 5118E9A51F295963003EF9F5 /* PaymentProcessMessageReceiver.cpp */, >+ 5118E9A61F295963003EF9F5 /* PaymentProcessMessages.h */, >+ 5118E9A61F295963003EF9F5 /* PaymentProcessMessages.h */, >+ 5118E9A71F295963003EF9F5 /* PaymentProcessProxyMessageReceiver.cpp */, >+ 5118E9A71F295963003EF9F5 /* PaymentProcessProxyMessageReceiver.cpp */, >+ 5118E9A21F295963003EF9F5 /* PaymentProcessProxyMessages.h */, >+ 5118E9A21F295963003EF9F5 /* PaymentProcessProxyMessages.h */, > CDA29A241CBEB67A00901CCF /* PlaybackSessionManagerMessageReceiver.cpp */, > CDA29A251CBEB67A00901CCF /* PlaybackSessionManagerMessages.h */, > CDA29A261CBEB67A00901CCF /* PlaybackSessionManagerProxyMessageReceiver.cpp */, >@@ -8536,6 +8594,10 @@ > 5118E9A61F295963003EF9F5 /* StorageProcessMessages.h */, > 5118E9A71F295963003EF9F5 /* StorageProcessProxyMessageReceiver.cpp */, > 5118E9A21F295963003EF9F5 /* StorageProcessProxyMessages.h */, >+ 5118E9A51F295963003EF9F5 /* PaymentProcessMessageReceiver.cpp */, >+ 5118E9A61F295963003EF9F5 /* PaymentProcessMessages.h */, >+ 5118E9A71F295963003EF9F5 /* PaymentProcessProxyMessageReceiver.cpp */, >+ 5118E9A21F295963003EF9F5 /* PaymentProcessProxyMessages.h */, > 5118E9A31F295963003EF9F5 /* StorageToWebProcessConnectionMessageReceiver.cpp */, > 5118E9A41F295963003EF9F5 /* StorageToWebProcessConnectionMessages.h */, > CD491B0B1E732E4D00009066 /* UserMediaCaptureManagerMessageReceiver.cpp */, >@@ -8637,6 +8699,8 @@ > 517A52D61F43A9B600DCDC0A /* WebSWServerConnectionMessages.h */, > 515262BA1FB951310070E579 /* WebSWServerToContextConnectionMessageReceiver.cpp */, > 515262BB1FB951310070E579 /* WebSWServerToContextConnectionMessages.h */, >+ 393F259D21C8D44000E4CE85 /* WebToPaymentProcessConnectionMessageReceiver.cpp */, >+ 393F259E21C8D44100E4CE85 /* WebToPaymentProcessConnectionMessages.h */, > 1AAF08B519269E6D00B6390C /* WebUserContentControllerMessageReceiver.cpp */, > 1AAF08B619269E6D00B6390C /* WebUserContentControllerMessages.h */, > 7C361D76192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp */, >@@ -9290,6 +9354,8 @@ > 1AC7537C183A9FDB0072CB15 /* PageLoadState.h in Headers */, > 1A8B66B01BC43C860082DF77 /* PageLoadStateObserver.h in Headers */, > C574A58112E66681002DFE98 /* PasteboardTypes.h in Headers */, >+ 395CDC6121BB46D700766E4D /* PaymentProcessCoordinatorMessages.h in Headers */, >+ 395CDC5F21BB45D500766E4D /* PaymentProcessCoordinatorProxyMessages.h in Headers */, > 5118E9A91F295977003EF9F5 /* PaymentProcessMessages.h in Headers */, > 517DD5BF180DA7D30081660B /* PaymentProcessProxy.h in Headers */, > 5118E9AB1F295977003EF9F5 /* PaymentProcessProxyMessages.h in Headers */, >@@ -9652,6 +9718,7 @@ > 9356F2DD2152B6F600E6D5DF /* WebSWServerConnection.h in Headers */, > 517A52D91F43A9DA00DCDC0A /* WebSWServerConnectionMessages.h in Headers */, > 515262BC1FB9515D0070E579 /* WebSWServerToContextConnectionMessages.h in Headers */, >+ 393F25A021C8D46800E4CE85 /* WebToPaymentProcessConnectionMessages.h in Headers */, > BCA0EF7F12331E78007D3CFB /* WebUndoStep.h in Headers */, > 1AAF08AE1926936700B6390C /* WebUserContentController.h in Headers */, > 7C065F2C1C8CD95F00C2D950 /* WebUserContentControllerDataTypes.h in Headers */, >@@ -10088,6 +10155,28 @@ > productReference = 372EBB462017E64300085064 /* com.apple.WebKit.WebContent.Development.xpc */; > productType = "com.apple.product-type.xpc-service"; > }; >+ 39E9EC9021B75ED700BA5F19 /* Payments */ = { >+ isa = PBXNativeTarget; >+ buildConfigurationList = 39E9EC9E21B75ED700BA5F19 /* Build configuration list for PBXNativeTarget "Payments" */; >+ buildPhases = ( >+ 39E9EC9521B75ED700BA5F19 /* Remove stale entitlements file */, >+ 39E9EC9621B75ED700BA5F19 /* Sources */, >+ 39E9EC9821B75ED700BA5F19 /* Frameworks */, >+ 39E9EC9B21B75ED700BA5F19 /* Resources */, >+ 39E9EC9C21B75ED700BA5F19 /* Unlock keychain */, >+ 39E9EC9D21B75ED700BA5F19 /* Process Payment entitlements */, >+ ); >+ buildRules = ( >+ ); >+ dependencies = ( >+ 39E9EC9121B75ED700BA5F19 /* PBXTargetDependency */, >+ 39E9EC9321B75ED700BA5F19 /* PBXTargetDependency */, >+ ); >+ name = Payments; >+ productName = Payments; >+ productReference = 39E9ECA221B75ED700BA5F19 /* com.apple.WebKit.Payments.xpc */; >+ productType = "com.apple.product-type.xpc-service"; >+ }; > 510031EA1379CACB00C8DFE4 /* SecItemShim */ = { > isa = PBXNativeTarget; > buildConfigurationList = 510031F21379CACB00C8DFE4 /* Build configuration list for PBXNativeTarget "SecItemShim" */; >@@ -10268,6 +10357,7 @@ > BC3DE46515A91763008D26FC /* WebContent */, > 372EBB382017E64300085064 /* WebContent.Development */, > BC8283B016B4BF7700A278FE /* Networking */, >+ 39E9EC9021B75ED700BA5F19 /* Payments */, > BC8283F816B4FDDE00A278FE /* Plugin.32 */, > BC82841E16B4FDF600A278FE /* Plugin.64 */, > A7AADA1019395CA9003EA1C7 /* Sandbox Profiles */, >@@ -10285,12 +10375,18 @@ > ); > runOnlyForDeploymentPostprocessing = 0; > }; >+ 39E9EC9B21B75ED700BA5F19 /* Resources */ = { >+ isa = PBXResourcesBuildPhase; >+ buildActionMask = 2147483647; >+ files = ( >+ ); >+ runOnlyForDeploymentPostprocessing = 0; >+ }; > 8DC2EF520486A6940098B216 /* Resources */ = { > isa = PBXResourcesBuildPhase; > buildActionMask = 2147483647; > files = ( > E17AE2C316B9C63A001C42F1 /* com.apple.WebKit.NetworkProcess.sb in Resources */, >- 391360252193C1430056492A /* com.apple.WebKit.Payments.sb in Resources */, > E11D35AE16B63D1B006D23D7 /* com.apple.WebProcess.sb in Resources */, > 414DD37920BF43F5006959FB /* com.cisco.webex.plugin.gpc64.sb in Resources */, > 6BE969C11E54D452008B7483 /* corePrediction_model in Resources */, >@@ -10516,6 +10612,49 @@ > shellPath = /bin/sh; > shellScript = "if [[ \"${WK_MANUAL_SANDBOXING_ENABLED}\" != \"YES\" || \"${WK_PLATFORM_NAME}\" == \"macosx\" || \"${WK_PLATFORM_NAME}\" == \"iosmac\" ]]; then\n exit\nfi\n\nif [[ \"${ACTION}\" == \"build\" || \"${ACTION}\" == \"install\" ]]; then\n for ((i = 0; i < ${SCRIPT_INPUT_FILE_COUNT}; ++i)); do\n eval SANDBOX_PROFILE=\\${SCRIPT_INPUT_FILE_${i}}\n ditto \"${SANDBOX_PROFILE}\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/${SANDBOX_PROFILE##*/}\"\n done\nfi\n"; > }; >+ 39E9EC9521B75ED700BA5F19 /* Remove stale entitlements file */ = { >+ isa = PBXShellScriptBuildPhase; >+ buildActionMask = 2147483647; >+ files = ( >+ ); >+ inputPaths = ( >+ ); >+ name = "Remove stale entitlements file"; >+ outputPaths = ( >+ ); >+ runOnlyForDeploymentPostprocessing = 0; >+ shellPath = /bin/sh; >+ shellScript = "# We autogenerate this file, so don't want to retain an old copy during builds.\nrm -f ${TEMP_FILE_DIR}/${FULL_PRODUCT_NAME}.xcent\n"; >+ }; >+ 39E9EC9C21B75ED700BA5F19 /* Unlock keychain */ = { >+ isa = PBXShellScriptBuildPhase; >+ buildActionMask = 2147483647; >+ files = ( >+ ); >+ inputPaths = ( >+ ); >+ name = "Unlock keychain"; >+ outputPaths = ( >+ ); >+ runOnlyForDeploymentPostprocessing = 0; >+ shellPath = /bin/sh; >+ shellScript = "UNLOCK_SCRIPT_PATH=\"${SRCROOT}/../../../Internal/Tools/Scripts/unlock-safari-engineering-keychain-if-needed\"\n\n[[ -x \"${UNLOCK_SCRIPT_PATH}\" ]] && exec \"${UNLOCK_SCRIPT_PATH}\"\n\nexit 0\n"; >+ }; >+ 39E9EC9D21B75ED700BA5F19 /* Process Payment entitlements */ = { >+ isa = PBXShellScriptBuildPhase; >+ buildActionMask = 2147483647; >+ files = ( >+ ); >+ inputPaths = ( >+ ); >+ name = "Process Payment entitlements"; >+ outputPaths = ( >+ ); >+ runOnlyForDeploymentPostprocessing = 0; >+ shellPath = /bin/sh; >+ shellScript = " >+"; >+ }; > 4157853721279CC600DD3800 /* Copy Custom WebContent Resources to Framework Private Headers */ = { > isa = PBXShellScriptBuildPhase; > buildActionMask = 2147483647; >@@ -10768,6 +10907,7 @@ > "$(BUILT_PRODUCTS_DIR)/com.apple.WebKit.Plugin.64.xpc", > "$(BUILT_PRODUCTS_DIR)/$(WK_STORAGE_SERVICE_PRODUCT_NAME).xpc", > "$(BUILT_PRODUCTS_DIR)/com.apple.WebKit.WebContent.Development.xpc", >+ "$(BUILT_PRODUCTS_DIR)/com.apple.WebKit.Payments.xpc", > ); > name = "Copy XPC services for engineering builds"; > outputPaths = ( >@@ -10777,10 +10917,11 @@ > "$(BUILT_PRODUCTS_DIR)/WebKit.framework/XPCServices/com.apple.WebKit.Plugin.64.xpc", > "$(BUILT_PRODUCTS_DIR)/WebKit.framework/XPCServices/$(WK_STORAGE_SERVICE_PRODUCT_NAME).xpc", > "$(BUILT_PRODUCTS_DIR)/WebKit.framework/XPCServices/com.apple.WebKit.WebContent.Development.xpc", >+ "$(BUILT_PRODUCTS_DIR)/WebKit.framework/XPCServices/com.apple.WebKit.Payments.xpc", > ); > runOnlyForDeploymentPostprocessing = 0; > shellPath = /bin/sh; >- shellScript = "if [[ \"${CONFIGURATION}\" == \"Production\" ]]; then\n exit\nfi\n\nif [[ ${WK_PLATFORM_NAME} != \"macosx\" ]]; then\n XPC_SERVICES_PATH=\"${BUILT_PRODUCTS_DIR}/WebKit.framework/XPCServices\"\nelse\n XPC_SERVICES_PATH=\"${BUILT_PRODUCTS_DIR}/WebKit.framework/Versions/A/XPCServices\"\nfi\n\nmkdir -p \"${XPC_SERVICES_PATH}\"\nditto \"${BUILT_PRODUCTS_DIR}/com.apple.WebKit.WebContent.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.WebContent.xpc\"\nditto \"${BUILT_PRODUCTS_DIR}/com.apple.WebKit.Networking.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.Networking.xpc\"\nditto \"${BUILT_PRODUCTS_DIR}/${WK_STORAGE_SERVICE_PRODUCT_NAME}.xpc\" \"${XPC_SERVICES_PATH}/${WK_STORAGE_SERVICE_PRODUCT_NAME}.xpc\"\n\nif [[ ${WK_PLATFORM_NAME} == macosx ]]; then\n ditto \"${BUILT_PRODUCTS_DIR}/com.apple.WebKit.Plugin.32.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.Plugin.xpc\"\n ditto \"${BUILT_PRODUCTS_DIR}/com.apple.WebKit.Plugin.64.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.Plugin.64.xpc\"\nfi\n"; >+ shellScript = "if [[ \"${CONFIGURATION}\" == \"Production\" ]]; then\n exit\nfi\n\nif [[ ${WK_PLATFORM_NAME} != \"macosx\" ]]; then\n XPC_SERVICES_PATH=\"${BUILT_PRODUCTS_DIR}/WebKit.framework/XPCServices\"\nelse\n XPC_SERVICES_PATH=\"${BUILT_PRODUCTS_DIR}/WebKit.framework/Versions/A/XPCServices\"\nfi\nmkdir -p \"${XPC_SERVICES_PATH}\"\nditto \"${BUILT_PRODUCTS_DIR}/com.apple.WebKit.WebContent.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.WebContent.xpc\"\nditto \"${BUILT_PRODUCTS_DIR}/com.apple.WebKit.Networking.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.Networking.xpc\"\nditto \"${BUILT_PRODUCTS_DIR}/com.apple.WebKit.Payments.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.Payments.xpc\"\n\nditto \"${BUILT_PRODUCTS_DIR}/${WK_STORAGE_SERVICE_PRODUCT_NAME}.xpc\" \"${XPC_SERVICES_PATH}/${WK_STORAGE_SERVICE_PRODUCT_NAME}.xpc\"\n\nif [[ ${WK_PLATFORM_NAME} == macosx ]]; then\n ditto \"${BUILT_PRODUCTS_DIR}/com.apple.WebKit.Plugin.32.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.Plugin.xpc\"\n ditto \"${BUILT_PRODUCTS_DIR}/com.apple.WebKit.Plugin.64.xpc\" \"${XPC_SERVICES_PATH}/com.apple.WebKit.Plugin.64.xpc\"\nfi\n"; > }; > C0CE72841247E66800BC0EC4 /* Generate Derived Sources */ = { > isa = PBXShellScriptBuildPhase; >@@ -10829,6 +10970,14 @@ > ); > runOnlyForDeploymentPostprocessing = 0; > }; >+ 39E9EC9621B75ED700BA5F19 /* Sources */ = { >+ isa = PBXSourcesBuildPhase; >+ buildActionMask = 2147483647; >+ files = ( >+ 39E9EC9721B75ED700BA5F19 /* XPCServiceMain.mm in Sources */, >+ ); >+ runOnlyForDeploymentPostprocessing = 0; >+ }; > 510031EC1379CACB00C8DFE4 /* Sources */ = { > isa = PBXSourcesBuildPhase; > buildActionMask = 2147483647; >@@ -10897,11 +11046,10 @@ > 2D913447212CF9F000128AFD /* NPRuntimeObjectMap.cpp in Sources */, > 2D913448212CF9F000128AFD /* NPRuntimeUtilities.cpp in Sources */, > 2D92A794212B6AD400F493FD /* NPVariantData.cpp in Sources */, >- 51E351FF180F5D0F00E53BE9 /* PaymentProcess.cpp in Sources */, >- E115C714190F89E400ECC516 /* PaymentProcessIOS.mm in Sources */, >- 5118E9A81F295977003EF9F5 /* PaymentProcessMessageReceiver.cpp in Sources */, >- 5118E9AA1F295977003EF9F5 /* PaymentProcessProxyMessageReceiver.cpp in Sources */, >- 51E35200180F5D0F00E53BE9 /* PaymentToWebProcessConnection.cpp in Sources */, >+ 395CDC6421BB5E4E00766E4D /* PaymentProcessCoordinatorMessageReceiver.cpp in Sources */, >+ 395CDC6521BB5E5100766E4D /* PaymentProcessCoordinatorProxyMessageReceiver.cpp in Sources */, >+ 395CDC6E21C47C5E00766E4D /* PaymentProcessMessageReceiver.cpp in Sources */, >+ 395CDC6D21C47B6800766E4D /* PaymentProcessProxyMessageReceiver.cpp in Sources */, > CDA29A281CBEB67A00901CCF /* PlaybackSessionManagerMessageReceiver.cpp in Sources */, > CDA29A2A1CBEB67A00901CCF /* PlaybackSessionManagerProxyMessageReceiver.cpp in Sources */, > 2D913449212CF9F000128AFD /* Plugin.cpp in Sources */, >@@ -11185,6 +11333,7 @@ > 517A52D81F43A9DA00DCDC0A /* WebSWServerConnectionMessageReceiver.cpp in Sources */, > 9356F2E02152B75200E6D5DF /* WebSWServerToContextConnection.cpp in Sources */, > 515262BD1FB951610070E579 /* WebSWServerToContextConnectionMessageReceiver.cpp in Sources */, >+ 393F259F21C8D46500E4CE85 /* WebToPaymentProcessConnectionMessageReceiver.cpp in Sources */, > 2D92A78E212B6AB100F493FD /* WebTouchEvent.cpp in Sources */, > 1AAF08B719269E6D00B6390C /* WebUserContentControllerMessageReceiver.cpp in Sources */, > 7C361D78192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp in Sources */, >@@ -11283,6 +11432,21 @@ > target = C0CE72851247E66800BC0EC4 /* Derived Sources */; > targetProxy = 37F7407812721F740093869B /* PBXContainerItemProxy */; > }; >+ 39E9EC9121B75ED700BA5F19 /* PBXTargetDependency */ = { >+ isa = PBXTargetDependency; >+ target = E1AC2E2720F7B94C00B0897D /* Unlock Keychain */; >+ targetProxy = 39E9EC9221B75ED700BA5F19 /* PBXContainerItemProxy */; >+ }; >+ 39E9EC9321B75ED700BA5F19 /* PBXTargetDependency */ = { >+ isa = PBXTargetDependency; >+ target = 8DC2EF4F0486A6940098B216 /* WebKit */; >+ targetProxy = 39E9EC9421B75ED700BA5F19 /* PBXContainerItemProxy */; >+ }; >+ 39E9ECA921B8764200BA5F19 /* PBXTargetDependency */ = { >+ isa = PBXTargetDependency; >+ target = 39E9EC9021B75ED700BA5F19 /* Payments */; >+ targetProxy = 39E9ECA821B8764200BA5F19 /* PBXContainerItemProxy */; >+ }; > BC77F95616D0459100F8F78A /* PBXTargetDependency */ = { > isa = PBXTargetDependency; > target = BC8283F816B4FDDE00A278FE /* Plugin.32 */; >@@ -11477,6 +11641,63 @@ > }; > name = Production; > }; >+ 39E9EC9F21B75ED700BA5F19 /* Debug */ = { >+ isa = XCBuildConfiguration; >+ baseConfigurationReference = 51A60B29180CCD9000F3BF50 /* PaymentService.xcconfig */; >+ buildSettings = { >+ CODE_SIGN_ENTITLEMENTS_COCOA_TOUCH_NO = "Configurations/Payments-iOS.entitlements"; >+ INFOPLIST_FILE = "PaymentProcess/EntryPoint/ios/XPCService/PaymentService/Info-iOS.plist"; >+ "INFOPLIST_FILE[sdk=iphone*]" = "PaymentProcess/EntryPoint/ios/XPCService/PaymentService/Info-iOS.plist"; >+ "INFOPLIST_FILE[sdk=macosx*]" = "PaymentProcess/EntryPoint/ios/XPCService/PaymentService/Info-iOS.plist"; >+ PRODUCT_BUNDLE_IDENTIFIER = com.apple.WebKit.Payments; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_appletvos = "Payments-iOS"; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_appletvsimulator = "Payments-iOS"; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_iosmac = "Payments-iOS-minimalsimulator"; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_iphoneos = "Payments-iOS"; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_iphonesimulator = "Payments-iOS"; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_watchos = "Payments-iOS"; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_watchsimulator = "Payments-iOS"; >+ }; >+ name = Debug; >+ }; >+ 39E9ECA021B75ED700BA5F19 /* Release */ = { >+ isa = XCBuildConfiguration; >+ baseConfigurationReference = 51A60B29180CCD9000F3BF50 /* PaymentService.xcconfig */; >+ buildSettings = { >+ CODE_SIGN_ENTITLEMENTS_COCOA_TOUCH_NO = "Configurations/Payments-iOS.entitlements"; >+ INFOPLIST_FILE = "PaymentProcess/EntryPoint/ios/XPCService/PaymentService/Info-iOS.plist"; >+ "INFOPLIST_FILE[sdk=iphone*]" = "PaymentProcess/EntryPoint/ios/XPCService/PaymentService/Info-iOS.plist"; >+ "INFOPLIST_FILE[sdk=macosx*]" = "PaymentProcess/EntryPoint/ios/XPCService/PaymentService/Info-iOS.plist"; >+ PRODUCT_BUNDLE_IDENTIFIER = com.apple.WebKit.Payments; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_appletvos = "Payments-iOS"; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_appletvsimulator = "Payments-iOS"; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_iosmac = "Payments-iOS-minimalsimulator"; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_iphoneos = "Payments-iOS"; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_iphonesimulator = "Payments-iOS"; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_watchos = "Payments-iOS"; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_watchsimulator = "Payments-iOS"; >+ }; >+ name = Release; >+ }; >+ 39E9ECA121B75ED700BA5F19 /* Production */ = { >+ isa = XCBuildConfiguration; >+ baseConfigurationReference = 51A60B29180CCD9000F3BF50 /* PaymentService.xcconfig */; >+ buildSettings = { >+ CODE_SIGN_ENTITLEMENTS_COCOA_TOUCH_NO = "Configurations/Payments-iOS.entitlements"; >+ INFOPLIST_FILE = "PaymentProcess/EntryPoint/ios/XPCService/PaymentService/Info-iOS.plist"; >+ "INFOPLIST_FILE[sdk=iphone*]" = "PaymentProcess/EntryPoint/ios/XPCService/PaymentService/Info-iOS.plist"; >+ "INFOPLIST_FILE[sdk=macosx*]" = "PaymentProcess/EntryPoint/ios/XPCService/PaymentService/Info-iOS.plist"; >+ PRODUCT_BUNDLE_IDENTIFIER = com.apple.WebKit.Payments; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_appletvos = "Payments-iOS"; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_appletvsimulator = "Payments-iOS"; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_iosmac = "Payments-iOS-minimalsimulator"; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_iphoneos = "Payments-iOS"; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_iphonesimulator = "Payments-iOS"; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_watchos = "Payments-iOS"; >+ WK_XPC_SERVICE_IOS_ENTITLEMENTS_BASE_watchsimulator = "Payments-iOS"; >+ }; >+ name = Production; >+ }; > 510031F31379CACB00C8DFE4 /* Debug */ = { > isa = XCBuildConfiguration; > baseConfigurationReference = A1EDD2DC1884B9B500BBFE98 /* SecItemShim.xcconfig */; >@@ -11748,6 +11969,16 @@ > defaultConfigurationIsVisible = 0; > defaultConfigurationName = Production; > }; >+ 39E9EC9E21B75ED700BA5F19 /* Build configuration list for PBXNativeTarget "Payments" */ = { >+ isa = XCConfigurationList; >+ buildConfigurations = ( >+ 39E9EC9F21B75ED700BA5F19 /* Debug */, >+ 39E9ECA021B75ED700BA5F19 /* Release */, >+ 39E9ECA121B75ED700BA5F19 /* Production */, >+ ); >+ defaultConfigurationIsVisible = 0; >+ defaultConfigurationName = Production; >+ }; > 510031F21379CACB00C8DFE4 /* Build configuration list for PBXNativeTarget "SecItemShim" */ = { > isa = XCConfigurationList; > buildConfigurations = ( >diff --git a/Source/WebKit/WebProcess/Payments/PaymentProcessCoordinator.cpp b/Source/WebKit/WebProcess/Payments/PaymentProcessCoordinator.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..e1bda6bebecef01487cf8bdeb396a73aba4a4ebc >--- /dev/null >+++ b/Source/WebKit/WebProcess/Payments/PaymentProcessCoordinator.cpp >@@ -0,0 +1,237 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "PaymentProcessCoordinator.h" >+ >+#if ENABLE(APPLE_PAY) && ENABLE(PAYMENT_PROCESS) >+ >+#include "DataReference.h" >+#include "PaymentProcessCoordinatorMessages.h" >+#include "PaymentProcessCoordinatorProxyMessages.h" >+#include "WebCoreArgumentCoders.h" >+#include "WebPage.h" >+#include "WebProcess.h" >+#include "WebToPaymentProcessConnection.h" >+#include <WebCore/Frame.h> >+#include <WebCore/PaymentCoordinator.h> >+#include <WebCore/URL.h> >+ >+namespace WebKit { >+ >+PaymentProcessCoordinator::PaymentProcessCoordinator(WebPage& webPage) >+ : m_webPage(webPage) >+{ >+ WebProcess::singleton().addMessageReceiver(Messages::PaymentProcessCoordinator::messageReceiverName(), m_webPage.pageID(), *this); >+} >+ >+PaymentProcessCoordinator::~PaymentProcessCoordinator() >+{ >+ WebProcess::singleton().removeMessageReceiver(*this); >+} >+ >+bool PaymentProcessCoordinator::supportsVersion(unsigned version) >+{ >+ ASSERT(version > 0); >+ >+#if !ENABLE(APPLE_PAY_SESSION_V3) >+ static const unsigned currentVersion = 2; >+#elif !ENABLE(APPLE_PAY_SESSION_V4) >+ static const unsigned currentVersion = 3; >+#else >+ static const unsigned currentVersion = 5; >+#endif >+ >+ return version <= currentVersion; >+} >+ >+const PaymentProcessCoordinator::AvailablePaymentNetworksSet& PaymentProcessCoordinator::availablePaymentNetworks() >+{ >+ if (m_availablePaymentNetworks) >+ return *m_availablePaymentNetworks; >+ >+ m_availablePaymentNetworks = PaymentProcessCoordinator::AvailablePaymentNetworksSet(); >+ >+ Vector<String> availablePaymentNetworks; >+ using AvailablePaymentNetworksMessage = Messages::PaymentProcessCoordinatorProxy::AvailablePaymentNetworks; >+ if (WebProcess::singleton().ensureWebToPaymentProcessConnection().connection().sendSync(AvailablePaymentNetworksMessage(), AvailablePaymentNetworksMessage::Reply(availablePaymentNetworks), 0)) { >+ for (auto& network : availablePaymentNetworks) >+ m_availablePaymentNetworks->add(network); >+ } >+ >+ return *m_availablePaymentNetworks; >+} >+ >+std::optional<String> PaymentProcessCoordinator::validatedPaymentNetwork(const String& paymentNetwork) >+{ >+ auto& paymentNetworks = availablePaymentNetworks(); >+ auto result = paymentNetworks.find(paymentNetwork); >+ if (result == paymentNetworks.end()) >+ return std::nullopt; >+ return *result; >+} >+ >+bool PaymentProcessCoordinator::canMakePayments() >+{ >+ bool canMakePayments; >+ if (!WebProcess::singleton().ensureWebToPaymentProcessConnection().connection().sendSync(Messages::PaymentProcessCoordinatorProxy::CanMakePayments(), Messages::PaymentProcessCoordinatorProxy::CanMakePayments::Reply(canMakePayments), 0)) >+ return false; >+ >+ return canMakePayments; >+} >+ >+static uint64_t generateCanMakePaymentsWithActiveCardReplyID() >+{ >+ static uint64_t canMakePaymentsWithActiveCardReplyID; >+ >+ return ++canMakePaymentsWithActiveCardReplyID; >+} >+ >+void PaymentProcessCoordinator::canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void(bool)>&& completionHandler) >+{ >+ auto replyID = generateCanMakePaymentsWithActiveCardReplyID(); >+ >+ m_pendingCanMakePaymentsWithActiveCardCallbacks.add(replyID, WTFMove(completionHandler)); >+ WebProcess::singleton().ensureWebToPaymentProcessConnection().connection().send(Messages::PaymentProcessCoordinatorProxy::CanMakePaymentsWithActiveCard(merchantIdentifier, domainName, replyID), 0); >+} >+ >+static uint64_t generateOpenPaymentSetupReplyID() >+{ >+ static uint64_t openPaymentSetupReplyID; >+ >+ return ++openPaymentSetupReplyID; >+} >+ >+void PaymentProcessCoordinator::openPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void(bool)>&& completionHandler) >+{ >+ auto replyID = generateOpenPaymentSetupReplyID(); >+ >+ m_pendingOpenPaymentSetupCallbacks.add(replyID, WTFMove(completionHandler)); >+ WebProcess::singleton().ensureWebToPaymentProcessConnection().connection().send(Messages::PaymentProcessCoordinatorProxy::OpenPaymentSetup(merchantIdentifier, domainName, replyID), 0); >+} >+ >+bool PaymentProcessCoordinator::showPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest& paymentRequest) >+{ >+ Vector<String> linkIconURLStrings; >+ for (const auto& linkIconURL : linkIconURLs) >+ linkIconURLStrings.append(linkIconURL.string()); >+ >+ bool result; >+ if (!WebProcess::singleton().ensureWebToPaymentProcessConnection().connection().sendSync(Messages::PaymentProcessCoordinatorProxy::ShowPaymentUI(originatingURL.string(), linkIconURLStrings, paymentRequest), Messages::PaymentProcessCoordinatorProxy::ShowPaymentUI::Reply(result), 0)) >+ return false; >+ >+ return result; >+} >+ >+void PaymentProcessCoordinator::completeMerchantValidation(const WebCore::PaymentMerchantSession& paymentMerchantSession) >+{ >+ WebProcess::singleton().ensureWebToPaymentProcessConnection().connection().send(Messages::PaymentProcessCoordinatorProxy::CompleteMerchantValidation(paymentMerchantSession), 0); >+} >+ >+void PaymentProcessCoordinator::completeShippingMethodSelection(std::optional<WebCore::ShippingMethodUpdate>&& update) >+{ >+ WebProcess::singleton().ensureWebToPaymentProcessConnection().connection().send(Messages::PaymentProcessCoordinatorProxy::CompleteShippingMethodSelection(update), 0); >+} >+ >+void PaymentProcessCoordinator::completeShippingContactSelection(std::optional<WebCore::ShippingContactUpdate>&& update) >+{ >+ WebProcess::singleton().ensureWebToPaymentProcessConnection().connection().send(Messages::PaymentProcessCoordinatorProxy::CompleteShippingContactSelection(update), 0); >+} >+ >+void PaymentProcessCoordinator::completePaymentMethodSelection(std::optional<WebCore::PaymentMethodUpdate>&& update) >+{ >+ WebProcess::singleton().ensureWebToPaymentProcessConnection().connection().send(Messages::PaymentProcessCoordinatorProxy::CompletePaymentMethodSelection(update), 0); >+} >+ >+void PaymentProcessCoordinator::completePaymentSession(std::optional<WebCore::PaymentAuthorizationResult>&& result) >+{ >+ WebProcess::singleton().ensureWebToPaymentProcessConnection().connection().send(Messages::PaymentProcessCoordinatorProxy::CompletePaymentSession(result), 0); >+} >+ >+void PaymentProcessCoordinator::abortPaymentSession() >+{ >+ WebProcess::singleton().ensureWebToPaymentProcessConnection().connection().send(Messages::PaymentProcessCoordinatorProxy::AbortPaymentSession(), 0); >+} >+ >+void PaymentProcessCoordinator::cancelPaymentSession() >+{ >+ WebProcess::singleton().ensureWebToPaymentProcessConnection().connection().send(Messages::PaymentProcessCoordinatorProxy::CancelPaymentSession(), 0); >+} >+ >+void PaymentProcessCoordinator::paymentCoordinatorDestroyed() >+{ >+ delete this; >+} >+ >+void PaymentProcessCoordinator::validateMerchant(const String& validationURLString) >+{ >+ paymentProcessCoordinator().validateMerchant(WebCore::URL(WebCore::URL(), validationURLString)); >+} >+ >+void PaymentProcessCoordinator::didAuthorizePayment(const WebCore::Payment& payment) >+{ >+ paymentProcessCoordinator().didAuthorizePayment(payment); >+} >+ >+void PaymentProcessCoordinator::didSelectShippingMethod(const WebCore::ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod) >+{ >+ paymentProcessCoordinator().didSelectShippingMethod(shippingMethod); >+} >+ >+void PaymentProcessCoordinator::didSelectShippingContact(const WebCore::PaymentContact& shippingContact) >+{ >+ paymentProcessCoordinator().didSelectShippingContact(shippingContact); >+} >+ >+void PaymentProcessCoordinator::didSelectPaymentMethod(const WebCore::PaymentMethod& paymentMethod) >+{ >+ paymentProcessCoordinator().didSelectPaymentMethod(paymentMethod); >+} >+ >+void PaymentProcessCoordinator::didCancelPaymentSession() >+{ >+ paymentProcessCoordinator().didCancelPaymentSession(); >+} >+ >+void PaymentProcessCoordinator::canMakePaymentsWithActiveCardReply(uint64_t requestID, bool canMakePayments) >+{ >+ auto callback = m_pendingCanMakePaymentsWithActiveCardCallbacks.take(requestID); >+ callback(canMakePayments); >+} >+ >+void PaymentProcessCoordinator::openPaymentSetupReply(uint64_t requestID, bool result) >+{ >+ auto callback = m_pendingOpenPaymentSetupCallbacks.take(requestID); >+ callback(result); >+} >+ >+WebCore::PaymentCoordinator& PaymentProcessCoordinator::paymentProcessCoordinator() >+{ >+ return m_webPage.corePage()->paymentCoordinator(); >+} >+ >+} >+ >+#endif >diff --git a/Source/WebKit/WebProcess/Payments/PaymentProcessCoordinator.h b/Source/WebKit/WebProcess/Payments/PaymentProcessCoordinator.h >new file mode 100644 >index 0000000000000000000000000000000000000000..2acbbcadf85727f7831d73556ea4c79f4c02ed67 >--- /dev/null >+++ b/Source/WebKit/WebProcess/Payments/PaymentProcessCoordinator.h >@@ -0,0 +1,102 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(APPLE_PAY) && ENABLE(PAYMENT_PROCESS) >+ >+#include "MessageReceiver.h" >+#include <WebCore/PaymentCoordinatorClient.h> >+#include <WebCore/PaymentHeaders.h> >+#include <wtf/Forward.h> >+#include <wtf/HashMap.h> >+#include <wtf/HashSet.h> >+#include <wtf/text/StringHash.h> >+ >+namespace IPC { >+class DataReference; >+} >+ >+namespace WebCore { >+class PaymentCoordinator; >+class PaymentContact; >+} >+ >+namespace WebKit { >+ >+class WebPage; >+ >+class PaymentProcessCoordinator final : public WebCore::PaymentCoordinatorClient, private IPC::MessageReceiver { >+public: >+ explicit PaymentProcessCoordinator(WebPage&); >+ ~PaymentProcessCoordinator(); >+ >+private: >+ // WebCore::PaymentCoordinatorClient. >+ bool supportsVersion(unsigned version) override; >+ std::optional<String> validatedPaymentNetwork(const String&) override; >+ bool canMakePayments() override; >+ void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void(bool)>&& completionHandler) override; >+ void openPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void(bool)>&& completionHandler) override; >+ bool showPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::ApplePaySessionPaymentRequest&) override; >+ void completeMerchantValidation(const WebCore::PaymentMerchantSession&) override; >+ void completeShippingMethodSelection(std::optional<WebCore::ShippingMethodUpdate>&&) override; >+ void completeShippingContactSelection(std::optional<WebCore::ShippingContactUpdate>&&) override; >+ void completePaymentMethodSelection(std::optional<WebCore::PaymentMethodUpdate>&&) override; >+ void completePaymentSession(std::optional<WebCore::PaymentAuthorizationResult>&&) override; >+ >+ void abortPaymentSession() override; >+ void cancelPaymentSession() override; >+ >+ void paymentCoordinatorDestroyed() override; >+ >+ // IPC::MessageReceiver. >+ void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; >+ >+ // Message handlers. >+ void validateMerchant(const String& validationURLString); >+ void didAuthorizePayment(const WebCore::Payment&); >+ void didSelectShippingMethod(const WebCore::ApplePaySessionPaymentRequest::ShippingMethod&); >+ void didSelectShippingContact(const WebCore::PaymentContact&); >+ void didSelectPaymentMethod(const WebCore::PaymentMethod&); >+ void didCancelPaymentSession(); >+ void canMakePaymentsWithActiveCardReply(uint64_t requestID, bool canMakePayments); >+ void openPaymentSetupReply(uint64_t requestID, bool result); >+ >+ WebCore::PaymentCoordinator& paymentProcessCoordinator(); >+ >+ using AvailablePaymentNetworksSet = HashSet<String, ASCIICaseInsensitiveHash>; >+ const AvailablePaymentNetworksSet& availablePaymentNetworks(); >+ >+ WebPage& m_webPage; >+ >+ HashMap<uint64_t, WTF::Function<void(bool)>> m_pendingCanMakePaymentsWithActiveCardCallbacks; >+ HashMap<uint64_t, WTF::Function<void(bool)>> m_pendingOpenPaymentSetupCallbacks; >+ >+ std::optional<AvailablePaymentNetworksSet> m_availablePaymentNetworks; >+}; >+ >+} >+#endif >diff --git a/Source/WebKit/WebProcess/Payments/PaymentProcessCoordinator.messages.in b/Source/WebKit/WebProcess/Payments/PaymentProcessCoordinator.messages.in >new file mode 100644 >index 0000000000000000000000000000000000000000..bae271e86465e1ac7b458a7ea902357b31bd6e7e >--- /dev/null >+++ b/Source/WebKit/WebProcess/Payments/PaymentProcessCoordinator.messages.in >@@ -0,0 +1,39 @@ >+# Copyright (C) 2018 Apple Inc. All rights reserved. >+# >+# Redistribution and use in source and binary forms, with or without >+# modification, are permitted provided that the following conditions >+# are met: >+# 1. Redistributions of source code must retain the above copyright >+# notice, this list of conditions and the following disclaimer. >+# 2. Redistributions in binary form must reproduce the above copyright >+# notice, this list of conditions and the following disclaimer in the >+# documentation and/or other materials provided with the distribution. >+# >+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+# THE POSSIBILITY OF SUCH DAMAGE. >+#/ >+ >+#if ENABLE(APPLE_PAY) && ENABLE(PAYMENT_PROCESS) >+ >+messages -> PaymentProcessCoordinator { >+ >+ ValidateMerchant(String validationURLString) >+ DidAuthorizePayment(WebCore::Payment payment) >+ DidSelectShippingMethod(WebCore::ApplePaySessionPaymentRequest::ShippingMethod shippingMethod) >+ DidSelectShippingContact(WebCore::PaymentContact shippingContact) >+ DidSelectPaymentMethod(WebCore::PaymentMethod paymentMethod) >+ DidCancelPaymentSession() >+ CanMakePaymentsWithActiveCardReply(uint64_t requestID, bool canMakePayments) >+ OpenPaymentSetupReply(uint64_t requestID, bool result) >+} >+ >+#endif >diff --git a/Source/WebKit/WebProcess/Payments/WebToPaymentProcessConnection.cpp b/Source/WebKit/WebProcess/Payments/WebToPaymentProcessConnection.cpp >index a6d0a7b5692b119fc67f427dd479ee18d38163c0..2d4cd2c7d16a444b962b530fd577b4c4aedf5beb 100644 >--- a/Source/WebKit/WebProcess/Payments/WebToPaymentProcessConnection.cpp >+++ b/Source/WebKit/WebProcess/Payments/WebToPaymentProcessConnection.cpp >@@ -23,16 +23,15 @@ > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > * > */ >-#if ENABLE(PAYMENT_PROCESS) > > #include "config.h" > #include "WebToPaymentProcessConnection.h" > >+#if ENABLE(PAYMENT_PROCESS) > >+#include "PaymentProcessCoordinatorMessages.h" > #include "WebProcess.h" > >-#include <WebCore/SWContextManager.h> >- > namespace WebKit { > using namespace PAL; > using namespace WebCore; >@@ -48,17 +47,42 @@ WebToPaymentProcessConnection::~WebToPaymentProcessConnection() > m_connection->invalidate(); > } > >-void WebToPaymentProcessConnection::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder) >+void WebToPaymentProcessConnection::validateMerchant(const String& validationURLString) >+{ >+ UNUSED_PARAM(validationURLString); >+ WebProcess::singleton().webToPaymentProcessConnectionClosed(this); >+ >+} >+ >+void WebToPaymentProcessConnection::didAuthorizePayment(const WebCore::Payment& payment) > { >- ASSERT_NOT_REACHED(); > } > >-void WebToPaymentProcessConnection::didReceiveSyncMessage(IPC::Connection& connection, IPC::Decoder& decoder, std::unique_ptr<IPC::Encoder>& replyEncoder) >+void WebToPaymentProcessConnection::didSelectShippingMethod(const WebCore::ApplePaySessionPaymentRequest::ShippingMethod& shippingMethod) > { >+} > >- ASSERT_NOT_REACHED(); >+void WebToPaymentProcessConnection::didSelectShippingContact(const WebCore::PaymentContact& shippingContact) >+{ > } > >+void WebToPaymentProcessConnection::didSelectPaymentMethod(const WebCore::PaymentMethod& paymentMethod) >+{ >+} >+ >+void WebToPaymentProcessConnection::didCancelPaymentSession() >+{ >+} >+ >+void WebToPaymentProcessConnection::canMakePaymentsWithActiveCardReply(uint64_t requestID, bool canMakePayments) >+{ >+} >+ >+void WebToPaymentProcessConnection::openPaymentSetupReply(uint64_t requestID, bool result) >+{ >+} >+ >+ > void WebToPaymentProcessConnection::didClose(IPC::Connection& connection) > { > auto protectedThis = makeRef(*this); >diff --git a/Source/WebKit/WebProcess/Payments/WebToPaymentProcessConnection.h b/Source/WebKit/WebProcess/Payments/WebToPaymentProcessConnection.h >index a4177f8f2ec7c553877d1fb90426d123c16a620f..9a90527db18a4e35243d95b9542767c5d60686af 100644 >--- a/Source/WebKit/WebProcess/Payments/WebToPaymentProcessConnection.h >+++ b/Source/WebKit/WebProcess/Payments/WebToPaymentProcessConnection.h >@@ -30,17 +30,15 @@ > > #include "Connection.h" > #include "MessageSender.h" >-#include <WebCore/SWServer.h> >-#include <pal/SessionID.h> >+#include <WebCore/ApplePaySessionPaymentRequest.h> >+#include <WebCore/Payment.h> >+#include <WebCore/PaymentContact.h> >+#include <WebCore/PaymentMethod.h> > #include <wtf/RefCounted.h> > >-namespace PAL { >-class SessionID; >-} >- > namespace WebKit { >- >-class WebToPaymentProcessConnection : public RefCounted<WebToPaymentProcessConnection>, private IPC::Connection::Client, private IPC::MessageSender { >+ >+class WebToPaymentProcessConnection : public IPC::Connection::WorkQueueMessageReceiver, IPC::Connection::Client, IPC::MessageSender { > public: > static Ref<WebToPaymentProcessConnection> create(IPC::Connection::Identifier connectionIdentifier) > { >@@ -49,13 +47,22 @@ public: > ~WebToPaymentProcessConnection(); > > IPC::Connection& connection() { return m_connection.get(); } >+ >+ void validateMerchant(const String& validationURLString); >+ void didAuthorizePayment(const WebCore::Payment&); >+ void didSelectShippingMethod(const WebCore::ApplePaySessionPaymentRequest::ShippingMethod&); >+ void didSelectShippingContact(const WebCore::PaymentContact&); >+ void didSelectPaymentMethod(const WebCore::PaymentMethod&); >+ void didCancelPaymentSession(); >+ void canMakePaymentsWithActiveCardReply(uint64_t requestID, bool canMakePayments); >+ void openPaymentSetupReply(uint64_t requestID, bool result); >+ > > private: > WebToPaymentProcessConnection(IPC::Connection::Identifier); > > // IPC::Connection::Client > void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; >- void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override; > void didClose(IPC::Connection&) override; > void didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference messageReceiverName, IPC::StringReference messageName) override; > >diff --git a/Source/WebKit/WebProcess/Payments/WebToPaymentProcessConnection.messages.in b/Source/WebKit/WebProcess/Payments/WebToPaymentProcessConnection.messages.in >new file mode 100644 >index 0000000000000000000000000000000000000000..71899807c603bbe210025f781de420f882a69e6d >--- /dev/null >+++ b/Source/WebKit/WebProcess/Payments/WebToPaymentProcessConnection.messages.in >@@ -0,0 +1,39 @@ >+# Copyright (C) 2018 Apple Inc. All rights reserved. >+# >+# Redistribution and use in source and binary forms, with or without >+# modification, are permitted provided that the following conditions >+# are met: >+# 1. Redistributions of source code must retain the above copyright >+# notice, this list of conditions and the following disclaimer. >+# 2. Redistributions in binary form must reproduce the above copyright >+# notice, this list of conditions and the following disclaimer in the >+# documentation and/or other materials provided with the distribution. >+# >+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+# THE POSSIBILITY OF SUCH DAMAGE. >+#/ >+ >+#if ENABLE(APPLE_PAY) && ENABLE(PAYMENT_PROCESS) >+ >+messages -> WebToPaymentProcessConnection { >+ >+ ValidateMerchant(String validationURLString) >+ DidAuthorizePayment(WebCore::Payment payment) >+ DidSelectShippingMethod(WebCore::ApplePaySessionPaymentRequest::ShippingMethod shippingMethod) >+ DidSelectShippingContact(WebCore::PaymentContact shippingContact) >+ DidSelectPaymentMethod(WebCore::PaymentMethod paymentMethod) >+ DidCancelPaymentSession() >+ CanMakePaymentsWithActiveCardReply(uint64_t requestID, bool canMakePayments) >+ OpenPaymentSetupReply(uint64_t requestID, bool result) >+} >+ >+#endif >diff --git a/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h b/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h >index dcd6da5806bb332c24ffec8518ee5096cbae7f83..b76e3c18559eb00ee2c6c813f24788eef432e881 100644 >--- a/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h >+++ b/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h >@@ -90,6 +90,7 @@ private: > void didResolveRegistrationPromise(const WebCore::ServiceWorkerRegistrationKey&) final; > > void scheduleStorageJob(const WebCore::ServiceWorkerJobData&); >+ void schedulePaymentJob(const WebCore::ServiceWorkerJobData&); > > void runOrDelayTaskForImport(WTF::Function<void()>&& task); > >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index be6befb8147865fc0e81e81223b6c496ab7f1bd5..7aac12e07ab82ce5e7db1a5e88536ea33b9ffae7 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -51,6 +51,7 @@ > #include "NetworkProcessConnection.h" > #include "NotificationPermissionRequestManager.h" > #include "PageBanner.h" >+#include "PaymentProcessCoordinator.h" > #include "PluginProcessAttributes.h" > #include "PluginProxy.h" > #include "PluginView.h" >@@ -453,7 +454,9 @@ WebPage::WebPage(uint64_t pageID, WebPageCreationParameters&& parameters) > pageConfiguration.userContentProvider = m_userContentController.ptr(); > pageConfiguration.visitedLinkStore = VisitedLinkTableController::getOrCreate(parameters.visitedLinkTableID); > >-#if ENABLE(APPLE_PAY) >+#if ENABLE(APPLE_PAY) && ENABLE(PAYMENT_PROCESS) >+ pageConfiguration.paymentCoordinatorClient = new PaymentProcessCoordinator(*this); >+#elif ENABLE(APPLE_PAY) > pageConfiguration.paymentCoordinatorClient = new WebPaymentCoordinator(*this); > #endif > >diff --git a/Source/WebKit/WebProcess/WebProcess.cpp b/Source/WebKit/WebProcess/WebProcess.cpp >index 3315ac29121db1a9d495dbe27171f4556b8f1617..a60d6a20c3805f5b40dfbdad8a5b972f7f61b89d 100644 >--- a/Source/WebKit/WebProcess/WebProcess.cpp >+++ b/Source/WebKit/WebProcess/WebProcess.cpp >@@ -390,6 +390,7 @@ void WebProcess::initializeWebProcess(WebProcessCreationParameters&& parameters) > NetworkStorageSession::switchToNewTestingSession(); > > ensureNetworkProcessConnection(); >+ ensureWebToPaymentProcessConnection(); > > setTerminationTimeout(parameters.terminationTimeout); > >@@ -1257,17 +1258,17 @@ void WebProcess::webToPaymentProcessConnectionClosed(WebToPaymentProcessConnecti > m_webToPaymentProcessConnection = nullptr; > } > >-WebToPaymentProcessConnection& WebProcess::ensureWebToPaymentProcessConnection(PAL::SessionID initialSessionID) >+WebToPaymentProcessConnection& WebProcess::ensureWebToPaymentProcessConnection() > { > if (!m_webToPaymentProcessConnection) { > IPC::Attachment encodedConnectionIdentifier; > >- if (!parentProcessConnection()->sendSync(Messages::WebProcessProxy::GetPaymentProcessConnection(initialSessionID), Messages::WebProcessProxy::GetPaymentProcessConnection::Reply(encodedConnectionIdentifier), 0)) { >- ASSERT_NOT_REACHED(); >- if (!IPC::Connection::identifierIsValid(connectionIdentifier)) >+ if (!parentProcessConnection()->sendSync(Messages::WebProcessProxy::GetPaymentProcessConnection(), Messages::WebProcessProxy::GetPaymentProcessConnection::Reply(encodedConnectionIdentifier), 0)) >+ ASSERT_NOT_REACHED(); >+ if (!IPC::Connection::identifierIsValid(encodedConnectionIdentifier.port())) > CRASH(); > >- m_webToPaymentProcessConnection = WebToPaymentProcessConnection::create(connectionIdentifier); >+ m_webToPaymentProcessConnection = WebToPaymentProcessConnection::create(encodedConnectionIdentifier.port()); > > } > return *m_webToPaymentProcessConnection; >diff --git a/Source/WebKit/WebProcess/WebProcess.h b/Source/WebKit/WebProcess/WebProcess.h >index 7487ba561f4cf7429bb819be61bc3e6234fc1734..b80a8460bbcf0b62d50d4aa46db0d16cb919ff40 100644 >--- a/Source/WebKit/WebProcess/WebProcess.h >+++ b/Source/WebKit/WebProcess/WebProcess.h >@@ -180,7 +180,7 @@ public: > > #if ENABLE(PAYMENT_PROCESS) > void webToPaymentProcessConnectionClosed(WebToPaymentProcessConnection*); >- WebToPaymentProcessConnection& ensureWebToPaymentProcessConnection(PAL::SessionID initialSessionID); >+ WebToPaymentProcessConnection& ensureWebToPaymentProcessConnection(); > #endif // ENABLE(PAYMENT_PROCESS) > > void setCacheModel(uint32_t); >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm >index 3f1a6288682102a5892a0eef32a9442a0caf5084..c346abfd620f93555fd8005c8a1b40d8a9c047b1 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm >@@ -144,6 +144,7 @@ TEST(ResourceLoadStatistics, ChildProcessesNotLaunched) > // Ensure the shared process pool exists so the data store operations we're about to do work with it. > WKProcessPool *sharedProcessPool = [WKProcessPool _sharedProcessPool]; > >+ EXPECT_EQ((pid_t)0, [sharedProcessPool _paymentProcessIdentifier]); > EXPECT_EQ((size_t)0, [sharedProcessPool _pluginProcessCount]); > > auto *dataStore = [WKWebsiteDataStore defaultDataStore]; >@@ -168,6 +169,7 @@ TEST(ResourceLoadStatistics, ChildProcessesNotLaunched) > > EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:targetURL.path]); > >+ EXPECT_EQ((pid_t)0, [sharedProcessPool _paymentProcessIdentifier]); > EXPECT_EQ((size_t)0, [sharedProcessPool _pluginProcessCount]); > } > >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm >index 61ddbc3d63a9ea87c26eca0d1bfd667765730916..e6403e9e0ff6eabda9ece0f29cffa65e555cdc87 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm >@@ -1046,6 +1046,9 @@ TEST(ServiceWorkers, ServiceWorkerProcessCreation) > TestWebKitAPI::Util::run(&done); > done = false; > >+ // Make sure payment process is not launched. >+ EXPECT_EQ(0, webView.get().configuration.processPool._paymentProcessIdentifier); >+ > // Make sure that loading the simple page did not start the service worker process. > EXPECT_EQ(1u, webView.get().configuration.processPool._webProcessCountIgnoringPrewarmed); > >@@ -1130,6 +1133,9 @@ TEST(ServiceWorkers, HasServiceWorkerRegistrationBit) > TestWebKitAPI::Util::run(&done); > done = false; > >+ // There should be no payment process created. >+ EXPECT_EQ(0, webView.get().configuration.processPool._paymentProcessIdentifier); >+ > // Let's use the web site data store that has service worker and load a page. > newConfiguration.get().websiteDataStore = [configuration websiteDataStore]; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 191298
:
353947
|
353949
|
354162
|
354191
|
354197
|
354198
|
354226
|
354230
|
354283
|
354407
|
354858
|
354883
|
354885
|
354900
|
354966
|
354983
|
355158
|
355593
|
355595
|
355601
|
355675
|
355679
|
355837
|
357759
|
357829
|
357834
|
357876
|
358014