<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[213601] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/213601">213601</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2017-03-08 14:56:22 -0800 (Wed, 08 Mar 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>Simplify the PaymentCoordinator interface
https://bugs.webkit.org/show_bug.cgi?id=169382
Part of rdar://problem/28880714.
Reviewed by Tim Horton.
Source/WebCore:
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:
Source/WebKit/mac:
Update for PaymentCoordinatorClient changes.
* WebCoreSupport/WebPaymentCoordinatorClient.h:
* WebCoreSupport/WebPaymentCoordinatorClient.mm:
(WebPaymentCoordinatorClient::completeShippingMethodSelection):
(WebPaymentCoordinatorClient::completeShippingContactSelection):
(WebPaymentCoordinatorClient::completePaymentMethodSelection):
(WebPaymentCoordinatorClient::completePaymentSession):
Source/WebKit2:
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:
Source/WTF:
* wtf/EnumTraits.h:
Fix a build warning.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfEnumTraitsh">trunk/Source/WTF/wtf/EnumTraits.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesapplepayApplePaySessioncpp">trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesapplepayPaymentAuthorizationStatush">trunk/Source/WebCore/Modules/applepay/PaymentAuthorizationStatus.h</a></li>
<li><a href="#trunkSourceWebCoreModulesapplepayPaymentCoordinatorcpp">trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesapplepayPaymentCoordinatorh">trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h</a></li>
<li><a href="#trunkSourceWebCoreModulesapplepayPaymentCoordinatorClienth">trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h</a></li>
<li><a href="#trunkSourceWebCoreModulesapplepayPaymentRequesth">trunk/Source/WebCore/Modules/applepay/PaymentRequest.h</a></li>
<li><a href="#trunkSourceWebCoreloaderEmptyClientscpp">trunk/Source/WebCore/loader/EmptyClients.cpp</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebPaymentCoordinatorClienth">trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebPaymentCoordinatorClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2Scriptswebkitmessagespy">trunk/Source/WebKit2/Scripts/webkit/messages.py</a></li>
<li><a href="#trunkSourceWebKit2SharedCocoaWebCoreArgumentCodersCocoamm">trunk/Source/WebKit2/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedWebCoreArgumentCodersh">trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessApplePayWebPaymentCoordinatorProxycpp">trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessApplePayWebPaymentCoordinatorProxyh">trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessApplePayWebPaymentCoordinatorProxymessagesin">trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessApplePaycocoaWebPaymentCoordinatorProxyCocoamm">trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessApplePayWebPaymentCoordinatorcpp">trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessApplePayWebPaymentCoordinatorh">trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2017-03-08 Anders Carlsson <andersca@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.
+
</ins><span class="cx"> 2017-03-06 Andreas Kling <akling@apple.com>
</span><span class="cx">
</span><span class="cx"> [iOS] Report domains crashing under memory pressure via enhanced privacy logging.
</span></span></pre></div>
<a id="trunkSourceWTFwtfEnumTraitsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/EnumTraits.h (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx">
</span><span class="cx"> template<typename T, typename E>
</span><span class="cx"> struct EnumValueChecker<T, EnumValues<E>> {
</span><del>- static constexpr bool isValidEnum(T t)
</del><ins>+ static constexpr bool isValidEnum(T)
</ins><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2017-03-08 Anders Carlsson <andersca@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:
+
</ins><span class="cx"> 2017-03-08 Simon Fraser <simon.fraser@apple.com>
</span><span class="cx">
</span><span class="cx"> Change determineNonLayerDescendantsPaintedContent to max out based on renderers traversed
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesapplepayApplePaySessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -645,8 +645,12 @@
</span><span class="cx">
</span><span class="cx"> totalAndLineItems.lineItems = convertedNewLineItems.releaseReturnValue();
</span><span class="cx">
</span><ins>+ ShippingMethodUpdate update;
+ update.status = *authorizationStatus;
+ update.newTotalAndLineItems = WTFMove(totalAndLineItems);
+
</ins><span class="cx"> m_state = State::Active;
</span><del>- paymentCoordinator().completeShippingMethodSelection(*authorizationStatus, totalAndLineItems);
</del><ins>+ paymentCoordinator().completeShippingMethodSelection(WTFMove(update));
</ins><span class="cx">
</span><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="lines">@@ -682,8 +686,13 @@
</span><span class="cx">
</span><span class="cx"> totalAndLineItems.lineItems = convertedNewLineItems.releaseReturnValue();
</span><span class="cx">
</span><ins>+ ShippingContactUpdate update;
+ update.status = *authorizationStatus;
+ update.newShippingMethods = convertedNewShippingMethods.releaseReturnValue();
+ update.newTotalAndLineItems = WTFMove(totalAndLineItems);
+
</ins><span class="cx"> m_state = State::Active;
</span><del>- paymentCoordinator().completeShippingContactSelection(*authorizationStatus, convertedNewShippingMethods.releaseReturnValue(), totalAndLineItems);
</del><ins>+ paymentCoordinator().completeShippingContactSelection(WTFMove(update));
</ins><span class="cx">
</span><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="lines">@@ -711,8 +720,12 @@
</span><span class="cx">
</span><span class="cx"> totalAndLineItems.lineItems = convertedNewLineItems.releaseReturnValue();
</span><span class="cx">
</span><ins>+ PaymentMethodUpdate update;
+ update.status = PaymentAuthorizationStatus::Success;
+ update.newTotalAndLineItems = WTFMove(totalAndLineItems);
+
</ins><span class="cx"> m_state = State::Active;
</span><del>- paymentCoordinator().completePaymentMethodSelection(totalAndLineItems);
</del><ins>+ paymentCoordinator().completePaymentMethodSelection(WTFMove(update));
</ins><span class="cx">
</span><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="lines">@@ -726,8 +739,11 @@
</span><span class="cx"> if (!authorizationStatus)
</span><span class="cx"> return Exception { INVALID_ACCESS_ERR };
</span><span class="cx">
</span><del>- paymentCoordinator().completePaymentSession(*authorizationStatus);
</del><ins>+ PaymentAuthorizationResult result;
+ result.status = *authorizationStatus;
</ins><span class="cx">
</span><ins>+ paymentCoordinator().completePaymentSession(WTFMove(result));
+
</ins><span class="cx"> if (!isFinalStateStatus(*authorizationStatus)) {
</span><span class="cx"> m_state = State::Active;
</span><span class="cx"> return { };
</span><span class="lines">@@ -775,7 +791,7 @@
</span><span class="cx"> ASSERT(m_state == State::Active);
</span><span class="cx">
</span><span class="cx"> if (!hasEventListeners(eventNames().shippingmethodselectedEvent)) {
</span><del>- paymentCoordinator().completeShippingMethodSelection(PaymentAuthorizationStatus::Success, { });
</del><ins>+ paymentCoordinator().completeShippingMethodSelection({ });
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -789,7 +805,7 @@
</span><span class="cx"> ASSERT(m_state == State::Active);
</span><span class="cx">
</span><span class="cx"> if (!hasEventListeners(eventNames().shippingcontactselectedEvent)) {
</span><del>- paymentCoordinator().completeShippingContactSelection(PaymentAuthorizationStatus::Success, { }, { });
</del><ins>+ paymentCoordinator().completeShippingContactSelection({ });
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesapplepayPaymentAuthorizationStatush"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/applepay/PaymentAuthorizationStatus.h (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -27,6 +27,8 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(APPLE_PAY)
</span><span class="cx">
</span><ins>+#include <wtf/EnumTraits.h>
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> enum class PaymentAuthorizationStatus {
</span><span class="lines">@@ -59,4 +61,20 @@
</span><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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
+ >;
+};
+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesapplepayPaymentCoordinatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -83,33 +83,35 @@
</span><span class="cx"> m_client.completeMerchantValidation(paymentMerchantSession);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void PaymentCoordinator::completeShippingMethodSelection(PaymentAuthorizationStatus status, std::optional<PaymentRequest::TotalAndLineItems> newTotalAndItems)
</del><ins>+void PaymentCoordinator::completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&& update)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(m_activeSession);
</span><span class="cx">
</span><del>- m_client.completeShippingMethodSelection(status, WTFMove(newTotalAndItems));
</del><ins>+ m_client.completeShippingMethodSelection(WTFMove(update));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void PaymentCoordinator::completeShippingContactSelection(PaymentAuthorizationStatus status, const Vector<PaymentRequest::ShippingMethod>& newShippingMethods, std::optional<PaymentRequest::TotalAndLineItems> newTotalAndItems)
</del><ins>+void PaymentCoordinator::completeShippingContactSelection(std::optional<ShippingContactUpdate>&& update)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(m_activeSession);
</span><span class="cx">
</span><del>- m_client.completeShippingContactSelection(status, newShippingMethods, WTFMove(newTotalAndItems));
</del><ins>+ m_client.completeShippingContactSelection(WTFMove(update));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void PaymentCoordinator::completePaymentMethodSelection(std::optional<PaymentRequest::TotalAndLineItems> newTotalAndItems)
</del><ins>+void PaymentCoordinator::completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&& update)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(m_activeSession);
</span><span class="cx">
</span><del>- m_client.completePaymentMethodSelection(WTFMove(newTotalAndItems));
</del><ins>+ m_client.completePaymentMethodSelection(WTFMove(update));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void PaymentCoordinator::completePaymentSession(PaymentAuthorizationStatus status)
</del><ins>+void PaymentCoordinator::completePaymentSession(std::optional<PaymentAuthorizationResult>&& result)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(m_activeSession);
</span><span class="cx">
</span><del>- m_client.completePaymentSession(status);
</del><ins>+ auto status = result ? result->status : PaymentAuthorizationStatus::Success;
</ins><span class="cx">
</span><ins>+ m_client.completePaymentSession(WTFMove(result));
+
</ins><span class="cx"> if (!isFinalStateStatus(status))
</span><span class="cx"> return;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesapplepayPaymentCoordinatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -40,6 +40,10 @@
</span><span class="cx"> class PaymentMethod;
</span><span class="cx"> class URL;
</span><span class="cx"> enum class PaymentAuthorizationStatus;
</span><ins>+struct PaymentAuthorizationResult;
+struct PaymentMethodUpdate;
+struct ShippingContactUpdate;
+struct ShippingMethodUpdate;
</ins><span class="cx">
</span><span class="cx"> class PaymentCoordinator {
</span><span class="cx"> public:
</span><span class="lines">@@ -55,10 +59,10 @@
</span><span class="cx">
</span><span class="cx"> bool beginPaymentSession(ApplePaySession&, const URL& originatingURL, const Vector<URL>& linkIconURLs, const PaymentRequest&);
</span><span class="cx"> void completeMerchantValidation(const PaymentMerchantSession&);
</span><del>- 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);
</del><ins>+ void completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&&);
+ void completeShippingContactSelection(std::optional<ShippingContactUpdate>&&);
+ void completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&&);
+ void completePaymentSession(std::optional<PaymentAuthorizationResult>&&);
</ins><span class="cx"> void abortPaymentSession();
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT void validateMerchant(const URL& validationURL);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesapplepayPaymentCoordinatorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -35,7 +35,10 @@
</span><span class="cx">
</span><span class="cx"> class PaymentMerchantSession;
</span><span class="cx"> class URL;
</span><del>-enum class PaymentAuthorizationStatus;
</del><ins>+struct PaymentAuthorizationResult;
+struct PaymentMethodUpdate;
+struct ShippingContactUpdate;
+struct ShippingMethodUpdate;
</ins><span class="cx">
</span><span class="cx"> class PaymentCoordinatorClient {
</span><span class="cx"> public:
</span><span class="lines">@@ -46,10 +49,10 @@
</span><span class="cx">
</span><span class="cx"> virtual bool showPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const PaymentRequest&) = 0;
</span><span class="cx"> virtual void completeMerchantValidation(const PaymentMerchantSession&) = 0;
</span><del>- 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;
</del><ins>+ 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;
</ins><span class="cx"> virtual void abortPaymentSession() = 0;
</span><span class="cx"> virtual void paymentCoordinatorDestroyed() = 0;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesapplepayPaymentRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/applepay/PaymentRequest.h (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #if ENABLE(APPLE_PAY)
</span><span class="cx">
</span><span class="cx"> #include "PaymentContact.h"
</span><ins>+#include <wtf/EnumTraits.h>
</ins><span class="cx"> #include <wtf/Optional.h>
</span><span class="cx"> #include <wtf/Vector.h>
</span><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="lines">@@ -34,6 +35,8 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+enum class PaymentAuthorizationStatus;
+
</ins><span class="cx"> class PaymentRequest {
</span><span class="cx"> public:
</span><span class="cx"> WEBCORE_EXPORT PaymentRequest();
</span><span class="lines">@@ -147,6 +150,85 @@
</span><span class="cx"> String m_applicationData;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+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;
+};
+
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+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
+ >;
+};
+
+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderEmptyClientscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -490,10 +490,10 @@
</span><span class="cx"> void openPaymentSetup(const String&, const String&, std::function<void(bool)> completionHandler) final { callOnMainThread([completionHandler] { completionHandler(false); }); }
</span><span class="cx"> bool showPaymentUI(const URL&, const Vector<URL>&, const PaymentRequest&) final { return false; }
</span><span class="cx"> void completeMerchantValidation(const PaymentMerchantSession&) final { }
</span><del>- 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 { }
</del><ins>+ void completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&&) final { }
+ void completeShippingContactSelection(std::optional<ShippingContactUpdate>&&) final { }
+ void completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&&) final { }
+ void completePaymentSession(std::optional<PaymentAuthorizationResult>&&) final { }
</ins><span class="cx"> void abortPaymentSession() final { }
</span><span class="cx"> void paymentCoordinatorDestroyed() final { }
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2017-03-08 Anders Carlsson <andersca@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):
+
</ins><span class="cx"> 2017-03-08 Megan Gardner <megan_gardner@apple.com>
</span><span class="cx">
</span><span class="cx"> Fix for dependency fix
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebPaymentCoordinatorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.h (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -42,10 +42,10 @@
</span><span class="cx"> void openPaymentSetup(const String& merchantIdentifier, const String& domainName, std::function<void (bool)> completionHandler) override;
</span><span class="cx"> bool showPaymentUI(const WebCore::URL&, const Vector<WebCore::URL>& linkIconURLs, const WebCore::PaymentRequest&) override;
</span><span class="cx"> void completeMerchantValidation(const WebCore::PaymentMerchantSession&) override;
</span><del>- 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;
</del><ins>+ 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;
</ins><span class="cx"> void abortPaymentSession() override;
</span><span class="cx"> void paymentCoordinatorDestroyed() override;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebPaymentCoordinatorClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -71,19 +71,19 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPaymentCoordinatorClient::completeShippingMethodSelection(WebCore::PaymentAuthorizationStatus, std::optional<WebCore::PaymentRequest::TotalAndLineItems>)
</del><ins>+void WebPaymentCoordinatorClient::completeShippingMethodSelection(std::optional<WebCore::ShippingMethodUpdate>&&)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPaymentCoordinatorClient::completeShippingContactSelection(WebCore::PaymentAuthorizationStatus, const Vector<WebCore::PaymentRequest::ShippingMethod>&, std::optional<WebCore::PaymentRequest::TotalAndLineItems>)
</del><ins>+void WebPaymentCoordinatorClient::completeShippingContactSelection(std::optional<WebCore::ShippingContactUpdate>&&)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPaymentCoordinatorClient::completePaymentMethodSelection(std::optional<WebCore::PaymentRequest::TotalAndLineItems>)
</del><ins>+void WebPaymentCoordinatorClient::completePaymentMethodSelection(std::optional<WebCore::PaymentMethodUpdate>&&)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPaymentCoordinatorClient::completePaymentSession(WebCore::PaymentAuthorizationStatus)
</del><ins>+void WebPaymentCoordinatorClient::completePaymentSession(std::optional<WebCore::PaymentAuthorizationResult>&&)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,48 @@
</span><ins>+2017-03-08 Anders Carlsson <andersca@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:
+
</ins><span class="cx"> 2017-03-08 Brent Fulgham <bfulgham@apple.com>
</span><span class="cx">
</span><span class="cx"> Remove the trace command from the sandbox profile.
</span></span></pre></div>
<a id="trunkSourceWebKit2Scriptswebkitmessagespy"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Scripts/webkit/messages.py (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -358,8 +358,12 @@
</span><span class="cx"> 'WebCore::MediaConstraintsData': ['<WebCore/MediaConstraintsImpl.h>'],
</span><span class="cx"> 'WebCore::PasteboardImage': ['<WebCore/Pasteboard.h>'],
</span><span class="cx"> 'WebCore::PasteboardWebContent': ['<WebCore/Pasteboard.h>'],
</span><ins>+ 'WebCore::PaymentAuthorizationResult': ['<WebCore/PaymentRequest.h>'],
+ 'WebCore::PaymentMethodUpdate': ['<WebCore/PaymentRequest.h>'],
</ins><span class="cx"> 'WebCore::PluginInfo': ['<WebCore/PluginData.h>'],
</span><span class="cx"> 'WebCore::RecentSearch': ['<WebCore/SearchPopupMenu.h>'],
</span><ins>+ 'WebCore::ShippingContactUpdate': ['<WebCore/PaymentRequest.h>'],
+ 'WebCore::ShippingMethodUpdate': ['<WebCore/PaymentRequest.h>'],
</ins><span class="cx"> 'WebCore::ShouldSample': ['<WebCore/DiagnosticLoggingClient.h>'],
</span><span class="cx"> 'WebCore::TextCheckingRequestData': ['<WebCore/TextChecking.h>'],
</span><span class="cx"> 'WebCore::TextCheckingResult': ['<WebCore/TextCheckerClient.h>'],
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedCocoaWebCoreArgumentCodersCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx">
</span><span class="cx"> #import "DataReference.h"
</span><span class="cx"> #import <WebCore/PassKitSPI.h>
</span><ins>+#import <WebCore/PaymentAuthorizationStatus.h>
</ins><span class="cx"> #import <WebCore/SoftLinking.h>
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="lines">@@ -81,6 +82,22 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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;
+}
+
</ins><span class="cx"> void ArgumentCoder<WebCore::PaymentContact>::encode(Encoder& encoder, const WebCore::PaymentContact& paymentContact)
</span><span class="cx"> {
</span><span class="cx"> auto data = adoptNS([[NSMutableData alloc] init]);
</span><span class="lines">@@ -115,6 +132,25 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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;
+}
+
</ins><span class="cx"> void ArgumentCoder<WebCore::PaymentMerchantSession>::encode(Encoder& encoder, const WebCore::PaymentMerchantSession& paymentMerchantSession)
</span><span class="cx"> {
</span><span class="cx"> auto data = adoptNS([[NSMutableData alloc] init]);
</span><span class="lines">@@ -184,6 +220,22 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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;
+}
+
</ins><span class="cx"> void ArgumentCoder<PaymentRequest>::encode(Encoder& encoder, const PaymentRequest& request)
</span><span class="cx"> {
</span><span class="cx"> encoder << request.countryCode();
</span><span class="lines">@@ -370,6 +422,44 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void ArgumentCoder<WebCore::ShippingContactUpdate>::encode(Encoder& encoder, const WebCore::ShippingContactUpdate& update)
+{
+ encoder << update.status;
+ encoder << update.errors;
+ encoder << update.newShippingMethods;
+ encoder << update.newTotalAndLineItems;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+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;
+}
+
+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebCoreArgumentCodersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -546,11 +546,21 @@
</span><span class="cx"> static bool decode(Decoder&, WebCore::Payment&);
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+template<> struct ArgumentCoder<WebCore::PaymentAuthorizationResult> {
+ static void encode(Encoder&, const WebCore::PaymentAuthorizationResult&);
+ static bool decode(Decoder&, WebCore::PaymentAuthorizationResult&);
+};
+
</ins><span class="cx"> template<> struct ArgumentCoder<WebCore::PaymentContact> {
</span><span class="cx"> static void encode(Encoder&, const WebCore::PaymentContact&);
</span><span class="cx"> static bool decode(Decoder&, WebCore::PaymentContact&);
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+template<> struct ArgumentCoder<WebCore::PaymentError> {
+ static void encode(Encoder&, const WebCore::PaymentError&);
+ static bool decode(Decoder&, WebCore::PaymentError&);
+};
+
</ins><span class="cx"> template<> struct ArgumentCoder<WebCore::PaymentMerchantSession> {
</span><span class="cx"> static void encode(Encoder&, const WebCore::PaymentMerchantSession&);
</span><span class="cx"> static bool decode(Decoder&, WebCore::PaymentMerchantSession&);
</span><span class="lines">@@ -561,6 +571,11 @@
</span><span class="cx"> static bool decode(Decoder&, WebCore::PaymentMethod&);
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+template<> struct ArgumentCoder<WebCore::PaymentMethodUpdate> {
+ static void encode(Encoder&, const WebCore::PaymentMethodUpdate&);
+ static bool decode(Decoder&, WebCore::PaymentMethodUpdate&);
+};
+
</ins><span class="cx"> template<> struct ArgumentCoder<WebCore::PaymentRequest> {
</span><span class="cx"> static void encode(Encoder&, const WebCore::PaymentRequest&);
</span><span class="cx"> static bool decode(Decoder&, WebCore::PaymentRequest&);
</span><span class="lines">@@ -591,6 +606,16 @@
</span><span class="cx"> static bool decode(Decoder&, WebCore::PaymentRequest::TotalAndLineItems&);
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+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&);
+};
+
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessApplePayWebPaymentCoordinatorProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -120,23 +120,7 @@
</span><span class="cx"> result = true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-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;
-}
-
</del><ins>+
</ins><span class="cx"> void WebPaymentCoordinatorProxy::completeMerchantValidation(const WebCore::PaymentMerchantSession& paymentMerchantSession)
</span><span class="cx"> {
</span><span class="cx"> // It's possible that the payment has been canceled already.
</span><span class="lines">@@ -150,7 +134,7 @@
</span><span class="cx"> m_merchantValidationState = MerchantValidationState::ValidationComplete;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPaymentCoordinatorProxy::completeShippingMethodSelection(uint32_t opaqueStatus, const std::optional<WebCore::PaymentRequest::TotalAndLineItems>& newTotalAndLineItems)
</del><ins>+void WebPaymentCoordinatorProxy::completeShippingMethodSelection(const std::optional<WebCore::ShippingMethodUpdate>& update)
</ins><span class="cx"> {
</span><span class="cx"> // It's possible that the payment has been canceled already.
</span><span class="cx"> if (m_state == State::Idle)
</span><span class="lines">@@ -159,16 +143,11 @@
</span><span class="cx"> // FIXME: This should be a MESSAGE_CHECK.
</span><span class="cx"> ASSERT(m_state == State::ShippingMethodSelected);
</span><span class="cx">
</span><del>- auto status = static_cast<WebCore::PaymentAuthorizationStatus>(opaqueStatus);
-
- // FIXME: Make this a message check.
- RELEASE_ASSERT(isValidEnum(status));
-
- platformCompleteShippingMethodSelection(status, newTotalAndLineItems);
</del><ins>+ platformCompleteShippingMethodSelection(update);
</ins><span class="cx"> m_state = State::Active;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPaymentCoordinatorProxy::completeShippingContactSelection(uint32_t opaqueStatus, const Vector<WebCore::PaymentRequest::ShippingMethod>& newShippingMethods, const std::optional<WebCore::PaymentRequest::TotalAndLineItems>& newTotalAndLineItems)
</del><ins>+void WebPaymentCoordinatorProxy::completeShippingContactSelection(const std::optional<WebCore::ShippingContactUpdate>& update)
</ins><span class="cx"> {
</span><span class="cx"> // It's possible that the payment has been canceled already.
</span><span class="cx"> if (m_state == State::Idle)
</span><span class="lines">@@ -177,16 +156,11 @@
</span><span class="cx"> // FIXME: This should be a MESSAGE_CHECK.
</span><span class="cx"> ASSERT(m_state == State::ShippingContactSelected);
</span><span class="cx">
</span><del>- auto status = static_cast<WebCore::PaymentAuthorizationStatus>(opaqueStatus);
-
- // FIXME: Make this a message check.
- RELEASE_ASSERT(isValidEnum(status));
-
- platformCompleteShippingContactSelection(status, newShippingMethods, newTotalAndLineItems);
</del><ins>+ platformCompleteShippingContactSelection(update);
</ins><span class="cx"> m_state = State::Active;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPaymentCoordinatorProxy::completePaymentMethodSelection(const std::optional<WebCore::PaymentRequest::TotalAndLineItems>& newTotalAndLineItems)
</del><ins>+void WebPaymentCoordinatorProxy::completePaymentMethodSelection(const std::optional<WebCore::PaymentMethodUpdate>& update)
</ins><span class="cx"> {
</span><span class="cx"> // It's possible that the payment has been canceled already.
</span><span class="cx"> if (m_state == State::Idle)
</span><span class="lines">@@ -195,24 +169,19 @@
</span><span class="cx"> // FIXME: This should be a MESSAGE_CHECK.
</span><span class="cx"> ASSERT(m_state == State::PaymentMethodSelected);
</span><span class="cx">
</span><del>- platformCompletePaymentMethodSelection(newTotalAndLineItems);
</del><ins>+ platformCompletePaymentMethodSelection(update);
</ins><span class="cx"> m_state = State::Active;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPaymentCoordinatorProxy::completePaymentSession(uint32_t opaqueStatus)
</del><ins>+void WebPaymentCoordinatorProxy::completePaymentSession(const std::optional<WebCore::PaymentAuthorizationResult>& result)
</ins><span class="cx"> {
</span><span class="cx"> // It's possible that the payment has been canceled already.
</span><span class="cx"> if (!canCompletePayment())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- auto status = static_cast<WebCore::PaymentAuthorizationStatus>(opaqueStatus);
</del><ins>+ platformCompletePaymentSession(result);
</ins><span class="cx">
</span><del>- // FIXME: Make this a message check.
- RELEASE_ASSERT(isValidEnum(status));
-
- platformCompletePaymentSession(status);
-
- if (!WebCore::isFinalStateStatus(status)) {
</del><ins>+ if (!WebCore::isFinalStateStatus(result ? result->status : WebCore::PaymentAuthorizationStatus::Success)) {
</ins><span class="cx"> m_state = State::Active;
</span><span class="cx"> return;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessApplePayWebPaymentCoordinatorProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -80,10 +80,10 @@
</span><span class="cx"> void openPaymentSetup(const String& merchantIdentifier, const String& domainName, uint64_t requestID);
</span><span class="cx"> void showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::PaymentRequest&, bool& result);
</span><span class="cx"> void completeMerchantValidation(const WebCore::PaymentMerchantSession&);
</span><del>- 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);
</del><ins>+ 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>&);
</ins><span class="cx"> void abortPaymentSession();
</span><span class="cx">
</span><span class="cx"> bool canBegin() const;
</span><span class="lines">@@ -98,10 +98,10 @@
</span><span class="cx"> void platformOpenPaymentSetup(const String& merchantIdentifier, const String& domainName, std::function<void (bool)> completionHandler);
</span><span class="cx"> void platformShowPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::PaymentRequest&, std::function<void (bool)> completionHandler);
</span><span class="cx"> void platformCompleteMerchantValidation(const WebCore::PaymentMerchantSession&);
</span><del>- 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);
</del><ins>+ 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>&);
</ins><span class="cx">
</span><span class="cx"> WebPageProxy& m_webPageProxy;
</span><span class="cx"> WeakPtrFactory<WebPaymentCoordinatorProxy> m_weakPtrFactory;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessApplePayWebPaymentCoordinatorProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -31,11 +31,11 @@
</span><span class="cx"> OpenPaymentSetup(String merchantIdentifier, String domainName, uint64_t requestID)
</span><span class="cx">
</span><span class="cx"> ShowPaymentUI(String originatingURLString, Vector<String> linkIconURLStrings, WebCore::PaymentRequest paymentRequest) -> (bool result)
</span><del>- 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)
</del><ins>+ 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)
</ins><span class="cx"> AbortPaymentSession()
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessApplePaycocoaWebPaymentCoordinatorProxyCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -451,11 +451,13 @@
</span><span class="cx"> #pragma clang diagnostic pop
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPaymentCoordinatorProxy::platformCompletePaymentSession(WebCore::PaymentAuthorizationStatus status)
</del><ins>+void WebPaymentCoordinatorProxy::platformCompletePaymentSession(const std::optional<WebCore::PaymentAuthorizationResult>& result)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(m_paymentAuthorizationViewController);
</span><span class="cx"> ASSERT(m_paymentAuthorizationViewControllerDelegate);
</span><span class="cx">
</span><ins>+ auto status = result ? result->status : WebCore::PaymentAuthorizationStatus::Success;
+
</ins><span class="cx"> m_paymentAuthorizationViewControllerDelegate->_didReachFinalState = WebCore::isFinalStateStatus(status);
</span><span class="cx"> m_paymentAuthorizationViewControllerDelegate->_paymentAuthorizedCompletion(toPKPaymentAuthorizationStatus(status));
</span><span class="cx"> m_paymentAuthorizationViewControllerDelegate->_paymentAuthorizedCompletion = nullptr;
</span><span class="lines">@@ -470,19 +472,21 @@
</span><span class="cx"> m_paymentAuthorizationViewControllerDelegate->_sessionBlock = nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection(WebCore::PaymentAuthorizationStatus status, const std::optional<WebCore::PaymentRequest::TotalAndLineItems>& newTotalAndLineItems)
</del><ins>+void WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection(const std::optional<WebCore::ShippingMethodUpdate>& update)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(m_paymentAuthorizationViewController);
</span><span class="cx"> ASSERT(m_paymentAuthorizationViewControllerDelegate);
</span><span class="cx">
</span><del>- if (newTotalAndLineItems) {
</del><ins>+ auto status = update ? update->status : WebCore::PaymentAuthorizationStatus::Success;
+
+ if (update) {
</ins><span class="cx"> auto paymentSummaryItems = adoptNS([[NSMutableArray alloc] init]);
</span><del>- for (auto& lineItem : newTotalAndLineItems->lineItems) {
</del><ins>+ for (auto& lineItem : update->newTotalAndLineItems.lineItems) {
</ins><span class="cx"> if (auto summaryItem = toPKPaymentSummaryItem(lineItem))
</span><span class="cx"> [paymentSummaryItems addObject:summaryItem.get()];
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (auto totalItem = toPKPaymentSummaryItem(newTotalAndLineItems->total))
</del><ins>+ if (auto totalItem = toPKPaymentSummaryItem(update->newTotalAndLineItems.total))
</ins><span class="cx"> [paymentSummaryItems addObject:totalItem.get()];
</span><span class="cx">
</span><span class="cx"> m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems = WTFMove(paymentSummaryItems);
</span><span class="lines">@@ -492,25 +496,27 @@
</span><span class="cx"> m_paymentAuthorizationViewControllerDelegate->_didSelectShippingMethodCompletion = nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection(WebCore::PaymentAuthorizationStatus status, const Vector<WebCore::PaymentRequest::ShippingMethod>& newShippingMethods, const std::optional<WebCore::PaymentRequest::TotalAndLineItems>& newTotalAndLineItems)
</del><ins>+void WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection(const std::optional<WebCore::ShippingContactUpdate>& update)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(m_paymentAuthorizationViewController);
</span><span class="cx"> ASSERT(m_paymentAuthorizationViewControllerDelegate);
</span><span class="cx">
</span><del>- if (newTotalAndLineItems) {
</del><ins>+ auto status = update ? update->status : WebCore::PaymentAuthorizationStatus::Success;
+
+ if (update) {
</ins><span class="cx"> auto paymentSummaryItems = adoptNS([[NSMutableArray alloc] init]);
</span><del>- for (auto& lineItem : newTotalAndLineItems->lineItems) {
</del><ins>+ for (auto& lineItem : update->newTotalAndLineItems.lineItems) {
</ins><span class="cx"> if (auto summaryItem = toPKPaymentSummaryItem(lineItem))
</span><span class="cx"> [paymentSummaryItems addObject:summaryItem.get()];
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (auto totalItem = toPKPaymentSummaryItem(newTotalAndLineItems->total))
</del><ins>+ if (auto totalItem = toPKPaymentSummaryItem(update->newTotalAndLineItems.total))
</ins><span class="cx"> [paymentSummaryItems addObject:totalItem.get()];
</span><span class="cx">
</span><span class="cx"> m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems = WTFMove(paymentSummaryItems);
</span><span class="cx">
</span><span class="cx"> auto shippingMethods = adoptNS([[NSMutableArray alloc] init]);
</span><del>- for (auto& shippingMethod : newShippingMethods)
</del><ins>+ for (auto& shippingMethod : update->newShippingMethods)
</ins><span class="cx"> [shippingMethods addObject:toPKShippingMethod(shippingMethod).get()];
</span><span class="cx">
</span><span class="cx"> m_paymentAuthorizationViewControllerDelegate->_shippingMethods = WTFMove(shippingMethods);
</span><span class="lines">@@ -520,19 +526,19 @@
</span><span class="cx"> m_paymentAuthorizationViewControllerDelegate->_didSelectShippingContactCompletion = nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection(const std::optional<WebCore::PaymentRequest::TotalAndLineItems>& newTotalAndLineItems)
</del><ins>+void WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection(const std::optional<WebCore::PaymentMethodUpdate>& update)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(m_paymentAuthorizationViewController);
</span><span class="cx"> ASSERT(m_paymentAuthorizationViewControllerDelegate);
</span><span class="cx">
</span><del>- if (newTotalAndLineItems) {
</del><ins>+ if (update) {
</ins><span class="cx"> auto paymentSummaryItems = adoptNS([[NSMutableArray alloc] init]);
</span><del>- for (auto& lineItem : newTotalAndLineItems->lineItems) {
</del><ins>+ for (auto& lineItem : update->newTotalAndLineItems.lineItems) {
</ins><span class="cx"> if (auto summaryItem = toPKPaymentSummaryItem(lineItem))
</span><span class="cx"> [paymentSummaryItems addObject:summaryItem.get()];
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (auto totalItem = toPKPaymentSummaryItem(newTotalAndLineItems->total))
</del><ins>+ if (auto totalItem = toPKPaymentSummaryItem(update->newTotalAndLineItems.total))
</ins><span class="cx"> [paymentSummaryItems addObject:totalItem.get()];
</span><span class="cx">
</span><span class="cx"> m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems = WTFMove(paymentSummaryItems);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessApplePayWebPaymentCoordinatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.cpp (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -117,24 +117,24 @@
</span><span class="cx"> m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteMerchantValidation(paymentMerchantSession));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPaymentCoordinator::completeShippingMethodSelection(WebCore::PaymentAuthorizationStatus status, std::optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems)
</del><ins>+void WebPaymentCoordinator::completeShippingMethodSelection(std::optional<WebCore::ShippingMethodUpdate>&& update)
</ins><span class="cx"> {
</span><del>- m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteShippingMethodSelection(static_cast<uint32_t>(status), newTotalAndItems));
</del><ins>+ m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteShippingMethodSelection(update));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPaymentCoordinator::completeShippingContactSelection(WebCore::PaymentAuthorizationStatus status, const Vector<WebCore::PaymentRequest::ShippingMethod>& newShippingMethods, std::optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems)
</del><ins>+void WebPaymentCoordinator::completeShippingContactSelection(std::optional<WebCore::ShippingContactUpdate>&& update)
</ins><span class="cx"> {
</span><del>- m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteShippingContactSelection(static_cast<uint32_t>(status), newShippingMethods, newTotalAndItems));
</del><ins>+ m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteShippingContactSelection(update));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPaymentCoordinator::completePaymentMethodSelection(std::optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems)
</del><ins>+void WebPaymentCoordinator::completePaymentMethodSelection(std::optional<WebCore::PaymentMethodUpdate>&& update)
</ins><span class="cx"> {
</span><del>- m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompletePaymentMethodSelection(newTotalAndItems));
</del><ins>+ m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompletePaymentMethodSelection(update));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPaymentCoordinator::completePaymentSession(WebCore::PaymentAuthorizationStatus status)
</del><ins>+void WebPaymentCoordinator::completePaymentSession(std::optional<WebCore::PaymentAuthorizationResult>&& result)
</ins><span class="cx"> {
</span><del>- m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompletePaymentSession(static_cast<uint32_t>(status)));
</del><ins>+ m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompletePaymentSession(result));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebPaymentCoordinator::abortPaymentSession()
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessApplePayWebPaymentCoordinatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.h (213600 => 213601)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -59,10 +59,11 @@
</span><span class="cx"> void openPaymentSetup(const String& merchantIdentifier, const String& domainName, std::function<void (bool)> completionHandler) override;
</span><span class="cx"> bool showPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::PaymentRequest&) override;
</span><span class="cx"> void completeMerchantValidation(const WebCore::PaymentMerchantSession&) override;
</span><del>- 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;
</del><ins>+ 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;
+
</ins><span class="cx"> void abortPaymentSession() override;
</span><span class="cx">
</span><span class="cx"> void paymentCoordinatorDestroyed() override;
</span></span></pre>
</div>
</div>
</body>
</html>