Title: [248692] trunk/Source
Revision
248692
Author
aes...@apple.com
Date
2019-08-14 15:55:30 -0700 (Wed, 14 Aug 2019)

Log Message

[Cocoa] Add some WKA extension points
https://bugs.webkit.org/show_bug.cgi?id=200506
<rdar://problem/51682474>

Reviewed by Tim Horton.

Source/WebCore:

* Modules/applepay/ApplePayPayment.h:
* Modules/applepay/ApplePayPaymentMethod.h:
* Modules/applepay/ApplePayRequestBase.cpp:
(WebCore::finishConverting):
(WebCore::convertAndValidate):
* Modules/applepay/ApplePayRequestBase.h:
* Modules/applepay/ApplePaySessionPaymentRequest.h:
* Modules/applepay/PaymentCoordinatorClient.cpp:
(WebCore::PaymentCoordinatorClient::supportsVersion):
* Modules/applepay/cocoa/PaymentCocoa.mm:
(WebCore::convert):
* Modules/applepay/cocoa/PaymentMethodCocoa.mm:
(WebCore::finishConverting):
(WebCore::convert):

Source/WebKit:

* Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(WebKit::finishCreating):
(WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest):
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::finishDecoding):
(IPC::finishEncoding):
(IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::encode):
(IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::decode):
* Shared/WebCoreArgumentCoders.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (248691 => 248692)


--- trunk/Source/WebCore/ChangeLog	2019-08-14 22:38:47 UTC (rev 248691)
+++ trunk/Source/WebCore/ChangeLog	2019-08-14 22:55:30 UTC (rev 248692)
@@ -1,3 +1,26 @@
+2019-08-14  Andy Estes  <aes...@apple.com>
+
+        [Cocoa] Add some WKA extension points
+        https://bugs.webkit.org/show_bug.cgi?id=200506
+        <rdar://problem/51682474>
+
+        Reviewed by Tim Horton.
+
+        * Modules/applepay/ApplePayPayment.h:
+        * Modules/applepay/ApplePayPaymentMethod.h:
+        * Modules/applepay/ApplePayRequestBase.cpp:
+        (WebCore::finishConverting):
+        (WebCore::convertAndValidate):
+        * Modules/applepay/ApplePayRequestBase.h:
+        * Modules/applepay/ApplePaySessionPaymentRequest.h:
+        * Modules/applepay/PaymentCoordinatorClient.cpp:
+        (WebCore::PaymentCoordinatorClient::supportsVersion):
+        * Modules/applepay/cocoa/PaymentCocoa.mm:
+        (WebCore::convert):
+        * Modules/applepay/cocoa/PaymentMethodCocoa.mm:
+        (WebCore::finishConverting):
+        (WebCore::convert):
+
 2019-08-14  Devin Rousso  <drou...@apple.com>
 
         Web Inspector: support `console.screenshot` with dataURL strings

Modified: trunk/Source/WebCore/Modules/applepay/ApplePayPayment.h (248691 => 248692)


--- trunk/Source/WebCore/Modules/applepay/ApplePayPayment.h	2019-08-14 22:38:47 UTC (rev 248691)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayPayment.h	2019-08-14 22:55:30 UTC (rev 248692)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,6 +30,10 @@
 #include "ApplePayPaymentContact.h"
 #include "ApplePayPaymentMethod.h"
 
+#if USE(APPLE_INTERNAL_SDK)
+#include <WebKitAdditions/ApplePayPaymentAdditions.h>
+#endif
+
 namespace WebCore {
 
 struct ApplePayPayment {
@@ -42,6 +46,11 @@
     Token token;
     Optional<ApplePayPaymentContact> billingContact;
     Optional<ApplePayPaymentContact> shippingContact;
+
+#if defined(APPLEPAYPAYMENT_ADDITIONS)
+APPLEPAYPAYMENT_ADDITIONS
+#undef APPLEPAYPAYMENT_ADDITIONS
+#endif
 };
 
 }

Modified: trunk/Source/WebCore/Modules/applepay/ApplePayPaymentMethod.h (248691 => 248692)


