Diff
Modified: trunk/Source/WTF/ChangeLog (213600 => 213601)
--- trunk/Source/WTF/ChangeLog 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WTF/ChangeLog 2017-03-08 22:56:22 UTC (rev 213601)
@@ -1,3 +1,14 @@
+2017-03-08 Anders Carlsson <ander...@apple.com>
+
+ Simplify the PaymentCoordinator interface
+ https://bugs.webkit.org/show_bug.cgi?id=169382
+ Part of rdar://problem/28880714.
+
+ Reviewed by Tim Horton.
+
+ * wtf/EnumTraits.h:
+ Fix a build warning.
+
2017-03-06 Andreas Kling <akl...@apple.com>
[iOS] Report domains crashing under memory pressure via enhanced privacy logging.
Modified: trunk/Source/WTF/wtf/EnumTraits.h (213600 => 213601)
--- trunk/Source/WTF/wtf/EnumTraits.h 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WTF/wtf/EnumTraits.h 2017-03-08 22:56:22 UTC (rev 213601)
@@ -45,7 +45,7 @@
template<typename T, typename E>
struct EnumValueChecker<T, EnumValues<E>> {
- static constexpr bool isValidEnum(T t)
+ static constexpr bool isValidEnum(T)
{
return false;
}
Modified: trunk/Source/WebCore/ChangeLog (213600 => 213601)
--- trunk/Source/WebCore/ChangeLog 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebCore/ChangeLog 2017-03-08 22:56:22 UTC (rev 213601)
@@ -1,3 +1,32 @@
+2017-03-08 Anders Carlsson <ander...@apple.com>
+
+ Simplify the PaymentCoordinator interface
+ https://bugs.webkit.org/show_bug.cgi?id=169382
+ Part of rdar://problem/28880714.
+
+ Reviewed by Tim Horton.
+
+ Add four new structs: PaymentAuthorizationResult, PaymentMethodUpdate, ShippingContactUpdate and ShippingMethodUpdate.
+ Change the various PaymentCoordinator and PaymentCoordinatorClient functions to take these new objects instead of multiple parameters.
+
+ * Modules/applepay/ApplePaySession.cpp:
+ (WebCore::ApplePaySession::completeShippingMethodSelection):
+ (WebCore::ApplePaySession::completeShippingContactSelection):
+ (WebCore::ApplePaySession::completePaymentMethodSelection):
+ (WebCore::ApplePaySession::completePayment):
+ (WebCore::ApplePaySession::didSelectShippingMethod):
+ (WebCore::ApplePaySession::didSelectShippingContact):
+ * Modules/applepay/PaymentAuthorizationStatus.h:
+ * Modules/applepay/PaymentCoordinator.cpp:
+ (WebCore::PaymentCoordinator::completeShippingMethodSelection):
+ (WebCore::PaymentCoordinator::completeShippingContactSelection):
+ (WebCore::PaymentCoordinator::completePaymentMethodSelection):
+ (WebCore::PaymentCoordinator::completePaymentSession):
+ * Modules/applepay/PaymentCoordinator.h:
+ * Modules/applepay/PaymentCoordinatorClient.h:
+ * Modules/applepay/PaymentRequest.h:
+ * loader/EmptyClients.cpp:
+
2017-03-08 Simon Fraser <simon.fra...@apple.com>
Change determineNonLayerDescendantsPaintedContent to max out based on renderers traversed
Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp (213600 => 213601)
--- trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp 2017-03-08 22:56:22 UTC (rev 213601)
@@ -645,8 +645,12 @@
totalAndLineItems.lineItems = convertedNewLineItems.releaseReturnValue();
+ ShippingMethodUpdate update;
+ update.status = *authorizationStatus;
+ update.newTotalAndLineItems = WTFMove(totalAndLineItems);
+
m_state = State::Active;
- paymentCoordinator().completeShippingMethodSelection(*authorizationStatus, totalAndLineItems);
+ paymentCoordinator().completeShippingMethodSelection(WTFMove(update));
return { };
}
@@ -682,8 +686,13 @@
totalAndLineItems.lineItems = convertedNewLineItems.releaseReturnValue();
+ ShippingContactUpdate update;
+ update.status = *authorizationStatus;
+ update.newShippingMethods = convertedNewShippingMethods.releaseReturnValue();
+ update.newTotalAndLineItems = WTFMove(totalAndLineItems);
+
m_state = State::Active;
- paymentCoordinator().completeShippingContactSelection(*authorizationStatus, convertedNewShippingMethods.releaseReturnValue(), totalAndLineItems);
+ paymentCoordinator().completeShippingContactSelection(WTFMove(update));
return { };
}
@@ -711,8 +720,12 @@
totalAndLineItems.lineItems = convertedNewLineItems.releaseReturnValue();
+ PaymentMethodUpdate update;
+ update.status = PaymentAuthorizationStatus::Success;
+ update.newTotalAndLineItems = WTFMove(totalAndLineItems);
+
m_state = State::Active;
- paymentCoordinator().completePaymentMethodSelection(totalAndLineItems);
+ paymentCoordinator().completePaymentMethodSelection(WTFMove(update));
return { };
}
@@ -726,8 +739,11 @@
if (!authorizationStatus)
return Exception { INVALID_ACCESS_ERR };
- paymentCoordinator().completePaymentSession(*authorizationStatus);
+ PaymentAuthorizationResult result;
+ result.status = *authorizationStatus;
+ paymentCoordinator().completePaymentSession(WTFMove(result));
+
if (!isFinalStateStatus(*authorizationStatus)) {
m_state = State::Active;
return { };
@@ -775,7 +791,7 @@
ASSERT(m_state == State::Active);
if (!hasEventListeners(eventNames().shippingmethodselectedEvent)) {
- paymentCoordinator().completeShippingMethodSelection(PaymentAuthorizationStatus::Success, { });
+ paymentCoordinator().completeShippingMethodSelection({ });
return;
}
@@ -789,7 +805,7 @@
ASSERT(m_state == State::Active);
if (!hasEventListeners(eventNames().shippingcontactselectedEvent)) {
- paymentCoordinator().completeShippingContactSelection(PaymentAuthorizationStatus::Success, { }, { });
+ paymentCoordinator().completeShippingContactSelection({ });
return;
}
Modified: trunk/Source/WebCore/Modules/applepay/PaymentAuthorizationStatus.h (213600 => 213601)
--- trunk/Source/WebCore/Modules/applepay/PaymentAuthorizationStatus.h 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebCore/Modules/applepay/PaymentAuthorizationStatus.h 2017-03-08 22:56:22 UTC (rev 213601)
@@ -27,6 +27,8 @@
#if ENABLE(APPLE_PAY)
+#include <wtf/EnumTraits.h>
+
namespace WebCore {
enum class PaymentAuthorizationStatus {
@@ -59,4 +61,20 @@
}
+namespace WTF {
+template<> struct EnumTraits<WebCore::PaymentAuthorizationStatus> {
+ using values = EnumValues<
+ WebCore::PaymentAuthorizationStatus,
+ WebCore::PaymentAuthorizationStatus::Success,
+ WebCore::PaymentAuthorizationStatus::Failure,
+ WebCore::PaymentAuthorizationStatus::InvalidBillingPostalAddress,
+ WebCore::PaymentAuthorizationStatus::InvalidShippingPostalAddress,
+ WebCore::PaymentAuthorizationStatus::InvalidShippingContact,
+ WebCore::PaymentAuthorizationStatus::PINRequired,
+ WebCore::PaymentAuthorizationStatus::PINIncorrect,
+ WebCore::PaymentAuthorizationStatus::PINLockout
+ >;
+};
+}
+
#endif
Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp (213600 => 213601)
--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp 2017-03-08 22:56:22 UTC (rev 213601)
@@ -83,33 +83,35 @@
m_client.completeMerchantValidation(paymentMerchantSession);
}
-void PaymentCoordinator::completeShippingMethodSelection(PaymentAuthorizationStatus status, std::optional<PaymentRequest::TotalAndLineItems> newTotalAndItems)
+void PaymentCoordinator::completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&& update)
{
ASSERT(m_activeSession);
- m_client.completeShippingMethodSelection(status, WTFMove(newTotalAndItems));
+ m_client.completeShippingMethodSelection(WTFMove(update));
}
-void PaymentCoordinator::completeShippingContactSelection(PaymentAuthorizationStatus status, const Vector<PaymentRequest::ShippingMethod>& newShippingMethods, std::optional<PaymentRequest::TotalAndLineItems> newTotalAndItems)
+void PaymentCoordinator::completeShippingContactSelection(std::optional<ShippingContactUpdate>&& update)
{
ASSERT(m_activeSession);
- m_client.completeShippingContactSelection(status, newShippingMethods, WTFMove(newTotalAndItems));
+ m_client.completeShippingContactSelection(WTFMove(update));
}
-void PaymentCoordinator::completePaymentMethodSelection(std::optional<PaymentRequest::TotalAndLineItems> newTotalAndItems)
+void PaymentCoordinator::completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&& update)
{
ASSERT(m_activeSession);
- m_client.completePaymentMethodSelection(WTFMove(newTotalAndItems));
+ m_client.completePaymentMethodSelection(WTFMove(update));
}
-void PaymentCoordinator::completePaymentSession(PaymentAuthorizationStatus status)
+void PaymentCoordinator::completePaymentSession(std::optional<PaymentAuthorizationResult>&& result)
{
ASSERT(m_activeSession);
- m_client.completePaymentSession(status);
+ auto status = result ? result->status : PaymentAuthorizationStatus::Success;
+ m_client.completePaymentSession(WTFMove(result));
+
if (!isFinalStateStatus(status))
return;
Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h (213600 => 213601)
--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h 2017-03-08 22:56:22 UTC (rev 213601)
@@ -40,6 +40,10 @@
class PaymentMethod;
class URL;
enum class PaymentAuthorizationStatus;
+struct PaymentAuthorizationResult;
+struct PaymentMethodUpdate;
+struct ShippingContactUpdate;
+struct ShippingMethodUpdate;
class PaymentCoordinator {
public:
@@ -55,10 +59,10 @@
bool beginPaymentSession(ApplePaySession&, const URL& originatingURL, const Vector<URL>& linkIconURLs, const PaymentRequest&);
void completeMerchantValidation(const PaymentMerchantSession&);
- void completeShippingMethodSelection(PaymentAuthorizationStatus, std::optional<PaymentRequest::TotalAndLineItems> newItems);
- void completeShippingContactSelection(PaymentAuthorizationStatus, const Vector<PaymentRequest::ShippingMethod>& newShippingMethods, std::optional<PaymentRequest::TotalAndLineItems> newItems);
- void completePaymentMethodSelection(std::optional<PaymentRequest::TotalAndLineItems> newItems);
- void completePaymentSession(PaymentAuthorizationStatus);
+ void completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&&);
+ void completeShippingContactSelection(std::optional<ShippingContactUpdate>&&);
+ void completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&&);
+ void completePaymentSession(std::optional<PaymentAuthorizationResult>&&);
void abortPaymentSession();
WEBCORE_EXPORT void validateMerchant(const URL& validationURL);
Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h (213600 => 213601)
--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h 2017-03-08 22:56:22 UTC (rev 213601)
@@ -35,7 +35,10 @@
class PaymentMerchantSession;
class URL;
-enum class PaymentAuthorizationStatus;
+struct PaymentAuthorizationResult;
+struct PaymentMethodUpdate;
+struct ShippingContactUpdate;
+struct ShippingMethodUpdate;
class PaymentCoordinatorClient {
public:
@@ -46,10 +49,10 @@
virtual bool showPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const PaymentRequest&) = 0;
virtual void completeMerchantValidation(const PaymentMerchantSession&) = 0;
- virtual void completeShippingMethodSelection(PaymentAuthorizationStatus, std::optional<PaymentRequest::TotalAndLineItems> newTotalAndItems) = 0;
- virtual void completeShippingContactSelection(PaymentAuthorizationStatus, const Vector<PaymentRequest::ShippingMethod>& newShippingMethods, std::optional<PaymentRequest::TotalAndLineItems> newTotalAndItems) = 0;
- virtual void completePaymentMethodSelection(std::optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems) = 0;
- virtual void completePaymentSession(PaymentAuthorizationStatus) = 0;
+ virtual void completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&&) = 0;
+ virtual void completeShippingContactSelection(std::optional<ShippingContactUpdate>&&) = 0;
+ virtual void completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&&) = 0;
+ virtual void completePaymentSession(std::optional<PaymentAuthorizationResult>&&) = 0;
virtual void abortPaymentSession() = 0;
virtual void paymentCoordinatorDestroyed() = 0;
Modified: trunk/Source/WebCore/Modules/applepay/PaymentRequest.h (213600 => 213601)
--- trunk/Source/WebCore/Modules/applepay/PaymentRequest.h 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebCore/Modules/applepay/PaymentRequest.h 2017-03-08 22:56:22 UTC (rev 213601)
@@ -28,6 +28,7 @@
#if ENABLE(APPLE_PAY)
#include "PaymentContact.h"
+#include <wtf/EnumTraits.h>
#include <wtf/Optional.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
@@ -34,6 +35,8 @@
namespace WebCore {
+enum class PaymentAuthorizationStatus;
+
class PaymentRequest {
public:
WEBCORE_EXPORT PaymentRequest();
@@ -147,6 +150,85 @@
String m_applicationData;
};
+struct PaymentError {
+ enum class Code {
+ Unknown,
+ ShippingContactInvalid,
+ BillingContactInvalid,
+ AddressUnservicable,
+ };
+
+ enum class ContactField {
+ PhoneNumber,
+ EmailAddress,
+ GivenName,
+ FamilyName,
+ AddressLines,
+ Locality,
+ PostalCode,
+ AdministrativeArea,
+ Country,
+ CountryCode,
+ };
+
+ Code code;
+ String message;
+ std::optional<ContactField> contactField;
+};
+
+struct PaymentAuthorizationResult {
+ PaymentAuthorizationStatus status;
+ Vector<PaymentError> errors;
+};
+
+struct PaymentMethodUpdate {
+ PaymentAuthorizationStatus status;
+ PaymentRequest::TotalAndLineItems newTotalAndLineItems;
+};
+
+struct ShippingContactUpdate {
+ PaymentAuthorizationStatus status;
+ Vector<PaymentError> errors;
+
+ Vector<PaymentRequest::ShippingMethod> newShippingMethods;
+ PaymentRequest::TotalAndLineItems newTotalAndLineItems;
+};
+
+struct ShippingMethodUpdate {
+ PaymentAuthorizationStatus status;
+ PaymentRequest::TotalAndLineItems newTotalAndLineItems;
+};
+
}
+namespace WTF {
+
+template<> struct EnumTraits<WebCore::PaymentError::Code> {
+ using values = EnumValues<
+ WebCore::PaymentError::Code,
+ WebCore::PaymentError::Code::Unknown,
+ WebCore::PaymentError::Code::ShippingContactInvalid,
+ WebCore::PaymentError::Code::BillingContactInvalid,
+ WebCore::PaymentError::Code::AddressUnservicable
+ >;
+};
+
+template<> struct EnumTraits<WebCore::PaymentError::ContactField> {
+ using values = EnumValues<
+ WebCore::PaymentError::ContactField,
+ WebCore::PaymentError::ContactField::PhoneNumber,
+ WebCore::PaymentError::ContactField::EmailAddress,
+ WebCore::PaymentError::ContactField::GivenName,
+ WebCore::PaymentError::ContactField::FamilyName,
+ WebCore::PaymentError::ContactField::AddressLines,
+ WebCore::PaymentError::ContactField::Locality,
+ WebCore::PaymentError::ContactField::PostalCode,
+ WebCore::PaymentError::ContactField::AdministrativeArea,
+ WebCore::PaymentError::ContactField::Country,
+ WebCore::PaymentError::ContactField::CountryCode
+ >;
+};
+
+}
+
#endif
Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (213600 => 213601)
--- trunk/Source/WebCore/loader/EmptyClients.cpp 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp 2017-03-08 22:56:22 UTC (rev 213601)
@@ -490,10 +490,10 @@
void openPaymentSetup(const String&, const String&, std::function<void(bool)> completionHandler) final { callOnMainThread([completionHandler] { completionHandler(false); }); }
bool showPaymentUI(const URL&, const Vector<URL>&, const PaymentRequest&) final { return false; }
void completeMerchantValidation(const PaymentMerchantSession&) final { }
- void completeShippingMethodSelection(PaymentAuthorizationStatus, std::optional<PaymentRequest::TotalAndLineItems>) final { }
- void completeShippingContactSelection(PaymentAuthorizationStatus, const Vector<PaymentRequest::ShippingMethod>&, std::optional<PaymentRequest::TotalAndLineItems>) final { }
- void completePaymentMethodSelection(std::optional<WebCore::PaymentRequest::TotalAndLineItems>) final { }
- void completePaymentSession(PaymentAuthorizationStatus) final { }
+ void completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&&) final { }
+ void completeShippingContactSelection(std::optional<ShippingContactUpdate>&&) final { }
+ void completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&&) final { }
+ void completePaymentSession(std::optional<PaymentAuthorizationResult>&&) final { }
void abortPaymentSession() final { }
void paymentCoordinatorDestroyed() final { }
};
Modified: trunk/Source/WebKit/mac/ChangeLog (213600 => 213601)
--- trunk/Source/WebKit/mac/ChangeLog 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebKit/mac/ChangeLog 2017-03-08 22:56:22 UTC (rev 213601)
@@ -1,3 +1,20 @@
+2017-03-08 Anders Carlsson <ander...@apple.com>
+
+ Simplify the PaymentCoordinator interface
+ https://bugs.webkit.org/show_bug.cgi?id=169382
+ Part of rdar://problem/28880714.
+
+ Reviewed by Tim Horton.
+
+ Update for PaymentCoordinatorClient changes.
+
+ * WebCoreSupport/WebPaymentCoordinatorClient.h:
+ * WebCoreSupport/WebPaymentCoordinatorClient.mm:
+ (WebPaymentCoordinatorClient::completeShippingMethodSelection):
+ (WebPaymentCoordinatorClient::completeShippingContactSelection):
+ (WebPaymentCoordinatorClient::completePaymentMethodSelection):
+ (WebPaymentCoordinatorClient::completePaymentSession):
+
2017-03-08 Megan Gardner <megan_gard...@apple.com>
Fix for dependency fix
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.h (213600 => 213601)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.h 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.h 2017-03-08 22:56:22 UTC (rev 213601)
@@ -42,10 +42,10 @@
void openPaymentSetup(const String& merchantIdentifier, const String& domainName, std::function<void (bool)> completionHandler) override;
bool showPaymentUI(const WebCore::URL&, const Vector<WebCore::URL>& linkIconURLs, const WebCore::PaymentRequest&) override;
void completeMerchantValidation(const WebCore::PaymentMerchantSession&) override;
- void completeShippingMethodSelection(WebCore::PaymentAuthorizationStatus, std::optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems) override;
- void completeShippingContactSelection(WebCore::PaymentAuthorizationStatus, const Vector<WebCore::PaymentRequest::ShippingMethod>&, std::optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems) override;
- void completePaymentMethodSelection(std::optional<WebCore::PaymentRequest::TotalAndLineItems>) override;
- void completePaymentSession(WebCore::PaymentAuthorizationStatus) 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 paymentCoordinatorDestroyed() override;
};
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm (213600 => 213601)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm 2017-03-08 22:56:22 UTC (rev 213601)
@@ -71,19 +71,19 @@
{
}
-void WebPaymentCoordinatorClient::completeShippingMethodSelection(WebCore::PaymentAuthorizationStatus, std::optional<WebCore::PaymentRequest::TotalAndLineItems>)
+void WebPaymentCoordinatorClient::completeShippingMethodSelection(std::optional<WebCore::ShippingMethodUpdate>&&)
{
}
-void WebPaymentCoordinatorClient::completeShippingContactSelection(WebCore::PaymentAuthorizationStatus, const Vector<WebCore::PaymentRequest::ShippingMethod>&, std::optional<WebCore::PaymentRequest::TotalAndLineItems>)
+void WebPaymentCoordinatorClient::completeShippingContactSelection(std::optional<WebCore::ShippingContactUpdate>&&)
{
}
-void WebPaymentCoordinatorClient::completePaymentMethodSelection(std::optional<WebCore::PaymentRequest::TotalAndLineItems>)
+void WebPaymentCoordinatorClient::completePaymentMethodSelection(std::optional<WebCore::PaymentMethodUpdate>&&)
{
}
-void WebPaymentCoordinatorClient::completePaymentSession(WebCore::PaymentAuthorizationStatus)
+void WebPaymentCoordinatorClient::completePaymentSession(std::optional<WebCore::PaymentAuthorizationResult>&&)
{
}
Modified: trunk/Source/WebKit2/ChangeLog (213600 => 213601)
--- trunk/Source/WebKit2/ChangeLog 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebKit2/ChangeLog 2017-03-08 22:56:22 UTC (rev 213601)
@@ -1,3 +1,48 @@
+2017-03-08 Anders Carlsson <ander...@apple.com>
+
+ Simplify the PaymentCoordinator interface
+ https://bugs.webkit.org/show_bug.cgi?id=169382
+ Part of rdar://problem/28880714.
+
+ Reviewed by Tim Horton.
+
+ Send the new structs over the wire to the UI process and update the various proxy object to take them instead of
+ multiple parameters.
+
+ * Scripts/webkit/messages.py:
+ (headers_for_type):
+ * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
+ (IPC::ArgumentCoder<WebCore::PaymentAuthorizationResult>::encode):
+ (IPC::ArgumentCoder<WebCore::PaymentAuthorizationResult>::decode):
+ (IPC::ArgumentCoder<WebCore::PaymentError>::encode):
+ (IPC::ArgumentCoder<WebCore::PaymentError>::decode):
+ (IPC::ArgumentCoder<WebCore::PaymentMethodUpdate>::encode):
+ (IPC::ArgumentCoder<WebCore::PaymentMethodUpdate>::decode):
+ (IPC::ArgumentCoder<WebCore::ShippingContactUpdate>::encode):
+ (IPC::ArgumentCoder<WebCore::ShippingContactUpdate>::decode):
+ (IPC::ArgumentCoder<WebCore::ShippingMethodUpdate>::encode):
+ (IPC::ArgumentCoder<WebCore::ShippingMethodUpdate>::decode):
+ * Shared/WebCoreArgumentCoders.h:
+ * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
+ (WebKit::WebPaymentCoordinatorProxy::completeShippingMethodSelection):
+ (WebKit::WebPaymentCoordinatorProxy::completeShippingContactSelection):
+ (WebKit::WebPaymentCoordinatorProxy::completePaymentMethodSelection):
+ (WebKit::WebPaymentCoordinatorProxy::completePaymentSession):
+ (WebKit::isValidEnum): Deleted.
+ * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
+ * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
+ * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
+ (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession):
+ (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection):
+ (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection):
+ (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection):
+ * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
+ (WebKit::WebPaymentCoordinator::completeShippingMethodSelection):
+ (WebKit::WebPaymentCoordinator::completeShippingContactSelection):
+ (WebKit::WebPaymentCoordinator::completePaymentMethodSelection):
+ (WebKit::WebPaymentCoordinator::completePaymentSession):
+ * WebProcess/ApplePay/WebPaymentCoordinator.h:
+
2017-03-08 Brent Fulgham <bfulg...@apple.com>
Remove the trace command from the sandbox profile.
Modified: trunk/Source/WebKit2/Scripts/webkit/messages.py (213600 => 213601)
--- trunk/Source/WebKit2/Scripts/webkit/messages.py 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebKit2/Scripts/webkit/messages.py 2017-03-08 22:56:22 UTC (rev 213601)
@@ -358,8 +358,12 @@
'WebCore::MediaConstraintsData': ['<WebCore/MediaConstraintsImpl.h>'],
'WebCore::PasteboardImage': ['<WebCore/Pasteboard.h>'],
'WebCore::PasteboardWebContent': ['<WebCore/Pasteboard.h>'],
+ 'WebCore::PaymentAuthorizationResult': ['<WebCore/PaymentRequest.h>'],
+ 'WebCore::PaymentMethodUpdate': ['<WebCore/PaymentRequest.h>'],
'WebCore::PluginInfo': ['<WebCore/PluginData.h>'],
'WebCore::RecentSearch': ['<WebCore/SearchPopupMenu.h>'],
+ 'WebCore::ShippingContactUpdate': ['<WebCore/PaymentRequest.h>'],
+ 'WebCore::ShippingMethodUpdate': ['<WebCore/PaymentRequest.h>'],
'WebCore::ShouldSample': ['<WebCore/DiagnosticLoggingClient.h>'],
'WebCore::TextCheckingRequestData': ['<WebCore/TextChecking.h>'],
'WebCore::TextCheckingResult': ['<WebCore/TextCheckerClient.h>'],
Modified: trunk/Source/WebKit2/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm (213600 => 213601)
--- trunk/Source/WebKit2/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebKit2/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm 2017-03-08 22:56:22 UTC (rev 213601)
@@ -30,6 +30,7 @@
#import "DataReference.h"
#import <WebCore/PassKitSPI.h>
+#import <WebCore/PaymentAuthorizationStatus.h>
#import <WebCore/SoftLinking.h>
#if PLATFORM(MAC)
@@ -81,6 +82,22 @@
return true;
}
+void ArgumentCoder<WebCore::PaymentAuthorizationResult>::encode(Encoder& encoder, const WebCore::PaymentAuthorizationResult& result)
+{
+ encoder << result.status;
+ encoder << result.errors;
+}
+
+bool ArgumentCoder<WebCore::PaymentAuthorizationResult>::decode(Decoder& decoder, WebCore::PaymentAuthorizationResult& result)
+{
+ if (!decoder.decode(result.status))
+ return false;
+ if (!decoder.decode(result.errors))
+ return false;
+
+ return true;
+}
+
void ArgumentCoder<WebCore::PaymentContact>::encode(Encoder& encoder, const WebCore::PaymentContact& paymentContact)
{
auto data = "" alloc] init]);
@@ -115,6 +132,25 @@
return true;
}
+void ArgumentCoder<WebCore::PaymentError>::encode(Encoder& encoder, const WebCore::PaymentError& error)
+{
+ encoder << error.code;
+ encoder << error.message;
+ encoder << error.contactField;
+}
+
+bool ArgumentCoder<WebCore::PaymentError>::decode(Decoder& decoder, WebCore::PaymentError& error)
+{
+ if (!decoder.decode(error.code))
+ return false;
+ if (!decoder.decode(error.message))
+ return false;
+ if (!decoder.decode(error.contactField))
+ return false;
+
+ return true;
+}
+
void ArgumentCoder<WebCore::PaymentMerchantSession>::encode(Encoder& encoder, const WebCore::PaymentMerchantSession& paymentMerchantSession)
{
auto data = "" alloc] init]);
@@ -184,6 +220,22 @@
return true;
}
+void ArgumentCoder<WebCore::PaymentMethodUpdate>::encode(Encoder& encoder, const WebCore::PaymentMethodUpdate& update)
+{
+ encoder << update.status;
+ encoder << update.newTotalAndLineItems;
+}
+
+bool ArgumentCoder<WebCore::PaymentMethodUpdate>::decode(Decoder& decoder, WebCore::PaymentMethodUpdate& update)
+{
+ if (!decoder.decode(update.status))
+ return false;
+ if (!decoder.decode(update.newTotalAndLineItems))
+ return false;
+
+ return true;
+}
+
void ArgumentCoder<PaymentRequest>::encode(Encoder& encoder, const PaymentRequest& request)
{
encoder << request.countryCode();
@@ -370,6 +422,44 @@
return true;
}
+void ArgumentCoder<WebCore::ShippingContactUpdate>::encode(Encoder& encoder, const WebCore::ShippingContactUpdate& update)
+{
+ encoder << update.status;
+ encoder << update.errors;
+ encoder << update.newShippingMethods;
+ encoder << update.newTotalAndLineItems;
}
+bool ArgumentCoder<WebCore::ShippingContactUpdate>::decode(Decoder& decoder, WebCore::ShippingContactUpdate& update)
+{
+ if (!decoder.decode(update.status))
+ return false;
+ if (!decoder.decode(update.errors))
+ return false;
+ if (!decoder.decode(update.newShippingMethods))
+ return false;
+ if (!decoder.decode(update.newTotalAndLineItems))
+ return false;
+
+ return true;
+}
+
+void ArgumentCoder<WebCore::ShippingMethodUpdate>::encode(Encoder& encoder, const WebCore::ShippingMethodUpdate& update)
+{
+ encoder << update.status;
+ encoder << update.newTotalAndLineItems;
+}
+
+bool ArgumentCoder<WebCore::ShippingMethodUpdate>::decode(Decoder& decoder, WebCore::ShippingMethodUpdate& update)
+{
+ if (!decoder.decode(update.status))
+ return false;
+ if (!decoder.decode(update.newTotalAndLineItems))
+ return false;
+
+ return true;
+}
+
+}
+
#endif
Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h (213600 => 213601)
--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h 2017-03-08 22:56:22 UTC (rev 213601)
@@ -546,11 +546,21 @@
static bool decode(Decoder&, WebCore::Payment&);
};
+template<> struct ArgumentCoder<WebCore::PaymentAuthorizationResult> {
+ static void encode(Encoder&, const WebCore::PaymentAuthorizationResult&);
+ static bool decode(Decoder&, WebCore::PaymentAuthorizationResult&);
+};
+
template<> struct ArgumentCoder<WebCore::PaymentContact> {
static void encode(Encoder&, const WebCore::PaymentContact&);
static bool decode(Decoder&, WebCore::PaymentContact&);
};
+template<> struct ArgumentCoder<WebCore::PaymentError> {
+ static void encode(Encoder&, const WebCore::PaymentError&);
+ static bool decode(Decoder&, WebCore::PaymentError&);
+};
+
template<> struct ArgumentCoder<WebCore::PaymentMerchantSession> {
static void encode(Encoder&, const WebCore::PaymentMerchantSession&);
static bool decode(Decoder&, WebCore::PaymentMerchantSession&);
@@ -561,6 +571,11 @@
static bool decode(Decoder&, WebCore::PaymentMethod&);
};
+template<> struct ArgumentCoder<WebCore::PaymentMethodUpdate> {
+ static void encode(Encoder&, const WebCore::PaymentMethodUpdate&);
+ static bool decode(Decoder&, WebCore::PaymentMethodUpdate&);
+};
+
template<> struct ArgumentCoder<WebCore::PaymentRequest> {
static void encode(Encoder&, const WebCore::PaymentRequest&);
static bool decode(Decoder&, WebCore::PaymentRequest&);
@@ -591,6 +606,16 @@
static bool decode(Decoder&, WebCore::PaymentRequest::TotalAndLineItems&);
};
+template<> struct ArgumentCoder<WebCore::ShippingContactUpdate> {
+ static void encode(Encoder&, const WebCore::ShippingContactUpdate&);
+ static bool decode(Decoder&, WebCore::ShippingContactUpdate&);
+};
+
+template<> struct ArgumentCoder<WebCore::ShippingMethodUpdate> {
+ static void encode(Encoder&, const WebCore::ShippingMethodUpdate&);
+ static bool decode(Decoder&, WebCore::ShippingMethodUpdate&);
+};
+
#endif
#if ENABLE(MEDIA_STREAM)
Modified: trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp (213600 => 213601)
--- trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp 2017-03-08 22:56:22 UTC (rev 213601)
@@ -120,23 +120,7 @@
result = true;
}
-static bool isValidEnum(WebCore::PaymentAuthorizationStatus status)
-{
- switch (status) {
- case WebCore::PaymentAuthorizationStatus::Success:
- case WebCore::PaymentAuthorizationStatus::Failure:
- case WebCore::PaymentAuthorizationStatus::InvalidBillingPostalAddress:
- case WebCore::PaymentAuthorizationStatus::InvalidShippingPostalAddress:
- case WebCore::PaymentAuthorizationStatus::InvalidShippingContact:
- case WebCore::PaymentAuthorizationStatus::PINRequired:
- case WebCore::PaymentAuthorizationStatus::PINIncorrect:
- case WebCore::PaymentAuthorizationStatus::PINLockout:
- return true;
- }
-
- return false;
-}
-
+
void WebPaymentCoordinatorProxy::completeMerchantValidation(const WebCore::PaymentMerchantSession& paymentMerchantSession)
{
// It's possible that the payment has been canceled already.
@@ -150,7 +134,7 @@
m_merchantValidationState = MerchantValidationState::ValidationComplete;
}
-void WebPaymentCoordinatorProxy::completeShippingMethodSelection(uint32_t opaqueStatus, const std::optional<WebCore::PaymentRequest::TotalAndLineItems>& newTotalAndLineItems)
+void WebPaymentCoordinatorProxy::completeShippingMethodSelection(const std::optional<WebCore::ShippingMethodUpdate>& update)
{
// It's possible that the payment has been canceled already.
if (m_state == State::Idle)
@@ -159,16 +143,11 @@
// FIXME: This should be a MESSAGE_CHECK.
ASSERT(m_state == State::ShippingMethodSelected);
- auto status = static_cast<WebCore::PaymentAuthorizationStatus>(opaqueStatus);
-
- // FIXME: Make this a message check.
- RELEASE_ASSERT(isValidEnum(status));
-
- platformCompleteShippingMethodSelection(status, newTotalAndLineItems);
+ platformCompleteShippingMethodSelection(update);
m_state = State::Active;
}
-void WebPaymentCoordinatorProxy::completeShippingContactSelection(uint32_t opaqueStatus, const Vector<WebCore::PaymentRequest::ShippingMethod>& newShippingMethods, const std::optional<WebCore::PaymentRequest::TotalAndLineItems>& newTotalAndLineItems)
+void WebPaymentCoordinatorProxy::completeShippingContactSelection(const std::optional<WebCore::ShippingContactUpdate>& update)
{
// It's possible that the payment has been canceled already.
if (m_state == State::Idle)
@@ -177,16 +156,11 @@
// FIXME: This should be a MESSAGE_CHECK.
ASSERT(m_state == State::ShippingContactSelected);
- auto status = static_cast<WebCore::PaymentAuthorizationStatus>(opaqueStatus);
-
- // FIXME: Make this a message check.
- RELEASE_ASSERT(isValidEnum(status));
-
- platformCompleteShippingContactSelection(status, newShippingMethods, newTotalAndLineItems);
+ platformCompleteShippingContactSelection(update);
m_state = State::Active;
}
-void WebPaymentCoordinatorProxy::completePaymentMethodSelection(const std::optional<WebCore::PaymentRequest::TotalAndLineItems>& newTotalAndLineItems)
+void WebPaymentCoordinatorProxy::completePaymentMethodSelection(const std::optional<WebCore::PaymentMethodUpdate>& update)
{
// It's possible that the payment has been canceled already.
if (m_state == State::Idle)
@@ -195,24 +169,19 @@
// FIXME: This should be a MESSAGE_CHECK.
ASSERT(m_state == State::PaymentMethodSelected);
- platformCompletePaymentMethodSelection(newTotalAndLineItems);
+ platformCompletePaymentMethodSelection(update);
m_state = State::Active;
}
-void WebPaymentCoordinatorProxy::completePaymentSession(uint32_t opaqueStatus)
+void WebPaymentCoordinatorProxy::completePaymentSession(const std::optional<WebCore::PaymentAuthorizationResult>& result)
{
// It's possible that the payment has been canceled already.
if (!canCompletePayment())
return;
- auto status = static_cast<WebCore::PaymentAuthorizationStatus>(opaqueStatus);
+ platformCompletePaymentSession(result);
- // FIXME: Make this a message check.
- RELEASE_ASSERT(isValidEnum(status));
-
- platformCompletePaymentSession(status);
-
- if (!WebCore::isFinalStateStatus(status)) {
+ if (!WebCore::isFinalStateStatus(result ? result->status : WebCore::PaymentAuthorizationStatus::Success)) {
m_state = State::Active;
return;
}
Modified: trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h (213600 => 213601)
--- trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h 2017-03-08 22:56:22 UTC (rev 213601)
@@ -80,10 +80,10 @@
void openPaymentSetup(const String& merchantIdentifier, const String& domainName, uint64_t requestID);
void showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::PaymentRequest&, bool& result);
void completeMerchantValidation(const WebCore::PaymentMerchantSession&);
- void completeShippingMethodSelection(uint32_t opaqueStatus, const std::optional<WebCore::PaymentRequest::TotalAndLineItems>&);
- void completeShippingContactSelection(uint32_t opaqueStatus, const Vector<WebCore::PaymentRequest::ShippingMethod>& newShippingMethods, const std::optional<WebCore::PaymentRequest::TotalAndLineItems>&);
- void completePaymentMethodSelection(const std::optional<WebCore::PaymentRequest::TotalAndLineItems>&);
- void completePaymentSession(uint32_t opaqueStatus);
+ 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();
bool canBegin() const;
@@ -98,10 +98,10 @@
void platformOpenPaymentSetup(const String& merchantIdentifier, const String& domainName, std::function<void (bool)> completionHandler);
void platformShowPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::PaymentRequest&, std::function<void (bool)> completionHandler);
void platformCompleteMerchantValidation(const WebCore::PaymentMerchantSession&);
- void platformCompleteShippingMethodSelection(WebCore::PaymentAuthorizationStatus, const std::optional<WebCore::PaymentRequest::TotalAndLineItems>&);
- void platformCompleteShippingContactSelection(WebCore::PaymentAuthorizationStatus, const Vector<WebCore::PaymentRequest::ShippingMethod>& newShippingMethods, const std::optional<WebCore::PaymentRequest::TotalAndLineItems>&);
- void platformCompletePaymentMethodSelection(const std::optional<WebCore::PaymentRequest::TotalAndLineItems>&);
- void platformCompletePaymentSession(WebCore::PaymentAuthorizationStatus);
+ 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>&);
WebPageProxy& m_webPageProxy;
WeakPtrFactory<WebPaymentCoordinatorProxy> m_weakPtrFactory;
Modified: trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in (213600 => 213601)
--- trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in 2017-03-08 22:56:22 UTC (rev 213601)
@@ -31,11 +31,11 @@
OpenPaymentSetup(String merchantIdentifier, String domainName, uint64_t requestID)
ShowPaymentUI(String originatingURLString, Vector<String> linkIconURLStrings, WebCore::PaymentRequest paymentRequest) -> (bool result)
- CompleteMerchantValidation(WebCore::PaymentMerchantSession paymentMerchantSession);
- CompleteShippingMethodSelection(uint32_t opaqueStatus, std::optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems)
- CompleteShippingContactSelection(uint32_t opaqueStatus, Vector<WebCore::PaymentRequest::ShippingMethod> newShippingMethods, std::optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems)
- CompletePaymentMethodSelection(std::optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems)
- CompletePaymentSession(uint32_t opaqueStatus)
+ 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()
}
Modified: trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm (213600 => 213601)
--- trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2017-03-08 22:56:22 UTC (rev 213601)
@@ -451,11 +451,13 @@
#pragma clang diagnostic pop
}
-void WebPaymentCoordinatorProxy::platformCompletePaymentSession(WebCore::PaymentAuthorizationStatus status)
+void WebPaymentCoordinatorProxy::platformCompletePaymentSession(const std::optional<WebCore::PaymentAuthorizationResult>& result)
{
ASSERT(m_paymentAuthorizationViewController);
ASSERT(m_paymentAuthorizationViewControllerDelegate);
+ auto status = result ? result->status : WebCore::PaymentAuthorizationStatus::Success;
+
m_paymentAuthorizationViewControllerDelegate->_didReachFinalState = WebCore::isFinalStateStatus(status);
m_paymentAuthorizationViewControllerDelegate->_paymentAuthorizedCompletion(toPKPaymentAuthorizationStatus(status));
m_paymentAuthorizationViewControllerDelegate->_paymentAuthorizedCompletion = nullptr;
@@ -470,19 +472,21 @@
m_paymentAuthorizationViewControllerDelegate->_sessionBlock = nullptr;
}
-void WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection(WebCore::PaymentAuthorizationStatus status, const std::optional<WebCore::PaymentRequest::TotalAndLineItems>& newTotalAndLineItems)
+void WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection(const std::optional<WebCore::ShippingMethodUpdate>& update)
{
ASSERT(m_paymentAuthorizationViewController);
ASSERT(m_paymentAuthorizationViewControllerDelegate);
- if (newTotalAndLineItems) {
+ auto status = update ? update->status : WebCore::PaymentAuthorizationStatus::Success;
+
+ if (update) {
auto paymentSummaryItems = adoptNS([[NSMutableArray alloc] init]);
- for (auto& lineItem : newTotalAndLineItems->lineItems) {
+ for (auto& lineItem : update->newTotalAndLineItems.lineItems) {
if (auto summaryItem = toPKPaymentSummaryItem(lineItem))
[paymentSummaryItems addObject:summaryItem.get()];
}
- if (auto totalItem = toPKPaymentSummaryItem(newTotalAndLineItems->total))
+ if (auto totalItem = toPKPaymentSummaryItem(update->newTotalAndLineItems.total))
[paymentSummaryItems addObject:totalItem.get()];
m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems = WTFMove(paymentSummaryItems);
@@ -492,25 +496,27 @@
m_paymentAuthorizationViewControllerDelegate->_didSelectShippingMethodCompletion = nullptr;
}
-void WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection(WebCore::PaymentAuthorizationStatus status, const Vector<WebCore::PaymentRequest::ShippingMethod>& newShippingMethods, const std::optional<WebCore::PaymentRequest::TotalAndLineItems>& newTotalAndLineItems)
+void WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection(const std::optional<WebCore::ShippingContactUpdate>& update)
{
ASSERT(m_paymentAuthorizationViewController);
ASSERT(m_paymentAuthorizationViewControllerDelegate);
- if (newTotalAndLineItems) {
+ auto status = update ? update->status : WebCore::PaymentAuthorizationStatus::Success;
+
+ if (update) {
auto paymentSummaryItems = adoptNS([[NSMutableArray alloc] init]);
- for (auto& lineItem : newTotalAndLineItems->lineItems) {
+ for (auto& lineItem : update->newTotalAndLineItems.lineItems) {
if (auto summaryItem = toPKPaymentSummaryItem(lineItem))
[paymentSummaryItems addObject:summaryItem.get()];
}
- if (auto totalItem = toPKPaymentSummaryItem(newTotalAndLineItems->total))
+ if (auto totalItem = toPKPaymentSummaryItem(update->newTotalAndLineItems.total))
[paymentSummaryItems addObject:totalItem.get()];
m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems = WTFMove(paymentSummaryItems);
auto shippingMethods = adoptNS([[NSMutableArray alloc] init]);
- for (auto& shippingMethod : newShippingMethods)
+ for (auto& shippingMethod : update->newShippingMethods)
[shippingMethods addObject:toPKShippingMethod(shippingMethod).get()];
m_paymentAuthorizationViewControllerDelegate->_shippingMethods = WTFMove(shippingMethods);
@@ -520,19 +526,19 @@
m_paymentAuthorizationViewControllerDelegate->_didSelectShippingContactCompletion = nullptr;
}
-void WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection(const std::optional<WebCore::PaymentRequest::TotalAndLineItems>& newTotalAndLineItems)
+void WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection(const std::optional<WebCore::PaymentMethodUpdate>& update)
{
ASSERT(m_paymentAuthorizationViewController);
ASSERT(m_paymentAuthorizationViewControllerDelegate);
- if (newTotalAndLineItems) {
+ if (update) {
auto paymentSummaryItems = adoptNS([[NSMutableArray alloc] init]);
- for (auto& lineItem : newTotalAndLineItems->lineItems) {
+ for (auto& lineItem : update->newTotalAndLineItems.lineItems) {
if (auto summaryItem = toPKPaymentSummaryItem(lineItem))
[paymentSummaryItems addObject:summaryItem.get()];
}
- if (auto totalItem = toPKPaymentSummaryItem(newTotalAndLineItems->total))
+ if (auto totalItem = toPKPaymentSummaryItem(update->newTotalAndLineItems.total))
[paymentSummaryItems addObject:totalItem.get()];
m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems = WTFMove(paymentSummaryItems);
Modified: trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.cpp (213600 => 213601)
--- trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.cpp 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.cpp 2017-03-08 22:56:22 UTC (rev 213601)
@@ -117,24 +117,24 @@
m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteMerchantValidation(paymentMerchantSession));
}
-void WebPaymentCoordinator::completeShippingMethodSelection(WebCore::PaymentAuthorizationStatus status, std::optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems)
+void WebPaymentCoordinator::completeShippingMethodSelection(std::optional<WebCore::ShippingMethodUpdate>&& update)
{
- m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteShippingMethodSelection(static_cast<uint32_t>(status), newTotalAndItems));
+ m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteShippingMethodSelection(update));
}
-void WebPaymentCoordinator::completeShippingContactSelection(WebCore::PaymentAuthorizationStatus status, const Vector<WebCore::PaymentRequest::ShippingMethod>& newShippingMethods, std::optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems)
+void WebPaymentCoordinator::completeShippingContactSelection(std::optional<WebCore::ShippingContactUpdate>&& update)
{
- m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteShippingContactSelection(static_cast<uint32_t>(status), newShippingMethods, newTotalAndItems));
+ m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteShippingContactSelection(update));
}
-void WebPaymentCoordinator::completePaymentMethodSelection(std::optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems)
+void WebPaymentCoordinator::completePaymentMethodSelection(std::optional<WebCore::PaymentMethodUpdate>&& update)
{
- m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompletePaymentMethodSelection(newTotalAndItems));
+ m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompletePaymentMethodSelection(update));
}
-void WebPaymentCoordinator::completePaymentSession(WebCore::PaymentAuthorizationStatus status)
+void WebPaymentCoordinator::completePaymentSession(std::optional<WebCore::PaymentAuthorizationResult>&& result)
{
- m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompletePaymentSession(static_cast<uint32_t>(status)));
+ m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompletePaymentSession(result));
}
void WebPaymentCoordinator::abortPaymentSession()
Modified: trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.h (213600 => 213601)
--- trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.h 2017-03-08 22:53:20 UTC (rev 213600)
+++ trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.h 2017-03-08 22:56:22 UTC (rev 213601)
@@ -59,10 +59,11 @@
void openPaymentSetup(const String& merchantIdentifier, const String& domainName, std::function<void (bool)> completionHandler) override;
bool showPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::PaymentRequest&) override;
void completeMerchantValidation(const WebCore::PaymentMerchantSession&) override;
- void completeShippingMethodSelection(WebCore::PaymentAuthorizationStatus, std::optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems) override;
- void completeShippingContactSelection(WebCore::PaymentAuthorizationStatus, const Vector<WebCore::PaymentRequest::ShippingMethod>&, std::optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems) override;
- void completePaymentMethodSelection(std::optional<WebCore::PaymentRequest::TotalAndLineItems>) override;
- void completePaymentSession(WebCore::PaymentAuthorizationStatus) 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 paymentCoordinatorDestroyed() override;