--- trunk/Source/WebCore/Modules/applepay/ApplePayPaymentMethod.h	2019-08-14 22:38:47 UTC (rev 248691)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayPaymentMethod.h	2019-08-14 22:55:30 UTC (rev 248692)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,6 +30,10 @@
 #include "ApplePayPaymentPass.h"
 #include <wtf/Optional.h>
 
+#if USE(APPLE_INTERNAL_SDK)
+#include <WebKitAdditions/ApplePayPaymentMethodAdditions.h>
+#endif
+
 namespace WebCore {
 
 enum class ApplePayPaymentMethodType;
@@ -36,11 +40,16 @@
 
 struct ApplePayPaymentMethod {    
     using Type = ApplePayPaymentMethodType;
-    
+
     String displayName;
     String network;
     Optional<Type> type;
     Optional<ApplePayPaymentPass> paymentPass;
+
+#if defined(APPLEPAYPAYMENTMETHOD_ADDITIONS)
+APPLEPAYPAYMENTMETHOD_ADDITIONS
+#undef APPLEPAYPAYMENTMETHOD_ADDITIONS
+#endif
 };
 
 }

Modified: trunk/Source/WebCore/Modules/applepay/ApplePayRequestBase.cpp (248691 => 248692)


--- trunk/Source/WebCore/Modules/applepay/ApplePayRequestBase.cpp	2019-08-14 22:38:47 UTC (rev 248691)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayRequestBase.cpp	2019-08-14 22:55:30 UTC (rev 248692)
@@ -31,8 +31,16 @@
 #include "PaymentCoordinator.h"
 #include <wtf/text/StringConcatenateNumbers.h>
 
+#if USE(APPLE_INTERNAL_SDK)
+#include <WebKitAdditions/ApplePayRequestBaseAdditions.cpp>
+#else
 namespace WebCore {
+static void finishConverting(ApplePaySessionPaymentRequest&, ApplePayRequestBase&) { }
+}
+#endif
 
+namespace WebCore {
+
 static ExceptionOr<Vector<String>> convertAndValidate(Document& document, unsigned version, const Vector<String>& supportedNetworks, const PaymentCoordinator& paymentCoordinator)
 {
     if (supportedNetworks.isEmpty())
@@ -78,7 +86,7 @@
 
     if (request.billingContact)
         result.setBillingContact(PaymentContact::fromApplePayPaymentContact(version, *request.billingContact));
-    
+
     if (request.requiredShippingContactFields) {
         auto requiredShippingContactFields = convertAndValidate(version, *request.requiredShippingContactFields);
         if (requiredShippingContactFields.hasException())
@@ -94,6 +102,8 @@
     if (version >= 3)
         result.setSupportedCountries(WTFMove(request.supportedCountries));
 
+    finishConverting(result, request);
+
     return WTFMove(result);
 }
 

Modified: trunk/Source/WebCore/Modules/applepay/ApplePayRequestBase.h (248691 => 248692)


--- trunk/Source/WebCore/Modules/applepay/ApplePayRequestBase.h	2019-08-14 22:38:47 UTC (rev 248691)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayRequestBase.h	2019-08-14 22:55:30 UTC (rev 248692)
@@ -31,6 +31,10 @@
 #include "ApplePayMerchantCapability.h"
 #include "ApplePayPaymentContact.h"
 
+#if USE(APPLE_INTERNAL_SDK)
+#include <WebKitAdditions/ApplePayRequestBaseAdditions.h>
+#endif
+
 namespace WebCore {
 
 class Document;
@@ -49,6 +53,11 @@
 
     String applicationData;
     Vector<String> supportedCountries;
+
+#if defined(APPLEPAYREQUESTBASE_ADDITIONS)
+APPLEPAYREQUESTBASE_ADDITIONS
+#undef APPLEPAYREQUESTBASE_ADDITIONS
+#endif
 };
 
 ExceptionOr<ApplePaySessionPaymentRequest> convertAndValidate(Document&, unsigned version, ApplePayRequestBase&, const PaymentCoordinator&);

Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.h (248691 => 248692)


--- trunk/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.h	2019-08-14 22:38:47 UTC (rev 248691)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.h	2019-08-14 22:55:30 UTC (rev 248692)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,6 +32,10 @@
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
+#if USE(APPLE_INTERNAL_SDK)
+#include <WebKitAdditions/ApplePaySessionPaymentRequestAdditions.h>
+#endif
+
 namespace WebCore {
 
 enum class PaymentAuthorizationStatus;
@@ -137,6 +141,11 @@
     Requester requester() const { return m_requester; }
     void setRequester(Requester requester) { m_requester = requester; }
 
+#if defined(APPLEPAYSESSIONPAYMENTREQUEST_PUBLIC_ADDITIONS)
+APPLEPAYSESSIONPAYMENTREQUEST_PUBLIC_ADDITIONS
+#undef APPLEPAYSESSIONPAYMENTREQUEST_PUBLIC_ADDITIONS
+#endif
+
 private:
     unsigned m_version { 0 };
 
@@ -162,6 +171,11 @@
     Vector<String> m_supportedCountries;
 
     Requester m_requester { Requester::ApplePayJS };
+
+#if defined(APPLEPAYSESSIONPAYMENTREQUEST_PRIVATE_ADDITIONS)
+APPLEPAYSESSIONPAYMENTREQUEST_PRIVATE_ADDITIONS
+#undef APPLEPAYSESSIONPAYMENTREQUEST_PRIVATE_ADDITIONS
+#endif
 };
 
 struct PaymentError {

Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.cpp (248691 => 248692)


--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.cpp	2019-08-14 22:38:47 UTC (rev 248691)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.cpp	2019-08-14 22:55:30 UTC (rev 248692)
@@ -40,8 +40,10 @@
     static const unsigned currentVersion = 3;
 #elif !ENABLE(APPLE_PAY_SESSION_V7)
     static const unsigned currentVersion = 6;
+#elif !ENABLE(APPLE_PAY_SESSION_V8)
+    static const unsigned currentVersion = 7;
 #else
-    static const unsigned currentVersion = 7;
+    static const unsigned currentVersion = 8;
 #endif
 
     return version <= currentVersion;

Modified: trunk/Source/WebCore/Modules/applepay/cocoa/PaymentCocoa.mm (248691 => 248692)


--- trunk/Source/WebCore/Modules/applepay/cocoa/PaymentCocoa.mm	2019-08-14 22:38:47 UTC (rev 248691)
+++ trunk/Source/WebCore/Modules/applepay/cocoa/PaymentCocoa.mm	2019-08-14 22:55:30 UTC (rev 248692)
@@ -33,8 +33,16 @@
 #import "PaymentMethod.h"
 #import <pal/spi/cocoa/PassKitSPI.h>
 
+#if USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/PaymentCocoaAdditions.mm>
+#else
 namespace WebCore {
+static void finishConverting(PKPayment *, ApplePayPayment&) { }
+}
+#endif
 
+namespace WebCore {
+
 static ApplePayPayment::Token convert(PKPaymentToken *paymentToken)
 {
     ASSERT(paymentToken);
@@ -64,6 +72,8 @@
     if (payment.shippingContact)
         result.shippingContact = PaymentContact(payment.shippingContact).toApplePayPaymentContact(version);
 
+    finishConverting(payment, result);
+
     return result;
 }
     

Modified: trunk/Source/WebCore/Modules/applepay/cocoa/PaymentMethodCocoa.mm (248691 => 248692)


--- trunk/Source/WebCore/Modules/applepay/cocoa/PaymentMethodCocoa.mm	2019-08-14 22:38:47 UTC (rev 248691)
+++ trunk/Source/WebCore/Modules/applepay/cocoa/PaymentMethodCocoa.mm	2019-08-14 22:55:30 UTC (rev 248692)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,8 +32,16 @@
 #import "ApplePayPaymentMethodType.h"
 #import <pal/spi/cocoa/PassKitSPI.h>
 
+#if USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/PaymentMethodCocoaAdditions.mm>
+#else
 namespace WebCore {
+static void finishConverting(PKPaymentMethod *, ApplePayPaymentMethod&) { }
+}
+#endif
 
+namespace WebCore {
+
 static ApplePayPaymentPass::ActivationState convert(PKPaymentPassActivationState paymentPassActivationState)
 {
     switch (paymentPassActivationState) {
@@ -98,6 +106,8 @@
     result.type = convert(paymentMethod.type);
     result.paymentPass = convert(paymentMethod.paymentPass);
 
+    finishConverting(paymentMethod, result);
+
     return result;
 }
 

Modified: trunk/Source/WebKit/ChangeLog (248691 => 248692)


--- trunk/Source/WebKit/ChangeLog	2019-08-14 22:38:47 UTC (rev 248691)
+++ trunk/Source/WebKit/ChangeLog	2019-08-14 22:55:30 UTC (rev 248692)
@@ -1,3 +1,21 @@
+2019-08-14  Andy Estes  <aes...@apple.com>
+
+        [Cocoa] Add some WKA extension points
+        https://bugs.webkit.org/show_bug.cgi?id=200506
+        <rdar://problem/51682474>
+
+        Reviewed by Tim Horton.
+
+        * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
+        (WebKit::finishCreating):
+        (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest):
+        * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
+        (IPC::finishDecoding):
+        (IPC::finishEncoding):
+        (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::encode):
+        (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::decode):
+        * Shared/WebCoreArgumentCoders.h:
+
 2019-08-14  Luming Yin  <luming_...@apple.com>
 
         v3: CrashTracer: Regression : MobileSafari at UIKitCore: -[UITargetedPreview initWithView:parameters:]

Modified: trunk/Source/WebKit/Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm (248691 => 248692)


--- trunk/Source/WebKit/Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm	2019-08-14 22:38:47 UTC (rev 248691)
+++ trunk/Source/WebKit/Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm	2019-08-14 22:55:30 UTC (rev 248692)
@@ -37,6 +37,14 @@
 #import <wtf/RunLoop.h>
 #import <wtf/URL.h>
 
+#if USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/WebPaymentCoordinatorProxyCocoaAdditions.mm>
+#else
+namespace WebKit {
+static void finishCreating(PKPaymentRequest *, const WebCore::ApplePaySessionPaymentRequest&) { }
+}
+#endif
+
 // FIXME: We don't support any platforms without -setThumbnailURLs:, so this can be removed.
 @interface PKPaymentRequest ()
 @property (nonatomic, strong) NSURL *thumbnailURL;
@@ -328,6 +336,8 @@
         [result setCTDataConnectionServiceType:serviceType];
 #endif
 
+    finishCreating(result.get(), paymentRequest);
+
     return result;
 }
 

Modified: trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm (248691 => 248692)


--- trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm	2019-08-14 22:38:47 UTC (rev 248691)
+++ trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm	2019-08-14 22:55:30 UTC (rev 248692)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -41,7 +41,16 @@
 #import <UIKit/UIFont.h>
 #endif
 
+#if USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/WebCoreArgumentCodersCocoaAdditions.mm>
+#else
 namespace IPC {
+static bool finishDecoding(Decoder&, WebCore::ApplePaySessionPaymentRequest&) { return true; }
+static void finishEncoding(Encoder&, const WebCore::ApplePaySessionPaymentRequest&) { }
+}
+#endif
+
+namespace IPC {
 using namespace WebCore;
 
 #if ENABLE(APPLE_PAY)
@@ -181,6 +190,7 @@
     encoder << request.applicationData();
     encoder << request.supportedCountries();
     encoder.encodeEnum(request.requester());
+    finishEncoding(encoder, request);
 }
 
 bool ArgumentCoder<ApplePaySessionPaymentRequest>::decode(Decoder& decoder, ApplePaySessionPaymentRequest& request)
@@ -263,6 +273,9 @@
         return false;
     request.setRequester(requester);
 
+    if (!finishDecoding(decoder, request))
+        return false;
+
     return true;
 }
 

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h (248691 => 248692)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h	2019-08-14 22:38:47 UTC (rev 248691)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h	2019-08-14 22:55:30 UTC (rev 248692)
@@ -50,6 +50,10 @@
 #include <WebCore/CurlProxySettings.h>
 #endif
 
+#if USE(APPLE_INTERNAL_SDK)
+#include <WebKitAdditions/WebCoreArgumentCodersAdditions.h>
+#endif
+
 #if PLATFORM(COCOA)
 namespace WTF {
 class MachSendRight;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to