<!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>[202432] trunk/Source/WebKit2</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/202432">202432</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2016-06-24 11:31:05 -0700 (Fri, 24 Jun 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move WebKit2 Apple Pay code to the open source repository
https://bugs.webkit.org/show_bug.cgi?id=159041

Reviewed by Sam Weinig.

* DerivedSources.make:
* Shared/Cocoa/WebCoreArgumentCodersCocoa.h: Added.
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: Added.
* UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp: Added.
* UIProcess/ApplePay/WebPaymentCoordinatorProxy.h: Added.
* UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in: Added.
* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: Added.
* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: Added.
* UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: Added.
* UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: Added.
* UIProcess/WebPageProxy.cpp:
* UIProcess/WebPageProxy.h:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/ApplePay/WebPaymentCoordinator.cpp: Added.
* WebProcess/ApplePay/WebPaymentCoordinator.h: Added.
* WebProcess/ApplePay/WebPaymentCoordinator.messages.in: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2CMakeListstxt">trunk/Source/WebKit2/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2DerivedSourcesmake">trunk/Source/WebKit2/DerivedSources.make</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2SharedCocoaWebCoreArgumentCodersCocoah">trunk/Source/WebKit2/Shared/Cocoa/WebCoreArgumentCodersCocoa.h</a></li>
<li><a href="#trunkSourceWebKit2SharedCocoaWebCoreArgumentCodersCocoamm">trunk/Source/WebKit2/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm</a></li>
<li>trunk/Source/WebKit2/UIProcess/ApplePay/</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>trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/</li>
<li><a href="#trunkSourceWebKit2UIProcessApplePaycocoaWebPaymentCoordinatorProxyCocoah">trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessApplePaycocoaWebPaymentCoordinatorProxyCocoamm">trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm</a></li>
<li>trunk/Source/WebKit2/UIProcess/ApplePay/ios/</li>
<li><a href="#trunkSourceWebKit2UIProcessApplePayiosWebPaymentCoordinatorProxyIOSmm">trunk/Source/WebKit2/UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm</a></li>
<li>trunk/Source/WebKit2/UIProcess/ApplePay/mac/</li>
<li><a href="#trunkSourceWebKit2UIProcessApplePaymacWebPaymentCoordinatorProxyMacmm">trunk/Source/WebKit2/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm</a></li>
<li>trunk/Source/WebKit2/WebProcess/ApplePay/</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>
<li><a href="#trunkSourceWebKit2WebProcessApplePayWebPaymentCoordinatormessagesin">trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.messages.in</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2SharedCocoaWebKitAdditionsmm">trunk/Source/WebKit2/Shared/Cocoa/WebKitAdditions.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2CMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/CMakeLists.txt (202431 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/CMakeLists.txt        2016-06-24 18:21:05 UTC (rev 202431)
+++ trunk/Source/WebKit2/CMakeLists.txt        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/API&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/API/C&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/API/cpp&quot;
</span><ins>+    &quot;${WEBKIT2_DIR}/UIProcess/ApplePay&quot;
</ins><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/Authentication&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/Automation&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/Databases&quot;
</span><span class="lines">@@ -43,6 +44,7 @@
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/UserContent&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/WebsiteData&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess&quot;
</span><ins>+    &quot;${WEBKIT2_DIR}/WebProcess/ApplePay&quot;
</ins><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/ApplicationCache&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/Automation&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/Battery&quot;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (202431 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-06-24 18:21:05 UTC (rev 202431)
+++ trunk/Source/WebKit2/ChangeLog        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2016-06-22  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Move WebKit2 Apple Pay code to the open source repository
+        https://bugs.webkit.org/show_bug.cgi?id=159041
+
+        Reviewed by Sam Weinig.
+
+        * DerivedSources.make:
+        * Shared/Cocoa/WebCoreArgumentCodersCocoa.h: Added.
+        * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: Added.
+        * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp: Added.
+        * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h: Added.
+        * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in: Added.
+        * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: Added.
+        * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: Added.
+        * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: Added.
+        * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: Added.
+        * UIProcess/WebPageProxy.cpp:
+        * UIProcess/WebPageProxy.h:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/ApplePay/WebPaymentCoordinator.cpp: Added.
+        * WebProcess/ApplePay/WebPaymentCoordinator.h: Added.
+        * WebProcess/ApplePay/WebPaymentCoordinator.messages.in: Added.
+
</ins><span class="cx"> 2016-06-24  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WK2] PageConfiguration.m_relatedPage keeps WebPageProxy alive after its WebView has been destroyed
</span></span></pre></div>
<a id="trunkSourceWebKit2DerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DerivedSources.make (202431 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DerivedSources.make        2016-06-24 18:21:05 UTC (rev 202431)
+++ trunk/Source/WebKit2/DerivedSources.make        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx">     $(WebKit2)/Shared/API/Cocoa \
</span><span class="cx">     $(WebKit2)/Shared/Authentication \
</span><span class="cx">     $(WebKit2)/Shared/mac \
</span><ins>+    $(WebKit2)/WebProcess/ApplePay \
</ins><span class="cx">     $(WebKit2)/WebProcess/ApplicationCache \
</span><span class="cx">     $(WebKit2)/WebProcess/Automation \
</span><span class="cx">     $(WebKit2)/WebProcess/Cookies \
</span><span class="lines">@@ -57,6 +58,7 @@
</span><span class="cx">     $(WebKit2)/WebProcess/ios \
</span><span class="cx">     $(WebKit2)/WebProcess \
</span><span class="cx">     $(WebKit2)/UIProcess \
</span><ins>+    $(WebKit2)/UIProcess/ApplePay \
</ins><span class="cx">     $(WebKit2)/UIProcess/Automation \
</span><span class="cx">     $(WebKit2)/UIProcess/Cocoa \
</span><span class="cx">     $(WebKit2)/UIProcess/Databases \
</span><span class="lines">@@ -138,6 +140,8 @@
</span><span class="cx">     WebPage \
</span><span class="cx">     WebPageProxy \
</span><span class="cx">     WebPasteboardProxy \
</span><ins>+    WebPaymentCoordinator \
+    WebPaymentCoordinatorProxy \
</ins><span class="cx">     WebPlaybackSessionManager \
</span><span class="cx">     WebPlaybackSessionManagerProxy \
</span><span class="cx">     WebProcess \
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedCocoaWebCoreArgumentCodersCocoah"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/Shared/Cocoa/WebCoreArgumentCodersCocoa.h (0 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Cocoa/WebCoreArgumentCodersCocoa.h                                (rev 0)
+++ trunk/Source/WebKit2/Shared/Cocoa/WebCoreArgumentCodersCocoa.h        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -0,0 +1,91 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(APPLE_PAY)
+
+#include &lt;WebCore/PaymentHeaders.h&gt;
+
+namespace IPC {
+
+template&lt;&gt; struct ArgumentCoder&lt;WebCore::Payment&gt; {
+    static void encode(ArgumentEncoder&amp;, const WebCore::Payment&amp;);
+    static bool decode(ArgumentDecoder&amp;, WebCore::Payment&amp;);
+};
+
+template&lt;&gt; struct ArgumentCoder&lt;WebCore::PaymentContact&gt; {
+    static void encode(ArgumentEncoder&amp;, const WebCore::PaymentContact&amp;);
+    static bool decode(ArgumentDecoder&amp;, WebCore::PaymentContact&amp;);
+};
+
+template&lt;&gt; struct ArgumentCoder&lt;WebCore::PaymentMerchantSession&gt; {
+    static void encode(ArgumentEncoder&amp;, const WebCore::PaymentMerchantSession&amp;);
+    static bool decode(ArgumentDecoder&amp;, WebCore::PaymentMerchantSession&amp;);
+};
+
+template&lt;&gt; struct ArgumentCoder&lt;WebCore::PaymentMethod&gt; {
+    static void encode(ArgumentEncoder&amp;, const WebCore::PaymentMethod&amp;);
+    static bool decode(ArgumentDecoder&amp;, WebCore::PaymentMethod&amp;);
+};
+
+template&lt;&gt; struct ArgumentCoder&lt;WebCore::PaymentRequest&gt; {
+    static void encode(ArgumentEncoder&amp;, const WebCore::PaymentRequest&amp;);
+    static bool decode(ArgumentDecoder&amp;, WebCore::PaymentRequest&amp;);
+};
+
+template&lt;&gt; struct ArgumentCoder&lt;WebCore::PaymentRequest::AddressFields&gt; {
+    static void encode(ArgumentEncoder&amp;, const WebCore::PaymentRequest::AddressFields&amp;);
+    static bool decode(ArgumentDecoder&amp;, WebCore::PaymentRequest::AddressFields&amp;);
+};
+
+template&lt;&gt; struct ArgumentCoder&lt;WebCore::PaymentRequest::LineItem&gt; {
+    static void encode(ArgumentEncoder&amp;, const WebCore::PaymentRequest::LineItem&amp;);
+    static bool decode(ArgumentDecoder&amp;, WebCore::PaymentRequest::LineItem&amp;);
+};
+
+template&lt;&gt; struct ArgumentCoder&lt;WebCore::PaymentRequest::MerchantCapabilities&gt; {
+    static void encode(ArgumentEncoder&amp;, const WebCore::PaymentRequest::MerchantCapabilities&amp;);
+    static bool decode(ArgumentDecoder&amp;, WebCore::PaymentRequest::MerchantCapabilities&amp;);
+};
+
+template&lt;&gt; struct ArgumentCoder&lt;WebCore::PaymentRequest::ShippingMethod&gt; {
+    static void encode(ArgumentEncoder&amp;, const WebCore::PaymentRequest::ShippingMethod&amp;);
+    static bool decode(ArgumentDecoder&amp;, WebCore::PaymentRequest::ShippingMethod&amp;);
+};
+
+template&lt;&gt; struct ArgumentCoder&lt;WebCore::PaymentRequest::SupportedNetworks&gt; {
+    static void encode(ArgumentEncoder&amp;, const WebCore::PaymentRequest::SupportedNetworks&amp;);
+    static bool decode(ArgumentDecoder&amp;, WebCore::PaymentRequest::SupportedNetworks&amp;);
+};
+
+template&lt;&gt; struct ArgumentCoder&lt;WebCore::PaymentRequest::TotalAndLineItems&gt; {
+    static void encode(ArgumentEncoder&amp;, const WebCore::PaymentRequest::TotalAndLineItems&amp;);
+    static bool decode(ArgumentDecoder&amp;, WebCore::PaymentRequest::TotalAndLineItems&amp;);
+};
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2SharedCocoaWebCoreArgumentCodersCocoamm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm (0 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm                                (rev 0)
+++ trunk/Source/WebKit2/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -0,0 +1,398 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;WebCoreArgumentCoders.h&quot;
+
+#if ENABLE(APPLE_PAY)
+
+#import &quot;DataReference.h&quot;
+#import &lt;PassKit/PassKit.h&gt;
+#import &lt;WebCore/SoftLinking.h&gt;
+
+#if PLATFORM(MAC)
+SOFT_LINK_PRIVATE_FRAMEWORK(PassKit)
+#else
+SOFT_LINK_FRAMEWORK(PassKit)
+#endif
+
+SOFT_LINK_CLASS(PassKit, PKContact);
+SOFT_LINK_CLASS(PassKit, PKPayment);
+SOFT_LINK_CLASS(PassKit, PKPaymentMethod);
+
+using namespace WebCore;
+
+namespace IPC {
+
+void ArgumentCoder&lt;WebCore::Payment&gt;::encode(ArgumentEncoder&amp; encoder, const WebCore::Payment&amp; payment)
+{
+    auto data = adoptNS([[NSMutableData alloc] init]);
+    auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+
+    [archiver setRequiresSecureCoding:YES];
+
+    [archiver encodeObject:payment.pkPayment() forKey:NSKeyedArchiveRootObjectKey];
+    [archiver finishEncoding];
+
+    encoder &lt;&lt; DataReference(static_cast&lt;const uint8_t*&gt;([data bytes]), [data length]);
+}
+
+bool ArgumentCoder&lt;WebCore::Payment&gt;::decode(ArgumentDecoder&amp; decoder, WebCore::Payment&amp; payment)
+{
+    IPC::DataReference dataReference;
+    if (!decoder.decode(dataReference))
+        return false;
+
+    auto data = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast&lt;void*&gt;(static_cast&lt;const void*&gt;(dataReference.data())) length:dataReference.size() freeWhenDone:NO]);
+    auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:data.get()]);
+    [unarchiver setRequiresSecureCoding:YES];
+    @try {
+        PKPayment *pkPayment = [unarchiver decodeObjectOfClass:getPKPaymentClass() forKey:NSKeyedArchiveRootObjectKey];
+        payment = Payment(pkPayment);
+    } @catch (NSException *exception) {
+        LOG_ERROR(&quot;Failed to decode PKPayment: %@&quot;, exception);
+        return false;
+    }
+
+    [unarchiver finishDecoding];
+    return true;
+}
+
+void ArgumentCoder&lt;WebCore::PaymentContact&gt;::encode(ArgumentEncoder&amp; encoder, const WebCore::PaymentContact&amp; paymentContact)
+{
+    auto data = adoptNS([[NSMutableData alloc] init]);
+    auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+
+    [archiver setRequiresSecureCoding:YES];
+
+    [archiver encodeObject:paymentContact.pkContact() forKey:NSKeyedArchiveRootObjectKey];
+    [archiver finishEncoding];
+
+    encoder &lt;&lt; DataReference(static_cast&lt;const uint8_t*&gt;([data bytes]), [data length]);
+}
+
+bool ArgumentCoder&lt;WebCore::PaymentContact&gt;::decode(ArgumentDecoder&amp; decoder, WebCore::PaymentContact&amp; paymentContact)
+{
+    IPC::DataReference dataReference;
+    if (!decoder.decode(dataReference))
+        return false;
+
+    auto data = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast&lt;void*&gt;(static_cast&lt;const void*&gt;(dataReference.data())) length:dataReference.size() freeWhenDone:NO]);
+    auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:data.get()]);
+    [unarchiver setRequiresSecureCoding:YES];
+    @try {
+        PKContact *pkContact = [unarchiver decodeObjectOfClass:getPKContactClass() forKey:NSKeyedArchiveRootObjectKey];
+        paymentContact = PaymentContact(pkContact);
+    } @catch (NSException *exception) {
+        LOG_ERROR(&quot;Failed to decode PKContact: %@&quot;, exception);
+        return false;
+    }
+
+    [unarchiver finishDecoding];
+    return true;
+}
+
+void ArgumentCoder&lt;WebCore::PaymentMerchantSession&gt;::encode(ArgumentEncoder&amp; encoder, const WebCore::PaymentMerchantSession&amp; paymentMerchantSession)
+{
+    encoder &lt;&lt; paymentMerchantSession.merchantIdentifier;
+    encoder &lt;&lt; paymentMerchantSession.sessionIdentifier;
+    encoder &lt;&lt; paymentMerchantSession.nonce;
+    encoder &lt;&lt; paymentMerchantSession.domainName;
+    encoder &lt;&lt; paymentMerchantSession.epochTimestamp;
+    encoder &lt;&lt; paymentMerchantSession.signature;
+}
+
+bool ArgumentCoder&lt;WebCore::PaymentMerchantSession&gt;::decode(ArgumentDecoder&amp; decoder, WebCore::PaymentMerchantSession&amp; paymentMerchantSession)
+{
+    if (!decoder.decode(paymentMerchantSession.merchantIdentifier))
+        return false;
+    if (!decoder.decode(paymentMerchantSession.sessionIdentifier))
+        return false;
+    if (!decoder.decode(paymentMerchantSession.nonce))
+        return false;
+    if (!decoder.decode(paymentMerchantSession.domainName))
+        return false;
+    if (!decoder.decode(paymentMerchantSession.epochTimestamp))
+        return false;
+    if (!decoder.decode(paymentMerchantSession.signature))
+        return false;
+
+    return true;
+}
+
+void ArgumentCoder&lt;WebCore::PaymentMethod&gt;::encode(ArgumentEncoder&amp; encoder, const WebCore::PaymentMethod&amp; paymentMethod)
+{
+    auto data = adoptNS([[NSMutableData alloc] init]);
+    auto archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+
+    [archiver setRequiresSecureCoding:YES];
+
+    [archiver encodeObject:paymentMethod.pkPaymentMethod() forKey:NSKeyedArchiveRootObjectKey];
+    [archiver finishEncoding];
+
+    encoder &lt;&lt; DataReference(static_cast&lt;const uint8_t*&gt;([data bytes]), [data length]);
+}
+
+bool ArgumentCoder&lt;WebCore::PaymentMethod&gt;::decode(ArgumentDecoder&amp; decoder, WebCore::PaymentMethod&amp; paymentMethod)
+{
+    IPC::DataReference dataReference;
+    if (!decoder.decode(dataReference))
+        return false;
+
+    auto data = adoptNS([[NSData alloc] initWithBytesNoCopy:const_cast&lt;void*&gt;(static_cast&lt;const void*&gt;(dataReference.data())) length:dataReference.size() freeWhenDone:NO]);
+    auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:data.get()]);
+    [unarchiver setRequiresSecureCoding:YES];
+    @try {
+        PKPaymentMethod *pkPaymentMethod = [unarchiver decodeObjectOfClass:getPKPaymentMethodClass() forKey:NSKeyedArchiveRootObjectKey];
+        paymentMethod = PaymentMethod(pkPaymentMethod);
+    } @catch (NSException *exception) {
+        LOG_ERROR(&quot;Failed to decode PKPayment: %@&quot;, exception);
+        return false;
+    }
+
+    [unarchiver finishDecoding];
+    return true;
+}
+
+void ArgumentCoder&lt;PaymentRequest&gt;::encode(ArgumentEncoder&amp; encoder, const PaymentRequest&amp; request)
+{
+    encoder &lt;&lt; request.countryCode();
+    encoder &lt;&lt; request.currencyCode();
+    encoder &lt;&lt; request.requiredBillingAddressFields();
+    encoder &lt;&lt; request.billingContact();
+    encoder &lt;&lt; request.requiredShippingAddressFields();
+    encoder &lt;&lt; request.shippingContact();
+    encoder &lt;&lt; request.merchantCapabilities();
+    encoder &lt;&lt; request.supportedNetworks();
+    encoder.encodeEnum(request.shippingType());
+    encoder &lt;&lt; request.shippingMethods();
+    encoder &lt;&lt; request.lineItems();
+    encoder &lt;&lt; request.total();
+    encoder &lt;&lt; request.applicationData();
+}
+
+bool ArgumentCoder&lt;PaymentRequest&gt;::decode(ArgumentDecoder&amp; decoder, PaymentRequest&amp; request)
+{
+    String countryCode;
+    if (!decoder.decode(countryCode))
+        return false;
+    request.setCountryCode(countryCode);
+
+    String currencyCode;
+    if (!decoder.decode(currencyCode))
+        return false;
+    request.setCurrencyCode(currencyCode);
+
+    PaymentRequest::AddressFields requiredBillingAddressFields;
+    if (!decoder.decode((requiredBillingAddressFields)))
+        return false;
+    request.setRequiredBillingAddressFields(requiredBillingAddressFields);
+
+    PaymentContact billingContact;
+    if (!decoder.decode(billingContact))
+        return false;
+    request.setBillingContact(billingContact);
+
+    PaymentRequest::AddressFields requiredShippingAddressFields;
+    if (!decoder.decode((requiredShippingAddressFields)))
+        return false;
+    request.setRequiredShippingAddressFields(requiredShippingAddressFields);
+
+    PaymentContact shippingContact;
+    if (!decoder.decode(shippingContact))
+        return false;
+    request.setShippingContact(shippingContact);
+
+    PaymentRequest::MerchantCapabilities merchantCapabilities;
+    if (!decoder.decode(merchantCapabilities))
+        return false;
+    request.setMerchantCapabilities(merchantCapabilities);
+
+    PaymentRequest::SupportedNetworks supportedNetworks;
+    if (!decoder.decode(supportedNetworks))
+        return false;
+    request.setSupportedNetworks(supportedNetworks);
+
+    PaymentRequest::ShippingType shippingType;
+    if (!decoder.decodeEnum(shippingType))
+        return false;
+    request.setShippingType(shippingType);
+
+    Vector&lt;PaymentRequest::ShippingMethod&gt; shippingMethods;
+    if (!decoder.decode(shippingMethods))
+        return false;
+    request.setShippingMethods(shippingMethods);
+
+    Vector&lt;PaymentRequest::LineItem&gt; lineItems;
+    if (!decoder.decode(lineItems))
+        return false;
+    request.setLineItems(lineItems);
+
+    PaymentRequest::LineItem total;
+    if (!decoder.decode(total))
+        return false;
+    request.setTotal(total);
+
+    String applicationData;
+    if (!decoder.decode(applicationData))
+        return false;
+    request.setApplicationData(applicationData);
+
+    return true;
+}
+
+void ArgumentCoder&lt;PaymentRequest::AddressFields&gt;::encode(ArgumentEncoder&amp; encoder, const PaymentRequest::AddressFields&amp; addressFields)
+{
+    encoder &lt;&lt; addressFields.postalAddress;
+    encoder &lt;&lt; addressFields.phone;
+    encoder &lt;&lt; addressFields.email;
+    encoder &lt;&lt; addressFields.name;
+}
+
+bool ArgumentCoder&lt;PaymentRequest::AddressFields&gt;::decode(ArgumentDecoder&amp; decoder, PaymentRequest::AddressFields&amp; addressFields)
+{
+    if (!decoder.decode(addressFields.postalAddress))
+        return false;
+    if (!decoder.decode(addressFields.phone))
+        return false;
+    if (!decoder.decode(addressFields.email))
+        return false;
+    if (!decoder.decode(addressFields.name))
+        return false;
+
+    return true;
+}
+
+void ArgumentCoder&lt;PaymentRequest::LineItem&gt;::encode(ArgumentEncoder&amp; encoder, const PaymentRequest::LineItem&amp; lineItem)
+{
+    encoder.encodeEnum(lineItem.type);
+    encoder &lt;&lt; lineItem.label;
+    encoder &lt;&lt; lineItem.amount;
+}
+
+bool ArgumentCoder&lt;PaymentRequest::LineItem&gt;::decode(ArgumentDecoder&amp; decoder, PaymentRequest::LineItem&amp; lineItem)
+{
+    if (!decoder.decodeEnum(lineItem.type))
+        return false;
+    if (!decoder.decode(lineItem.label))
+        return false;
+    if (!decoder.decode(lineItem.amount))
+        return false;
+
+    return true;
+}
+
+void ArgumentCoder&lt;PaymentRequest::MerchantCapabilities&gt;::encode(ArgumentEncoder&amp; encoder, const PaymentRequest::MerchantCapabilities&amp; merchantCapabilities)
+{
+    encoder &lt;&lt; merchantCapabilities.supports3DS;
+    encoder &lt;&lt; merchantCapabilities.supportsEMV;
+    encoder &lt;&lt; merchantCapabilities.supportsCredit;
+    encoder &lt;&lt; merchantCapabilities.supportsDebit;
+}
+
+bool ArgumentCoder&lt;PaymentRequest::MerchantCapabilities&gt;::decode(ArgumentDecoder&amp; decoder, PaymentRequest::MerchantCapabilities&amp; merchantCapabilities)
+{
+    if (!decoder.decode(merchantCapabilities.supports3DS))
+        return false;
+    if (!decoder.decode(merchantCapabilities.supportsEMV))
+        return false;
+    if (!decoder.decode(merchantCapabilities.supportsCredit))
+        return false;
+    if (!decoder.decode(merchantCapabilities.supportsDebit))
+        return false;
+
+    return true;
+}
+
+void ArgumentCoder&lt;PaymentRequest::SupportedNetworks&gt;::encode(ArgumentEncoder&amp; encoder, const PaymentRequest::SupportedNetworks&amp; supportedNetworks)
+{
+    encoder &lt;&lt; supportedNetworks.amex;
+    encoder &lt;&lt; supportedNetworks.chinaUnionPay;
+    encoder &lt;&lt; supportedNetworks.discover;
+    encoder &lt;&lt; supportedNetworks.interac;
+    encoder &lt;&lt; supportedNetworks.masterCard;
+    encoder &lt;&lt; supportedNetworks.privateLabel;
+    encoder &lt;&lt; supportedNetworks.visa;
+}
+
+bool ArgumentCoder&lt;PaymentRequest::SupportedNetworks&gt;::decode(ArgumentDecoder&amp; decoder, PaymentRequest::SupportedNetworks&amp; supportedNetworks)
+{
+    if (!decoder.decode(supportedNetworks.amex))
+        return false;
+    if (!decoder.decode(supportedNetworks.chinaUnionPay))
+        return false;
+    if (!decoder.decode(supportedNetworks.discover))
+        return false;
+    if (!decoder.decode(supportedNetworks.interac))
+        return false;
+    if (!decoder.decode(supportedNetworks.masterCard))
+        return false;
+    if (!decoder.decode(supportedNetworks.privateLabel))
+        return false;
+    if (!decoder.decode(supportedNetworks.visa))
+        return false;
+
+    return true;
+}
+
+void ArgumentCoder&lt;PaymentRequest::ShippingMethod&gt;::encode(ArgumentEncoder&amp; encoder, const PaymentRequest::ShippingMethod&amp; shippingMethod)
+{
+    encoder &lt;&lt; shippingMethod.label;
+    encoder &lt;&lt; shippingMethod.detail;
+    encoder &lt;&lt; shippingMethod.amount;
+    encoder &lt;&lt; shippingMethod.identifier;
+}
+
+bool ArgumentCoder&lt;PaymentRequest::ShippingMethod&gt;::decode(ArgumentDecoder&amp; decoder, PaymentRequest::ShippingMethod&amp; shippingMethod)
+{
+    if (!decoder.decode(shippingMethod.label))
+        return false;
+    if (!decoder.decode(shippingMethod.detail))
+        return false;
+    if (!decoder.decode(shippingMethod.amount))
+        return false;
+    if (!decoder.decode(shippingMethod.identifier))
+        return false;
+    return true;
+}
+
+void ArgumentCoder&lt;PaymentRequest::TotalAndLineItems&gt;::encode(ArgumentEncoder&amp; encoder, const PaymentRequest::TotalAndLineItems&amp; totalAndLineItems)
+{
+    encoder &lt;&lt; totalAndLineItems.total;
+    encoder &lt;&lt; totalAndLineItems.lineItems;
+}
+
+bool ArgumentCoder&lt;PaymentRequest::TotalAndLineItems&gt;::decode(ArgumentDecoder&amp; decoder, PaymentRequest::TotalAndLineItems&amp; totalAndLineItems)
+{
+    if (!decoder.decode(totalAndLineItems.total))
+        return false;
+    if (!decoder.decode(totalAndLineItems.lineItems))
+        return false;
+    return true;
+}
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2SharedCocoaWebKitAdditionsmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/Shared/Cocoa/WebKitAdditions.mm (202431 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Cocoa/WebKitAdditions.mm        2016-06-24 18:21:05 UTC (rev 202431)
+++ trunk/Source/WebKit2/Shared/Cocoa/WebKitAdditions.mm        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -1,30 +0,0 @@
</span><del>-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import &quot;config.h&quot;
-
-#if USE(APPLE_INTERNAL_SDK)
-#import &lt;WebKitAdditions/WebKitAdditions.mm&gt;
-#endif
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessApplePayWebPaymentCoordinatorProxycpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp (0 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -0,0 +1,322 @@
</span><ins>+/*
+ * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;WebPaymentCoordinatorProxy.h&quot;
+
+#if ENABLE(APPLE_PAY)
+
+#include &quot;WebPageProxy.h&quot;
+#include &quot;WebPaymentCoordinatorMessages.h&quot;
+#include &quot;WebPaymentCoordinatorProxyMessages.h&quot;
+#include &quot;WebProcessProxy.h&quot;
+#include &lt;WebCore/PaymentAuthorizationStatus.h&gt;
+
+namespace WebKit {
+
+WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy(WebPageProxy&amp; webPageProxy)
+    : m_webPageProxy(webPageProxy)
+    , m_weakPtrFactory(this)
+    , m_state(State::Idle)
+    , m_merchantValidationState(MerchantValidationState::Idle)
+{
+    m_webPageProxy.process().addMessageReceiver(Messages::WebPaymentCoordinatorProxy::messageReceiverName(), m_webPageProxy.pageID(), *this);
+}
+
+WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy()
+{
+    if (m_state != State::Idle)
+        hidePaymentUI();
+
+    m_webPageProxy.process().removeMessageReceiver(Messages::WebPaymentCoordinatorProxy::messageReceiverName(), m_webPageProxy.pageID());
+}
+
+void WebPaymentCoordinatorProxy::canMakePayments(bool&amp; reply)
+{
+    reply = platformCanMakePayments();
+}
+
+void WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard(const String&amp; merchantIdentifier, const String&amp; domainName, uint64_t requestID)
+{
+    auto weakThis = m_weakPtrFactory.createWeakPtr();
+    platformCanMakePaymentsWithActiveCard(merchantIdentifier, domainName, [weakThis, requestID](bool canMakePayments) {
+        auto paymentCoordinatorProxy = weakThis.get();
+        if (!paymentCoordinatorProxy)
+            return;
+
+        paymentCoordinatorProxy-&gt;m_webPageProxy.send(Messages::WebPaymentCoordinator::CanMakePaymentsWithActiveCardReply(requestID, canMakePayments));
+    });
+}
+
+void WebPaymentCoordinatorProxy::showPaymentUI(const String&amp; originatingURLString, const Vector&lt;String&gt;&amp; linkIconURLStrings, const WebCore::PaymentRequest&amp; paymentRequest)
+{
+    // FIXME: Make this a message check.
+    ASSERT(canBegin());
+
+    m_state = State::Activating;
+
+    WebCore::URL originatingURL(WebCore::URL(), originatingURLString);
+
+    Vector&lt;WebCore::URL&gt; linkIconURLs;
+    for (const auto&amp; linkIconURLString : linkIconURLStrings)
+        linkIconURLs.append(WebCore::URL(WebCore::URL(), linkIconURLString));
+
+    platformShowPaymentUI(originatingURL, linkIconURLs, paymentRequest, [this](bool result) {
+        ASSERT(m_state == State::Activating);
+        if (!result) {
+            didCancelPayment();
+            return;
+        }
+
+        m_state = State::Active;
+    });
+}
+
+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&amp; paymentMerchantSession)
+{
+    // It's possible that the payment has been canceled already.
+    if (m_state == State::Idle)
+        return;
+
+    // FIXME: This should be a MESSAGE_CHECK.
+    ASSERT(m_merchantValidationState == MerchantValidationState::Validating);
+
+    platformCompleteMerchantValidation(paymentMerchantSession);
+    m_merchantValidationState = MerchantValidationState::ValidationComplete;
+}
+
+void WebPaymentCoordinatorProxy::completeShippingMethodSelection(uint32_t opaqueStatus, const Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt;&amp; newTotalAndLineItems)
+{
+    // It's possible that the payment has been canceled already.
+    if (m_state == State::Idle)
+        return;
+
+    // FIXME: This should be a MESSAGE_CHECK.
+    ASSERT(m_state == State::ShippingMethodSelected);
+
+    auto status = static_cast&lt;WebCore::PaymentAuthorizationStatus&gt;(opaqueStatus);
+
+    // FIXME: Make this a message check.
+    RELEASE_ASSERT(isValidEnum(status));
+
+    platformCompleteShippingMethodSelection(status, newTotalAndLineItems);
+    m_state = State::Active;
+}
+
+void WebPaymentCoordinatorProxy::completeShippingContactSelection(uint32_t opaqueStatus, const Vector&lt;WebCore::PaymentRequest::ShippingMethod&gt;&amp; newShippingMethods, const Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt;&amp; newTotalAndLineItems)
+{
+    // It's possible that the payment has been canceled already.
+    if (m_state == State::Idle)
+        return;
+
+    // FIXME: This should be a MESSAGE_CHECK.
+    ASSERT(m_state == State::ShippingContactSelected);
+
+    auto status = static_cast&lt;WebCore::PaymentAuthorizationStatus&gt;(opaqueStatus);
+
+    // FIXME: Make this a message check.
+    RELEASE_ASSERT(isValidEnum(status));
+
+    platformCompleteShippingContactSelection(status, newShippingMethods, newTotalAndLineItems);
+    m_state = State::Active;
+}
+
+void WebPaymentCoordinatorProxy::completePaymentMethodSelection(const Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt;&amp; newTotalAndLineItems)
+{
+    // It's possible that the payment has been canceled already.
+    if (m_state == State::Idle)
+        return;
+
+    // FIXME: This should be a MESSAGE_CHECK.
+    ASSERT(m_state == State::PaymentMethodSelected);
+
+    platformCompletePaymentMethodSelection(newTotalAndLineItems);
+    m_state = State::Active;
+}
+
+void WebPaymentCoordinatorProxy::completePaymentSession(uint32_t opaqueStatus)
+{
+    // It's possible that the payment has been canceled already.
+    if (!canCompletePayment())
+        return;
+
+    auto status = static_cast&lt;WebCore::PaymentAuthorizationStatus&gt;(opaqueStatus);
+
+    // FIXME: Make this a message check.
+    RELEASE_ASSERT(isValidEnum(status));
+
+    platformCompletePaymentSession(status);
+
+    didReachFinalState();
+}
+
+void WebPaymentCoordinatorProxy::abortPaymentSession()
+{
+    // It's possible that the payment has been canceled already.
+    if (!canAbort())
+        return;
+
+    hidePaymentUI();
+
+    didReachFinalState();
+}
+
+void WebPaymentCoordinatorProxy::didCancelPayment()
+{
+    ASSERT(canCancel());
+
+    m_webPageProxy.send(Messages::WebPaymentCoordinator::DidCancelPayment());
+
+    didReachFinalState();
+}
+
+void WebPaymentCoordinatorProxy::validateMerchant(const WebCore::URL&amp; url)
+{
+    ASSERT(m_merchantValidationState == MerchantValidationState::Idle);
+
+    m_merchantValidationState = MerchantValidationState::Validating;
+    m_webPageProxy.send(Messages::WebPaymentCoordinator::ValidateMerchant(url.string()));
+}
+
+void WebPaymentCoordinatorProxy::didAuthorizePayment(const WebCore::Payment&amp; payment)
+{
+    m_state = State::Authorized;
+    m_webPageProxy.send(Messages::WebPaymentCoordinator::DidAuthorizePayment(payment));
+}
+
+void WebPaymentCoordinatorProxy::didSelectShippingMethod(const WebCore::PaymentRequest::ShippingMethod&amp; shippingMethod)
+{
+    ASSERT(m_state == State::Active);
+
+    m_state = State::ShippingMethodSelected;
+    m_webPageProxy.send(Messages::WebPaymentCoordinator::DidSelectShippingMethod(shippingMethod));
+}
+
+void WebPaymentCoordinatorProxy::didSelectShippingContact(const WebCore::PaymentContact&amp; shippingContact)
+{
+    ASSERT(m_state == State::Active);
+
+    m_state = State::ShippingContactSelected;
+    m_webPageProxy.send(Messages::WebPaymentCoordinator::DidSelectShippingContact(shippingContact));
+}
+
+void WebPaymentCoordinatorProxy::didSelectPaymentMethod(const WebCore::PaymentMethod&amp; paymentMethod)
+{
+    ASSERT(m_state == State::Active);
+
+    m_state = State::PaymentMethodSelected;
+    m_webPageProxy.send(Messages::WebPaymentCoordinator::DidSelectPaymentMethod(paymentMethod));
+}
+
+bool WebPaymentCoordinatorProxy::canBegin() const
+{
+    switch (m_state) {
+    case State::Idle:
+        return true;
+
+    case State::Activating:
+    case State::Active:
+    case State::Authorized:
+    case State::ShippingMethodSelected:
+    case State::ShippingContactSelected:
+    case State::PaymentMethodSelected:
+        return false;
+    }
+}
+
+bool WebPaymentCoordinatorProxy::canCancel() const
+{
+    switch (m_state) {
+    case State::Activating:
+    case State::Active:
+    case State::Authorized:
+    case State::ShippingMethodSelected:
+    case State::ShippingContactSelected:
+    case State::PaymentMethodSelected:
+        return true;
+
+    case State::Idle:
+        return false;
+    }
+}
+
+bool WebPaymentCoordinatorProxy::canCompletePayment() const
+{
+    switch (m_state) {
+    case State::Authorized:
+        return true;
+
+    case State::Idle:
+    case State::Activating:
+    case State::Active:
+    case State::ShippingMethodSelected:
+    case State::ShippingContactSelected:
+    case State::PaymentMethodSelected:
+        return false;
+    }
+}
+
+bool WebPaymentCoordinatorProxy::canAbort() const
+{
+    switch (m_state) {
+    case State::Activating:
+    case State::Active:
+    case State::Authorized:
+    case State::ShippingMethodSelected:
+    case State::ShippingContactSelected:
+    case State::PaymentMethodSelected:
+        return true;
+
+    case State::Idle:
+        return false;
+    }
+}
+
+void WebPaymentCoordinatorProxy::didReachFinalState()
+{
+    m_state = State::Idle;
+    m_merchantValidationState = MerchantValidationState::Idle;
+}
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessApplePayWebPaymentCoordinatorProxyh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h (0 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -0,0 +1,151 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(APPLE_PAY)
+
+#include &quot;MessageReceiver.h&quot;
+#include &lt;WebCore/PaymentHeaders.h&gt;
+#include &lt;wtf/Forward.h&gt;
+#include &lt;wtf/RetainPtr.h&gt;
+#include &lt;wtf/WeakPtr.h&gt;
+
+namespace IPC {
+class DataReference;
+}
+
+namespace WebCore {
+enum class PaymentAuthorizationStatus;
+class Payment;
+class PaymentContact;
+class PaymentMethod;
+class URL;
+struct PaymentMerchantSession;
+}
+
+OBJC_CLASS NSWindow;
+OBJC_CLASS PKPaymentAuthorizationViewController;
+OBJC_CLASS WKPaymentAuthorizationViewControllerDelegate;
+
+namespace WebKit {
+
+class WebPageProxy;
+
+class WebPaymentCoordinatorProxy : private IPC::MessageReceiver {
+public:
+    explicit WebPaymentCoordinatorProxy(WebPageProxy&amp;);
+    ~WebPaymentCoordinatorProxy();
+
+    void didCancelPayment();
+    void validateMerchant(const WebCore::URL&amp;);
+    void didAuthorizePayment(const WebCore::Payment&amp;);
+    void didSelectShippingMethod(const WebCore::PaymentRequest::ShippingMethod&amp;);
+    void didSelectShippingContact(const WebCore::PaymentContact&amp;);
+    void didSelectPaymentMethod(const WebCore::PaymentMethod&amp;);
+
+    void hidePaymentUI();
+
+private:
+    // IPC::MessageReceiver.
+    void didReceiveMessage(IPC::Connection&amp;, IPC::MessageDecoder&amp;) override;
+    void didReceiveSyncMessage(IPC::Connection&amp;, IPC::MessageDecoder&amp;, std::unique_ptr&lt;IPC::MessageEncoder&gt;&amp;) override;
+
+    // Message handlers.
+    void canMakePayments(bool&amp; reply);
+    void canMakePaymentsWithActiveCard(const String&amp; merchantIdentifier, const String&amp; domainName, uint64_t requestID);
+    void showPaymentUI(const String&amp; originatingURLString, const Vector&lt;String&gt;&amp; linkIconURLStrings, const WebCore::PaymentRequest&amp;);
+    void completeMerchantValidation(const WebCore::PaymentMerchantSession&amp;);
+    void completeShippingMethodSelection(uint32_t opaqueStatus, const Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt;&amp;);
+    void completeShippingContactSelection(uint32_t opaqueStatus, const Vector&lt;WebCore::PaymentRequest::ShippingMethod&gt;&amp; newShippingMethods, const Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt;&amp;);
+    void completePaymentMethodSelection(const Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt;&amp;);
+    void completePaymentSession(uint32_t opaqueStatus);
+    void abortPaymentSession();
+
+    bool canBegin() const;
+    bool canCancel() const;
+    bool canCompletePayment() const;
+    bool canAbort() const;
+
+    void didReachFinalState();
+
+    bool platformCanMakePayments();
+    void platformCanMakePaymentsWithActiveCard(const String&amp; merchantIdentifier, const String&amp; domainName, std::function&lt;void (bool)&gt; completionHandler);
+    void platformShowPaymentUI(const WebCore::URL&amp; originatingURL, const Vector&lt;WebCore::URL&gt;&amp; linkIconURLs, const WebCore::PaymentRequest&amp;, std::function&lt;void (bool)&gt; completionHandler);
+    void platformCompleteMerchantValidation(const WebCore::PaymentMerchantSession&amp;);
+    void platformCompleteShippingMethodSelection(WebCore::PaymentAuthorizationStatus, const Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt;&amp;);
+    void platformCompleteShippingContactSelection(WebCore::PaymentAuthorizationStatus, const Vector&lt;WebCore::PaymentRequest::ShippingMethod&gt;&amp; newShippingMethods, const Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt;&amp;);
+    void platformCompletePaymentMethodSelection(const Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt;&amp;);
+    void platformCompletePaymentSession(WebCore::PaymentAuthorizationStatus);
+
+    WebPageProxy&amp; m_webPageProxy;
+    WeakPtrFactory&lt;WebPaymentCoordinatorProxy&gt; m_weakPtrFactory;
+
+    enum class State {
+        // Idle - Nothing's happening.
+        Idle,
+
+        // Activating - Waiting to show the payment UI.
+        Activating,
+
+        // Active - Showing payment UI.
+        Active,
+
+        // Authorized - Dispatching the authorized event and waiting for the paymentSessionCompleted message.
+        Authorized,
+
+        // ShippingMethodSelected - Dispatching the shippingmethodselected event and waiting for a reply.
+        ShippingMethodSelected,
+
+        // ShippingContactSelected - Dispatching the shippingcontactselected event and waiting for a reply.
+        ShippingContactSelected,
+
+        // PaymentMethodSelected - Dispatching the paymentmethodselected event and waiting for a reply.
+        PaymentMethodSelected,
+    } m_state;
+
+    enum class MerchantValidationState {
+        // Idle - Nothing's happening.
+        Idle,
+
+        // Validating - Dispatching the validatemerchant event and waiting for a reply.
+        Validating,
+
+        // ValidationComplete - A merchant session has been sent along to PassKit.
+        ValidationComplete
+    } m_merchantValidationState;
+
+    RetainPtr&lt;PKPaymentAuthorizationViewController&gt; m_paymentAuthorizationViewController;
+    RetainPtr&lt;WKPaymentAuthorizationViewControllerDelegate&gt; m_paymentAuthorizationViewControllerDelegate;
+
+#if PLATFORM(MAC)
+    uint64_t m_showPaymentUIRequestSeed { 0 };
+    RetainPtr&lt;NSWindow&gt; m_sheetWindow;
+#endif
+};
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessApplePayWebPaymentCoordinatorProxymessagesin"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in (0 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+# Copyright (C) 2015 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+#/
+
+#if ENABLE(APPLE_PAY)
+
+messages -&gt; WebPaymentCoordinatorProxy {
+
+    CanMakePayments() -&gt; (bool result)
+    CanMakePaymentsWithActiveCard(String merchantIdentifier, String domainName, uint64_t requestID)
+
+    ShowPaymentUI(String originatingURLString, Vector&lt;String&gt; linkIconURLStrings, WebCore::PaymentRequest paymentRequest)
+    CompleteMerchantValidation(struct WebCore::PaymentMerchantSession paymentMerchantSession);
+    CompleteShippingMethodSelection(uint32_t opaqueStatus, Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt; newTotalAndItems)
+    CompleteShippingContactSelection(uint32_t opaqueStatus, Vector&lt;WebCore::PaymentRequest::ShippingMethod&gt; newShippingMethods, Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt; newTotalAndItems)
+    CompletePaymentMethodSelection(Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt; newTotalAndItems)
+    CompletePaymentSession(uint32_t opaqueStatus)
+    AbortPaymentSession()
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessApplePaycocoaWebPaymentCoordinatorProxyCocoah"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h (0 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -0,0 +1,67 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(APPLE_PAY)
+
+#import &lt;PassKit/PKPaymentAuthorizationViewController.h&gt;
+#import &lt;PassKit/PKPaymentAuthorizationViewController_Private.h&gt;
+#import &lt;WebCore/PaymentHeaders.h&gt;
+#import &lt;wtf/BlockPtr.h&gt;
+
+namespace WebCore {
+class URL;
+}
+
+namespace WebKit {
+class WebPaymentCoordinatorProxy;
+
+RetainPtr&lt;PKPaymentRequest&gt; toPKPaymentRequest(const WebCore::URL&amp; originatingURL, const Vector&lt;WebCore::URL&gt;&amp; linkIconURLs, const WebCore::PaymentRequest&amp;);
+
+}
+
+@interface WKPaymentAuthorizationViewControllerDelegate : NSObject &lt;PKPaymentAuthorizationViewControllerDelegate, PKPaymentAuthorizationViewControllerPrivateDelegate&gt; {
+@package
+    WebKit::WebPaymentCoordinatorProxy* _webPaymentCoordinatorProxy;
+    RetainPtr&lt;NSArray&gt; _paymentSummaryItems;
+    RetainPtr&lt;NSArray&gt; _shippingMethods;
+
+    BlockPtr&lt;void (PKPaymentMerchantSession *, NSError *)&gt; _sessionBlock;
+
+    BOOL _authorized;
+    BlockPtr&lt;void (PKPaymentAuthorizationStatus)&gt; _paymentAuthorizedCompletion;
+    BlockPtr&lt;void (NSArray *)&gt; _didSelectPaymentMethodCompletion;
+    BlockPtr&lt;void (PKPaymentAuthorizationStatus, NSArray *)&gt; _didSelectShippingMethodCompletion;
+    BlockPtr&lt;void (PKPaymentAuthorizationStatus, NSArray *, NSArray *)&gt; _didSelectShippingContactCompletion;
+}
+
+- (instancetype)initWithPaymentCoordinatorProxy:(WebKit::WebPaymentCoordinatorProxy&amp;)webPaymentCoordinatorProxy;
+
+- (void)invalidate;
+
+@end
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessApplePaycocoaWebPaymentCoordinatorProxyCocoamm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm (0 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -0,0 +1,515 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;WebPaymentCoordinatorProxyCocoa.h&quot;
+
+#if ENABLE(APPLE_PAY)
+
+#import &quot;WebPaymentCoordinatorProxy.h&quot;
+#import &lt;PassKit/PKPaymentAuthorizationViewController_Private.h&gt;
+#import &lt;PassKitCore/PKPaymentMerchantSession.h&gt;
+#import &lt;WebCore/PaymentAuthorizationStatus.h&gt;
+#import &lt;WebCore/PaymentHeaders.h&gt;
+#import &lt;WebCore/SoftLinking.h&gt;
+#import &lt;WebCore/URL.h&gt;
+#import &lt;wtf/RunLoop.h&gt;
+
+#if PLATFORM(MAC)
+SOFT_LINK_PRIVATE_FRAMEWORK(PassKit)
+#else
+SOFT_LINK_FRAMEWORK(PassKit)
+#endif
+
+#if PLATFORM(MAC)
+// FIXME: Once &lt;rdar://problem/26074851&gt; has been fixed we no longer
+// have to fall back to PKInAppPaymentService.
+#import &lt;PassKitCore/PKInAppPaymentService.h&gt;
+SOFT_LINK_CLASS(PassKit, PKInAppPaymentService)
+#endif
+
+SOFT_LINK_CLASS(PassKit, PKPaymentAuthorizationViewController);
+SOFT_LINK_CLASS(PassKit, PKPaymentMerchantSession);
+SOFT_LINK_CLASS(PassKit, PKPaymentRequest);
+SOFT_LINK_CLASS(PassKit, PKPaymentSummaryItem);
+SOFT_LINK_CLASS(PassKit, PKShippingMethod);
+SOFT_LINK_CONSTANT(PassKit, PKPaymentNetworkAmex, NSString *);
+SOFT_LINK_CONSTANT(PassKit, PKPaymentNetworkChinaUnionPay, NSString *);
+SOFT_LINK_CONSTANT(PassKit, PKPaymentNetworkDiscover, NSString *);
+SOFT_LINK_CONSTANT(PassKit, PKPaymentNetworkInterac, NSString *);
+SOFT_LINK_CONSTANT(PassKit, PKPaymentNetworkMasterCard, NSString *);
+SOFT_LINK_CONSTANT(PassKit, PKPaymentNetworkPrivateLabel, NSString *);
+SOFT_LINK_CONSTANT(PassKit, PKPaymentNetworkVisa, NSString *);
+
+typedef void (^PKCanMakePaymentsCompletion)(BOOL isValid, NSError *error);
+extern &quot;C&quot; void PKCanMakePaymentsWithMerchantIdentifierAndDomain(NSString *identifier, NSString *domain, PKCanMakePaymentsCompletion completion);
+
+SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(WebKit, PassKit, PKCanMakePaymentsWithMerchantIdentifierAndDomain, void, (NSString *identifier, NSString *domain, PKCanMakePaymentsCompletion completion), (identifier, domain, completion));
+
+@implementation WKPaymentAuthorizationViewControllerDelegate
+
+- (instancetype)initWithPaymentCoordinatorProxy:(WebKit::WebPaymentCoordinatorProxy&amp;)webPaymentCoordinatorProxy
+{
+    if (!(self = [super init]))
+        return nullptr;
+
+    _webPaymentCoordinatorProxy = &amp;webPaymentCoordinatorProxy;
+
+    return self;
+}
+
+- (void)invalidate
+{
+    _webPaymentCoordinatorProxy = nullptr;
+    if (_paymentAuthorizedCompletion) {
+        _paymentAuthorizedCompletion(PKPaymentAuthorizationStatusFailure);
+        _paymentAuthorizedCompletion = nullptr;
+    }
+}
+
+- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller willFinishWithError:(NSError *)error
+{
+}
+
+- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller didRequestMerchantSession:(void(^)(PKPaymentMerchantSession *, NSError *))sessionBlock
+{
+    ASSERT(!_sessionBlock);
+    _sessionBlock = sessionBlock;
+
+    [getPKPaymentAuthorizationViewControllerClass() paymentServicesMerchantURL:^(NSURL *merchantURL, NSError *error) {
+        if (error)
+            LOG_ERROR(&quot;PKCanMakePaymentsWithMerchantIdentifierAndDomain error %@&quot;, error);
+
+        dispatch_async(dispatch_get_main_queue(), ^{
+            ASSERT(_sessionBlock);
+
+            if (!_webPaymentCoordinatorProxy) {
+                _sessionBlock(nullptr, nullptr);
+                return;
+            }
+
+            _webPaymentCoordinatorProxy-&gt;validateMerchant(merchantURL);
+        });
+    }];
+}
+
+- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller didAuthorizePayment:(PKPayment *)payment completion:(void (^)(PKPaymentAuthorizationStatus))completion
+{
+    if (!_webPaymentCoordinatorProxy) {
+        completion(PKPaymentAuthorizationStatusFailure);
+        return;
+    }
+
+    ASSERT(!_paymentAuthorizedCompletion);
+    _paymentAuthorizedCompletion = completion;
+
+    _webPaymentCoordinatorProxy-&gt;didAuthorizePayment(WebCore::Payment(payment));
+}
+
+- (void)paymentAuthorizationViewControllerDidFinish:(PKPaymentAuthorizationViewController *)controller
+{
+    if (!_webPaymentCoordinatorProxy)
+        return;
+
+    if (!_authorized)
+        _webPaymentCoordinatorProxy-&gt;didCancelPayment();
+
+    _webPaymentCoordinatorProxy-&gt;hidePaymentUI();
+}
+
+static WebCore::PaymentRequest::ShippingMethod toShippingMethod(PKShippingMethod *shippingMethod)
+{
+    ASSERT(shippingMethod);
+
+    WebCore::PaymentRequest::ShippingMethod result;
+    result.label = shippingMethod.label;
+    result.detail = shippingMethod.detail;
+    result.amount = [shippingMethod.amount decimalNumberByMultiplyingByPowerOf10:2].integerValue;
+    result.identifier = shippingMethod.identifier;
+
+    return result;
+}
+
+- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller didSelectShippingMethod:(PKShippingMethod *)shippingMethod completion:(void (^)(PKPaymentAuthorizationStatus status, NSArray&lt;PKPaymentSummaryItem *&gt; *summaryItems))completion
+{
+    if (!_webPaymentCoordinatorProxy) {
+        completion(PKPaymentAuthorizationStatusFailure, @[]);
+        return;
+    }
+
+    ASSERT(!_didSelectShippingMethodCompletion);
+    _didSelectShippingMethodCompletion = completion;
+    _webPaymentCoordinatorProxy-&gt;didSelectShippingMethod(toShippingMethod(shippingMethod));
+}
+
+- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller didSelectShippingContact:(PKContact *)contact completion:(void (^)(PKPaymentAuthorizationStatus status, NSArray&lt;PKShippingMethod *&gt; *shippingMethods, NSArray&lt;PKPaymentSummaryItem *&gt; *summaryItems))completion
+{
+    if (!_webPaymentCoordinatorProxy) {
+        completion(PKPaymentAuthorizationStatusFailure, @[], @[]);
+        return;
+    }
+
+    ASSERT(!_didSelectShippingContactCompletion);
+    _didSelectShippingContactCompletion = completion;
+    _webPaymentCoordinatorProxy-&gt;didSelectShippingContact(WebCore::PaymentContact(contact));
+}
+
+- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller didSelectPaymentMethod:(PKPaymentMethod *)paymentMethod completion:(void (^)(NSArray&lt;PKPaymentSummaryItem *&gt; *summaryItems))completion
+{
+    if (!_webPaymentCoordinatorProxy) {
+        completion(@[]);
+        return;
+    }
+
+    ASSERT(!_didSelectPaymentMethodCompletion);
+    _didSelectPaymentMethodCompletion = completion;
+
+    _webPaymentCoordinatorProxy-&gt;didSelectPaymentMethod(WebCore::PaymentMethod(paymentMethod));
+}
+
+@end
+
+// FIXME: Once rdar://problem/24420024 has been fixed, import PKPaymentRequest_Private.h instead.
+@interface PKPaymentRequest ()
+@property (nonatomic, retain) NSURL *originatingURL;
+@end
+
+@interface PKPaymentRequest ()
+// FIXME: Remove this once it's in an SDK.
+@property (nonatomic, strong) NSArray *thumbnailURLs;
+@property (nonatomic, strong) NSURL *thumbnailURL;
+
+@property (nonatomic, assign) BOOL expectsMerchantSession;
+@end
+
+namespace WebKit {
+
+bool WebPaymentCoordinatorProxy::platformCanMakePayments()
+{
+    return [getPKPaymentAuthorizationViewControllerClass() canMakePayments];
+}
+
+void WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard(const String&amp; merchantIdentifier, const String&amp; domainName, std::function&lt;void (bool)&gt; completionHandler)
+{
+    if (!canLoad_PassKit_PKCanMakePaymentsWithMerchantIdentifierAndDomain()) {
+        RunLoop::main().dispatch([completionHandler] {
+            completionHandler(false);
+        });
+        return;
+    }
+
+    softLink_PassKit_PKCanMakePaymentsWithMerchantIdentifierAndDomain(merchantIdentifier, domainName, [completionHandler](BOOL canMakePayments, NSError *error) {
+        if (error)
+            LOG_ERROR(&quot;PKCanMakePaymentsWithMerchantIdentifierAndDomain error %@&quot;, error);
+
+        RunLoop::main().dispatch([completionHandler, canMakePayments] {
+            completionHandler(canMakePayments);
+        });
+    });
+}
+
+static PKAddressField toPKAddressField(const WebCore::PaymentRequest::AddressFields&amp; addressFields)
+{
+    PKAddressField result = 0;
+
+    if (addressFields.postalAddress)
+        result |= PKAddressFieldPostalAddress;
+    if (addressFields.phone)
+        result |= PKAddressFieldPhone;
+    if (addressFields.email)
+        result |= PKAddressFieldEmail;
+    if (addressFields.name)
+        result |= PKAddressFieldName;
+
+    return result;
+}
+
+static PKPaymentSummaryItemType toPKPaymentSummaryItemType(WebCore::PaymentRequest::LineItem::Type type)
+{
+    switch (type) {
+    case WebCore::PaymentRequest::LineItem::Type::Final:
+        return PKPaymentSummaryItemTypeFinal;
+
+    case WebCore::PaymentRequest::LineItem::Type::Pending:
+        return PKPaymentSummaryItemTypePending;
+    }
+}
+
+static RetainPtr&lt;PKPaymentSummaryItem&gt; toPKPaymentSummaryItem(const WebCore::PaymentRequest::LineItem&amp; lineItem)
+{
+    auto amount = adoptNS([[NSDecimalNumber alloc] initWithMantissa:lineItem.amount.valueOr(0) exponent:-2 isNegative:*lineItem.amount &lt; 0]);
+
+    return [getPKPaymentSummaryItemClass() summaryItemWithLabel:lineItem.label amount:amount.get() type:toPKPaymentSummaryItemType(lineItem.type)];
+}
+
+static PKMerchantCapability toPKMerchantCapabilities(const WebCore::PaymentRequest::MerchantCapabilities&amp; merchantCapabilities)
+{
+    PKMerchantCapability result = 0;
+    if (merchantCapabilities.supports3DS)
+        result |= PKMerchantCapability3DS;
+    if (merchantCapabilities.supportsEMV)
+        result |= PKMerchantCapabilityEMV;
+    if (merchantCapabilities.supportsCredit)
+        result |= PKMerchantCapabilityCredit;
+    if (merchantCapabilities.supportsDebit)
+        result |= PKMerchantCapabilityDebit;
+
+    return result;
+}
+
+static RetainPtr&lt;NSArray&gt; toSupportedNetworks(const WebCore::PaymentRequest::SupportedNetworks&amp; supportedNetworks)
+{
+    auto result = adoptNS([[NSMutableArray alloc] init]);
+
+    if (supportedNetworks.amex)
+        [result addObject:getPKPaymentNetworkAmex()];
+    if (supportedNetworks.chinaUnionPay)
+        [result addObject:getPKPaymentNetworkChinaUnionPay()];
+    if (supportedNetworks.discover)
+        [result addObject:getPKPaymentNetworkDiscover()];
+    if (supportedNetworks.interac)
+        [result addObject:getPKPaymentNetworkInterac()];
+    if (supportedNetworks.masterCard)
+        [result addObject:getPKPaymentNetworkMasterCard()];
+    if (supportedNetworks.privateLabel)
+        [result addObject:getPKPaymentNetworkPrivateLabel()];
+    if (supportedNetworks.visa)
+        [result addObject:getPKPaymentNetworkVisa()];
+
+    return result;
+}
+
+static PKShippingType toPKShippingType(WebCore::PaymentRequest::ShippingType shippingType)
+{
+    switch (shippingType) {
+    case WebCore::PaymentRequest::ShippingType::Shipping:
+        return PKShippingTypeShipping;
+
+    case WebCore::PaymentRequest::ShippingType::Delivery:
+        return PKShippingTypeDelivery;
+
+    case WebCore::PaymentRequest::ShippingType::StorePickup:
+        return PKShippingTypeStorePickup;
+
+    case WebCore::PaymentRequest::ShippingType::ServicePickup:
+        return PKShippingTypeServicePickup;
+    }
+}
+
+static RetainPtr&lt;PKShippingMethod&gt; toPKShippingMethod(const WebCore::PaymentRequest::ShippingMethod&amp; shippingMethod)
+{
+    auto amount = adoptNS([[NSDecimalNumber alloc] initWithMantissa:shippingMethod.amount exponent:-2 isNegative:NO]);
+
+    RetainPtr&lt;PKShippingMethod&gt; result = [getPKShippingMethodClass() summaryItemWithLabel:shippingMethod.label amount:amount.get()];
+    [result setIdentifier:shippingMethod.identifier];
+    [result setDetail:shippingMethod.detail];
+
+    return result;
+}
+
+static RetainPtr&lt;PKPaymentMerchantSession&gt; toPKPaymentMerchantSession(const WebCore::PaymentMerchantSession&amp; paymentMerchantSession)
+{
+    NSDictionary *dictionary = @{
+        @&quot;merchantSessionIdentifier&quot; : paymentMerchantSession.sessionIdentifier,
+        @&quot;merchantIdentifier&quot; : paymentMerchantSession.merchantIdentifier,
+        @&quot;nOnce&quot; : paymentMerchantSession.nonce,
+        @&quot;epochTimestamp&quot; : @(static_cast&lt;NSUInteger&gt;(paymentMerchantSession.epochTimestamp)),
+        @&quot;FQDN&quot; : paymentMerchantSession.domainName,
+        @&quot;signature&quot; : paymentMerchantSession.signature,
+    };
+
+    return adoptNS([allocPKPaymentMerchantSessionInstance() initWithDictionary:dictionary]);
+}
+
+RetainPtr&lt;PKPaymentRequest&gt; toPKPaymentRequest(const WebCore::URL&amp; originatingURL, const Vector&lt;WebCore::URL&gt;&amp; linkIconURLs, const WebCore::PaymentRequest&amp; paymentRequest)
+{
+    auto result = adoptNS([allocPKPaymentRequestInstance() init]);
+
+    [result setOriginatingURL:originatingURL];
+
+    if ([result respondsToSelector:@selector(setThumbnailURLs:)]) {
+        auto thumbnailURLs = adoptNS([[NSMutableArray alloc] init]);
+        for (auto&amp; linkIconURL : linkIconURLs)
+            [thumbnailURLs addObject:static_cast&lt;NSURL *&gt;(linkIconURL)];
+
+        [result setThumbnailURLs:thumbnailURLs.get()];
+    } else if (!linkIconURLs.isEmpty())
+        [result setThumbnailURL:linkIconURLs[0]];
+
+    [result setCountryCode:paymentRequest.countryCode()];
+    [result setCurrencyCode:paymentRequest.currencyCode()];
+    [result setRequiredBillingAddressFields:toPKAddressField(paymentRequest.requiredBillingAddressFields())];
+    [result setBillingContact:paymentRequest.billingContact().pkContact()];
+    [result setRequiredShippingAddressFields:toPKAddressField(paymentRequest.requiredShippingAddressFields())];
+    [result setShippingContact:paymentRequest.shippingContact().pkContact()];
+
+    [result setSupportedNetworks:toSupportedNetworks(paymentRequest.supportedNetworks()).get()];
+    [result setMerchantCapabilities:toPKMerchantCapabilities(paymentRequest.merchantCapabilities())];
+
+    [result setShippingType:toPKShippingType(paymentRequest.shippingType())];
+
+    auto shippingMethods = adoptNS([[NSMutableArray alloc] init]);
+    for (auto&amp; shippingMethod : paymentRequest.shippingMethods())
+        [shippingMethods addObject:toPKShippingMethod(shippingMethod).get()];
+    [result setShippingMethods:shippingMethods.get()];
+
+    auto paymentSummaryItems = adoptNS([[NSMutableArray alloc] init]);
+    for (auto&amp; lineItem : paymentRequest.lineItems()) {
+        if (auto summaryItem = toPKPaymentSummaryItem(lineItem))
+            [paymentSummaryItems addObject:summaryItem.get()];
+    }
+
+    if (auto totalItem = toPKPaymentSummaryItem(paymentRequest.total()))
+        [paymentSummaryItems addObject:totalItem.get()];
+
+    [result setPaymentSummaryItems:paymentSummaryItems.get()];
+
+    [result setExpectsMerchantSession:YES];
+
+    if (!paymentRequest.applicationData().isNull()) {
+        auto applicationData = adoptNS([[NSData alloc] initWithBase64EncodedString:paymentRequest.applicationData() options:0]);
+        [result setApplicationData:applicationData.get()];
+    }
+
+    return result;
+}
+
+static PKPaymentAuthorizationStatus toPKPaymentAuthorizationStatus(WebCore::PaymentAuthorizationStatus status)
+{
+    switch (status) {
+    case WebCore::PaymentAuthorizationStatus::Success:
+        return PKPaymentAuthorizationStatusSuccess;
+    case WebCore::PaymentAuthorizationStatus::Failure:
+        return PKPaymentAuthorizationStatusFailure;
+    case WebCore::PaymentAuthorizationStatus::InvalidBillingPostalAddress:
+        return PKPaymentAuthorizationStatusInvalidBillingPostalAddress;
+    case WebCore::PaymentAuthorizationStatus::InvalidShippingPostalAddress:
+        return PKPaymentAuthorizationStatusInvalidShippingPostalAddress;
+    case WebCore::PaymentAuthorizationStatus::InvalidShippingContact:
+        return PKPaymentAuthorizationStatusInvalidShippingContact;
+    case WebCore::PaymentAuthorizationStatus::PINRequired:
+        return PKPaymentAuthorizationStatusPINRequired;
+    case WebCore::PaymentAuthorizationStatus::PINIncorrect:
+        return PKPaymentAuthorizationStatusPINIncorrect;
+    case WebCore::PaymentAuthorizationStatus::PINLockout:
+        return PKPaymentAuthorizationStatusPINLockout;
+    }
+}
+
+void WebPaymentCoordinatorProxy::platformCompletePaymentSession(WebCore::PaymentAuthorizationStatus status)
+{
+    ASSERT(m_paymentAuthorizationViewController);
+    ASSERT(m_paymentAuthorizationViewControllerDelegate);
+
+    m_paymentAuthorizationViewControllerDelegate-&gt;_authorized = YES;
+    m_paymentAuthorizationViewControllerDelegate-&gt;_paymentAuthorizedCompletion(toPKPaymentAuthorizationStatus(status));
+    m_paymentAuthorizationViewControllerDelegate-&gt;_paymentAuthorizedCompletion = nullptr;
+}
+
+void WebPaymentCoordinatorProxy::platformCompleteMerchantValidation(const WebCore::PaymentMerchantSession&amp; paymentMerchantSession)
+{
+    ASSERT(m_paymentAuthorizationViewController);
+    ASSERT(m_paymentAuthorizationViewControllerDelegate);
+
+    m_paymentAuthorizationViewControllerDelegate-&gt;_sessionBlock(toPKPaymentMerchantSession(paymentMerchantSession).get(), nullptr);
+    m_paymentAuthorizationViewControllerDelegate-&gt;_sessionBlock = nullptr;
+}
+
+void WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection(WebCore::PaymentAuthorizationStatus status, const Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt;&amp; newTotalAndLineItems)
+{
+    ASSERT(m_paymentAuthorizationViewController);
+    ASSERT(m_paymentAuthorizationViewControllerDelegate);
+
+    if (newTotalAndLineItems) {
+        auto paymentSummaryItems = adoptNS([[NSMutableArray alloc] init]);
+        for (auto&amp; lineItem : newTotalAndLineItems-&gt;lineItems) {
+            if (auto summaryItem = toPKPaymentSummaryItem(lineItem))
+                [paymentSummaryItems addObject:summaryItem.get()];
+        }
+
+        if (auto totalItem = toPKPaymentSummaryItem(newTotalAndLineItems-&gt;total))
+            [paymentSummaryItems addObject:totalItem.get()];
+
+        m_paymentAuthorizationViewControllerDelegate-&gt;_paymentSummaryItems = WTFMove(paymentSummaryItems);
+    }
+
+    m_paymentAuthorizationViewControllerDelegate-&gt;_didSelectShippingMethodCompletion(toPKPaymentAuthorizationStatus(status), m_paymentAuthorizationViewControllerDelegate-&gt;_paymentSummaryItems.get());
+    m_paymentAuthorizationViewControllerDelegate-&gt;_didSelectShippingMethodCompletion = nullptr;
+}
+
+void WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection(WebCore::PaymentAuthorizationStatus status, const Vector&lt;WebCore::PaymentRequest::ShippingMethod&gt;&amp; newShippingMethods, const Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt;&amp; newTotalAndLineItems)
+{
+    ASSERT(m_paymentAuthorizationViewController);
+    ASSERT(m_paymentAuthorizationViewControllerDelegate);
+
+    if (newTotalAndLineItems) {
+        auto paymentSummaryItems = adoptNS([[NSMutableArray alloc] init]);
+        for (auto&amp; lineItem : newTotalAndLineItems-&gt;lineItems) {
+            if (auto summaryItem = toPKPaymentSummaryItem(lineItem))
+                [paymentSummaryItems addObject:summaryItem.get()];
+        }
+
+        if (auto totalItem = toPKPaymentSummaryItem(newTotalAndLineItems-&gt;total))
+            [paymentSummaryItems addObject:totalItem.get()];
+
+        m_paymentAuthorizationViewControllerDelegate-&gt;_paymentSummaryItems = WTFMove(paymentSummaryItems);
+
+        auto shippingMethods = adoptNS([[NSMutableArray alloc] init]);
+        for (auto&amp; shippingMethod : newShippingMethods)
+            [shippingMethods addObject:toPKShippingMethod(shippingMethod).get()];
+
+        m_paymentAuthorizationViewControllerDelegate-&gt;_shippingMethods = WTFMove(shippingMethods);
+    }
+
+    m_paymentAuthorizationViewControllerDelegate-&gt;_didSelectShippingContactCompletion(toPKPaymentAuthorizationStatus(status), m_paymentAuthorizationViewControllerDelegate-&gt;_shippingMethods.get(), m_paymentAuthorizationViewControllerDelegate-&gt;_paymentSummaryItems.get());
+    m_paymentAuthorizationViewControllerDelegate-&gt;_didSelectShippingContactCompletion = nullptr;
+}
+
+void WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection(const Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt;&amp; newTotalAndLineItems)
+{
+    ASSERT(m_paymentAuthorizationViewController);
+    ASSERT(m_paymentAuthorizationViewControllerDelegate);
+
+    if (newTotalAndLineItems) {
+        auto paymentSummaryItems = adoptNS([[NSMutableArray alloc] init]);
+        for (auto&amp; lineItem : newTotalAndLineItems-&gt;lineItems) {
+            if (auto summaryItem = toPKPaymentSummaryItem(lineItem))
+                [paymentSummaryItems addObject:summaryItem.get()];
+        }
+
+        if (auto totalItem = toPKPaymentSummaryItem(newTotalAndLineItems-&gt;total))
+            [paymentSummaryItems addObject:totalItem.get()];
+
+        m_paymentAuthorizationViewControllerDelegate-&gt;_paymentSummaryItems = WTFMove(paymentSummaryItems);
+    }
+
+    m_paymentAuthorizationViewControllerDelegate-&gt;_didSelectPaymentMethodCompletion(m_paymentAuthorizationViewControllerDelegate-&gt;_paymentSummaryItems.get());
+    m_paymentAuthorizationViewControllerDelegate-&gt;_didSelectPaymentMethodCompletion = nullptr;
+}
+
+}
+
+#endif
+
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessApplePayiosWebPaymentCoordinatorProxyIOSmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm (0 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -0,0 +1,93 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;WebPaymentCoordinatorProxy.h&quot;
+
+#if PLATFORM(IOS) &amp;&amp; ENABLE(APPLE_PAY)
+
+#import &quot;APIUIClient.h&quot;
+#import &quot;WebPageProxy.h&quot;
+#import &quot;WebPaymentCoordinatorProxyCocoa.h&quot;
+#import &lt;PassKit/PassKit.h&gt;
+#import &lt;PassKitCore/PKPaymentMerchantSession.h&gt;
+#import &lt;UIKit/UIViewController.h&gt;
+#import &lt;WebCore/PaymentAuthorizationStatus.h&gt;
+#import &lt;WebCore/SoftLinking.h&gt;
+#import &lt;wtf/BlockPtr.h&gt;
+
+SOFT_LINK_FRAMEWORK(PassKit)
+SOFT_LINK_CLASS(PassKit, PKPaymentAuthorizationViewController);
+
+namespace WebKit {
+
+void WebPaymentCoordinatorProxy::platformShowPaymentUI(const WebCore::URL&amp; originatingURL, const Vector&lt;WebCore::URL&gt;&amp; linkIconURLStrings, const WebCore::PaymentRequest&amp; request, std::function&lt;void (bool)&gt; completionHandler)
+{
+    UIViewController *presentingViewController = m_webPageProxy.uiClient().presentingViewController();
+
+    if (!presentingViewController) {
+        completionHandler(false);
+        return;
+    }
+
+    ASSERT(!m_paymentAuthorizationViewController);
+
+    auto paymentRequest = toPKPaymentRequest(originatingURL, linkIconURLStrings, request);
+
+    m_paymentAuthorizationViewController = adoptNS([allocPKPaymentAuthorizationViewControllerInstance() initWithPaymentRequest:paymentRequest.get()]);
+    if (!m_paymentAuthorizationViewController) {
+        completionHandler(false);
+        return;
+    }
+
+    m_paymentAuthorizationViewControllerDelegate = adoptNS([[WKPaymentAuthorizationViewControllerDelegate alloc] initWithPaymentCoordinatorProxy:*this]);
+    m_paymentAuthorizationViewControllerDelegate-&gt;_paymentSummaryItems = [paymentRequest paymentSummaryItems];
+    m_paymentAuthorizationViewControllerDelegate-&gt;_shippingMethods = [paymentRequest shippingMethods];
+
+    [m_paymentAuthorizationViewController setDelegate:m_paymentAuthorizationViewControllerDelegate.get()];
+    [m_paymentAuthorizationViewController setPrivateDelegate:m_paymentAuthorizationViewControllerDelegate.get()];
+
+    [presentingViewController presentViewController:m_paymentAuthorizationViewController.get() animated:YES completion:nullptr];
+
+    completionHandler(true);
+}
+
+void WebPaymentCoordinatorProxy::hidePaymentUI()
+{
+    ASSERT(m_paymentAuthorizationViewController);
+    ASSERT(m_paymentAuthorizationViewControllerDelegate);
+
+    [[m_paymentAuthorizationViewController presentingViewController] dismissViewControllerAnimated:YES completion:nullptr];
+    [m_paymentAuthorizationViewController setDelegate:nil];
+    [m_paymentAuthorizationViewController setPrivateDelegate:nil];
+    m_paymentAuthorizationViewController = nullptr;
+
+    [m_paymentAuthorizationViewControllerDelegate invalidate];
+    m_paymentAuthorizationViewControllerDelegate = nullptr;
+}
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessApplePaymacWebPaymentCoordinatorProxyMacmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm (0 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -0,0 +1,153 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;WebPaymentCoordinatorProxy.h&quot;
+
+#if PLATFORM(MAC) &amp;&amp; ENABLE(APPLE_PAY)
+
+#import &quot;WebPageProxy.h&quot;
+#import &quot;WebPaymentCoordinatorProxyCocoa.h&quot;
+#import &lt;Foundation/NSExtension.h&gt;
+#import &lt;PassKit/PKPaymentAuthorizationViewController_Private.h&gt;
+#import &lt;WebCore/SoftLinking.h&gt;
+
+SOFT_LINK_PRIVATE_FRAMEWORK(PassKit)
+
+SOFT_LINK_CLASS(PassKit, PKPaymentAuthorizationViewController);
+SOFT_LINK_CONSTANT(PassKit, PKExtensionPaymentAuthorizationUIExtensionPointName, NSString *);
+
+namespace WebKit {
+
+void WebPaymentCoordinatorProxy::platformShowPaymentUI(const WebCore::URL&amp; originatingURL, const Vector&lt;WebCore::URL&gt;&amp; linkIconURLStrings, const WebCore::PaymentRequest&amp; request, std::function&lt;void (bool)&gt; completionHandler)
+{
+    auto paymentRequest = toPKPaymentRequest(originatingURL, linkIconURLStrings, request);
+
+    auto showPaymentUIRequestSeed = m_showPaymentUIRequestSeed;
+    auto weakThis = m_weakPtrFactory.createWeakPtr();
+    [getPKPaymentAuthorizationViewControllerClass() requestViewControllerWithPaymentRequest:paymentRequest.get() completion:[paymentRequest, showPaymentUIRequestSeed, weakThis, completionHandler](PKPaymentAuthorizationViewController *viewController, NSError *error) {
+        auto paymentCoordinatorProxy = weakThis.get();
+        if (!paymentCoordinatorProxy)
+            return;
+
+        if (error) {
+            LOG_ERROR(&quot;+[PKPaymentAuthorizationViewController requestViewControllerWithPaymentRequest:completion:] error %@&quot;, error);
+
+            completionHandler(false);
+            return;
+        }
+
+        if (showPaymentUIRequestSeed != paymentCoordinatorProxy-&gt;m_showPaymentUIRequestSeed) {
+            // We've already been asked to hide the payment UI. Don't attempt to show it.
+            return;
+        }
+
+        ASSERT(viewController);
+
+        paymentCoordinatorProxy-&gt;m_paymentAuthorizationViewControllerDelegate = adoptNS([[WKPaymentAuthorizationViewControllerDelegate alloc] initWithPaymentCoordinatorProxy:*paymentCoordinatorProxy]);
+        paymentCoordinatorProxy-&gt;m_paymentAuthorizationViewControllerDelegate-&gt;_paymentSummaryItems = [paymentRequest paymentSummaryItems];
+        paymentCoordinatorProxy-&gt;m_paymentAuthorizationViewControllerDelegate-&gt;_shippingMethods = [paymentRequest shippingMethods];
+        paymentCoordinatorProxy-&gt;m_paymentAuthorizationViewController = viewController;
+        [paymentCoordinatorProxy-&gt;m_paymentAuthorizationViewController setDelegate:paymentCoordinatorProxy-&gt;m_paymentAuthorizationViewControllerDelegate.get()];
+        [paymentCoordinatorProxy-&gt;m_paymentAuthorizationViewController setPrivateDelegate:paymentCoordinatorProxy-&gt;m_paymentAuthorizationViewControllerDelegate.get()];
+
+        ASSERT(!paymentCoordinatorProxy-&gt;m_sheetWindow);
+        paymentCoordinatorProxy-&gt;m_sheetWindow = [NSWindow windowWithContentViewController:viewController];
+        [paymentCoordinatorProxy-&gt;m_webPageProxy.platformWindow() beginSheet:paymentCoordinatorProxy-&gt;m_sheetWindow.get() completionHandler:nullptr];
+
+        completionHandler(true);
+    }];
+}
+
+void WebPaymentCoordinatorProxy::hidePaymentUI()
+{
+    if (m_state == State::Activating) {
+        ++m_showPaymentUIRequestSeed;
+
+        ASSERT(!m_paymentAuthorizationViewController);
+        ASSERT(!m_paymentAuthorizationViewControllerDelegate);
+        ASSERT(!m_sheetWindow);
+        return;
+    }
+
+    ASSERT(m_paymentAuthorizationViewController);
+    ASSERT(m_paymentAuthorizationViewControllerDelegate);
+    ASSERT(m_sheetWindow);
+
+    [[m_sheetWindow sheetParent] endSheet:m_sheetWindow.get()];
+    [m_paymentAuthorizationViewController setDelegate:nil];
+    [m_paymentAuthorizationViewController setPrivateDelegate:nil];
+    m_paymentAuthorizationViewController = nullptr;
+
+    [m_paymentAuthorizationViewControllerDelegate invalidate];
+    m_paymentAuthorizationViewControllerDelegate = nullptr;
+
+    m_sheetWindow = nullptr;
+}
+
+}
+
+extern &quot;C&quot; {
+WK_EXPORT bool WKPreferencesGetApplePayEnabled(WKPreferencesRef preferencesRef);
+WK_EXPORT void WKPreferencesSetApplePayEnabled(WKPreferencesRef preferencesRef, bool enabled);
+
+WK_EXPORT bool WKPreferencesGetApplePayCapabilityDisclosureAllowed(WKPreferencesRef preferencesRef);
+WK_EXPORT void WKPreferencesSetApplePayCapabilityDisclosureAllowed(WKPreferencesRef preferencesRef, bool allowed);
+
+// FIXME: Get rid of these in favor of the ones that mention Apple Pay.
+WK_EXPORT bool WKPreferencesGetPaymentsEnabled(WKPreferencesRef preferencesRef);
+WK_EXPORT void WKPreferencesSetPaymentsEnabled(WKPreferencesRef preferencesRef, bool enabled);
+}
+
+WK_EXPORT bool WKPreferencesGetApplePayEnabled(WKPreferencesRef preferencesRef)
+{
+    return WebKit::toImpl(preferencesRef)-&gt;applePayEnabled();
+}
+
+void WKPreferencesSetApplePayEnabled(WKPreferencesRef preferencesRef, bool enabled)
+{
+    WebKit::toImpl(preferencesRef)-&gt;setApplePayEnabled(enabled);
+}
+
+bool WKPreferencesGetApplePayCapabilityDisclosureAllowed(WKPreferencesRef preferencesRef)
+{
+    return WebKit::toImpl(preferencesRef)-&gt;applePayCapabilityDisclosureAllowed();
+}
+
+void WKPreferencesSetApplePayCapabilityDisclosureAllowed(WKPreferencesRef preferencesRef, bool allowed)
+{
+    WebKit::toImpl(preferencesRef)-&gt;setApplePayCapabilityDisclosureAllowed(allowed);
+}
+
+bool WKPreferencesGetPaymentsEnabled(WKPreferencesRef preferencesRef)
+{
+    return WKPreferencesGetApplePayEnabled(preferencesRef);
+}
+
+void WKPreferencesSetPaymentsEnabled(WKPreferencesRef preferencesRef, bool enabled)
+{
+    WKPreferencesSetApplePayEnabled(preferencesRef, enabled);
+}
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (202431 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2016-06-24 18:21:05 UTC (rev 202431)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -97,6 +97,7 @@
</span><span class="cx"> #include &quot;WebPageGroupData.h&quot;
</span><span class="cx"> #include &quot;WebPageMessages.h&quot;
</span><span class="cx"> #include &quot;WebPageProxyMessages.h&quot;
</span><ins>+#include &quot;WebPaymentCoordinatorProxy.h&quot;
</ins><span class="cx"> #include &quot;WebPopupItem.h&quot;
</span><span class="cx"> #include &quot;WebPopupMenuProxy.h&quot;
</span><span class="cx"> #include &quot;WebPreferences.h&quot;
</span><span class="lines">@@ -167,10 +168,6 @@
</span><span class="cx"> #include &lt;WebCore/MediaSessionMetadata.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if USE(APPLE_INTERNAL_SDK)
-#include &lt;WebKitAdditions/WebPageProxyIncludes.h&gt;
-#endif
-
</del><span class="cx"> #if PLATFORM(IOS) || (PLATFORM(MAC) &amp;&amp; ENABLE(VIDEO_PRESENTATION_MODE))
</span><span class="cx"> #include &quot;WebPlaybackSessionManagerProxy.h&quot;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (202431 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2016-06-24 18:21:05 UTC (rev 202431)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx"> #include &quot;WebPageCreationParameters.h&quot;
</span><span class="cx"> #include &quot;WebPageDiagnosticLoggingClient.h&quot;
</span><span class="cx"> #include &quot;WebPageInjectedBundleClient.h&quot;
</span><ins>+#include &quot;WebPaymentCoordinatorProxy.h&quot;
</ins><span class="cx"> #include &quot;WebPreferences.h&quot;
</span><span class="cx"> #include &lt;WebCore/AlternativeTextClient.h&gt; // FIXME: Needed by WebPageProxyMessages.h for DICTATION_ALTERNATIVES.
</span><span class="cx"> #include &quot;WebPageProxyMessages.h&quot;
</span><span class="lines">@@ -116,10 +117,6 @@
</span><span class="cx"> #include &lt;WebCore/WebMediaSessionManagerClient.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if USE(APPLE_INTERNAL_SDK)
-#include &lt;WebKitAdditions/WebPageProxyIncludes.h&gt;
-#endif
-
</del><span class="cx"> #if ENABLE(MEDIA_SESSION)
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> class MediaSessionMetadata;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (202431 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2016-06-24 18:21:05 UTC (rev 202431)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -296,7 +296,6 @@
</span><span class="cx">                 1A6FBD2811E69BC200DB1371 /* NetscapePlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6FBD2611E69BC200DB1371 /* NetscapePlugin.h */; };
</span><span class="cx">                 1A6FBD2911E69BC200DB1371 /* NetscapePlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FBD2711E69BC200DB1371 /* NetscapePlugin.cpp */; };
</span><span class="cx">                 1A7284481959F8040007BCE5 /* SessionStateConversion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7284441959ED100007BCE5 /* SessionStateConversion.cpp */; };
</span><del>-                1A781AE71C5714DA00FB96DD /* WebKitAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A781AE51C5714DA00FB96DD /* WebKitAdditions.mm */; };
</del><span class="cx">                 1A7865B916CAC71500ACE83A /* PluginProcessConnectionManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7865B716CAC71500ACE83A /* PluginProcessConnectionManagerMessageReceiver.cpp */; };
</span><span class="cx">                 1A7865BA16CAC71500ACE83A /* PluginProcessConnectionManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7865B816CAC71500ACE83A /* PluginProcessConnectionManagerMessages.h */; };
</span><span class="cx">                 1A7C0DF61B7D1F1000A9B848 /* WKWindowFeaturesRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7C0DF41B7D1F1000A9B848 /* WKWindowFeaturesRef.cpp */; };
</span><span class="lines">@@ -383,6 +382,19 @@
</span><span class="cx">                 1AB16AE21648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB16AE01648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.h */; };
</span><span class="cx">                 1AB16AE9164B3A8800290D62 /* RemoteLayerTreeContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AB16AE7164B3A8800290D62 /* RemoteLayerTreeContext.mm */; };
</span><span class="cx">                 1AB16AEA164B3A8800290D62 /* RemoteLayerTreeContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB16AE8164B3A8800290D62 /* RemoteLayerTreeContext.h */; };
</span><ins>+                1AB1F7741D1B2F8A007C9BD1 /* WebPaymentCoordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB1F7711D1B2F7E007C9BD1 /* WebPaymentCoordinator.cpp */; };
+                1AB1F77E1D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB1F7781D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyCocoa.h */; };
+                1AB1F77F1D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AB1F7791D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyCocoa.mm */; };
+                1AB1F7801D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AB1F77B1D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyIOS.mm */; };
+                1AB1F7811D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AB1F77D1D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyMac.mm */; };
+                1AB1F78B1D1B3355007C9BD1 /* WebPaymentCoordinatorProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB1F7881D1B3355007C9BD1 /* WebPaymentCoordinatorProxy.cpp */; };
+                1AB1F78C1D1B3355007C9BD1 /* WebPaymentCoordinatorProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB1F7891D1B3355007C9BD1 /* WebPaymentCoordinatorProxy.h */; };
+                1AB1F7901D1B34A6007C9BD1 /* WebCoreArgumentCodersCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AB1F78E1D1B34A6007C9BD1 /* WebCoreArgumentCodersCocoa.mm */; };
+                1AB1F7911D1B34A6007C9BD1 /* WebCoreArgumentCodersCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB1F78F1D1B34A6007C9BD1 /* WebCoreArgumentCodersCocoa.h */; };
+                1AB1F7961D1B3613007C9BD1 /* WebPaymentCoordinatorMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB1F7921D1B3613007C9BD1 /* WebPaymentCoordinatorMessageReceiver.cpp */; };
+                1AB1F7971D1B3613007C9BD1 /* WebPaymentCoordinatorMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB1F7931D1B3613007C9BD1 /* WebPaymentCoordinatorMessages.h */; };
+                1AB1F7981D1B3613007C9BD1 /* WebPaymentCoordinatorProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB1F7941D1B3613007C9BD1 /* WebPaymentCoordinatorProxyMessageReceiver.cpp */; };
+                1AB1F7991D1B3613007C9BD1 /* WebPaymentCoordinatorProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB1F7951D1B3613007C9BD1 /* WebPaymentCoordinatorProxyMessages.h */; };
</ins><span class="cx">                 1AB31A9616BC688100F6DBC9 /* StorageManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB31A9416BC688100F6DBC9 /* StorageManagerMessageReceiver.cpp */; };
</span><span class="cx">                 1AB31A9716BC688100F6DBC9 /* StorageManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB31A9516BC688100F6DBC9 /* StorageManagerMessages.h */; };
</span><span class="cx">                 1AB40EE51BF677E300BA81BE /* WKMenuItemIdentifiers.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AB40EE31BF677E300BA81BE /* WKMenuItemIdentifiers.mm */; };
</span><span class="lines">@@ -2256,7 +2268,6 @@
</span><span class="cx">                 1A6FBD2711E69BC200DB1371 /* NetscapePlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapePlugin.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A7284441959ED100007BCE5 /* SessionStateConversion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SessionStateConversion.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A7284451959ED100007BCE5 /* SessionStateConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SessionStateConversion.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                1A781AE51C5714DA00FB96DD /* WebKitAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKitAdditions.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 1A7865B616CAC6FD00ACE83A /* PluginProcessConnectionManager.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = PluginProcessConnectionManager.messages.in; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A7865B716CAC71500ACE83A /* PluginProcessConnectionManagerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProcessConnectionManagerMessageReceiver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A7865B816CAC71500ACE83A /* PluginProcessConnectionManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessConnectionManagerMessages.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -2357,6 +2368,22 @@
</span><span class="cx">                 1AB16AE01648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreeDrawingAreaProxy.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1AB16AE7164B3A8800290D62 /* RemoteLayerTreeContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerTreeContext.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1AB16AE8164B3A8800290D62 /* RemoteLayerTreeContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreeContext.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                1AB1F7711D1B2F7E007C9BD1 /* WebPaymentCoordinator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPaymentCoordinator.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1AB1F7721D1B2F7E007C9BD1 /* WebPaymentCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPaymentCoordinator.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1AB1F7731D1B2F7E007C9BD1 /* WebPaymentCoordinator.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebPaymentCoordinator.messages.in; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1AB1F7781D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPaymentCoordinatorProxyCocoa.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1AB1F7791D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPaymentCoordinatorProxyCocoa.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1AB1F77B1D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPaymentCoordinatorProxyIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1AB1F77D1D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPaymentCoordinatorProxyMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1AB1F7881D1B3355007C9BD1 /* WebPaymentCoordinatorProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPaymentCoordinatorProxy.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1AB1F7891D1B3355007C9BD1 /* WebPaymentCoordinatorProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPaymentCoordinatorProxy.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1AB1F78A1D1B3355007C9BD1 /* WebPaymentCoordinatorProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebPaymentCoordinatorProxy.messages.in; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1AB1F78E1D1B34A6007C9BD1 /* WebCoreArgumentCodersCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreArgumentCodersCocoa.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1AB1F78F1D1B34A6007C9BD1 /* WebCoreArgumentCodersCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreArgumentCodersCocoa.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1AB1F7921D1B3613007C9BD1 /* WebPaymentCoordinatorMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPaymentCoordinatorMessageReceiver.cpp; path = WebPaymentCoordinatorMessageReceiver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1AB1F7931D1B3613007C9BD1 /* WebPaymentCoordinatorMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebPaymentCoordinatorMessages.h; path = WebPaymentCoordinatorMessages.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1AB1F7941D1B3613007C9BD1 /* WebPaymentCoordinatorProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPaymentCoordinatorProxyMessageReceiver.cpp; path = WebPaymentCoordinatorProxyMessageReceiver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1AB1F7951D1B3613007C9BD1 /* WebPaymentCoordinatorProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebPaymentCoordinatorProxyMessages.h; path = WebPaymentCoordinatorProxyMessages.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 1AB31A9316BC65AB00F6DBC9 /* StorageManager.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = StorageManager.messages.in; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1AB31A9416BC688100F6DBC9 /* StorageManagerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageManagerMessageReceiver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1AB31A9516BC688100F6DBC9 /* StorageManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageManagerMessages.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -4420,7 +4447,7 @@
</span><span class="cx">                                 518E8EF116B208F000E91429 /* Authentication */,
</span><span class="cx">                                 1AAF0C4712B16328008E49E2 /* cf */,
</span><span class="cx">                                 C01A25FF12662F2100C9ED55 /* cg */,
</span><del>-                                37C4C0901814B37B003688B9 /* Cocoa */,
</del><ins>+                                37C4C0901814B37B003688B9 /* cocoa */,
</ins><span class="cx">                                 51E351C2180F2C8500E53BE9 /* Databases */,
</span><span class="cx">                                 BC82836816B3587900A278FE /* EntryPointUtilities */,
</span><span class="cx">                                 E170877216D6CFEC00F99226 /* FileAPI */,
</span><span class="lines">@@ -4621,6 +4648,54 @@
</span><span class="cx">                         path = cf;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="cx">                 };
</span><ins>+                1AB1F7701D1B2F5D007C9BD1 /* ApplePay */ = {
+                        isa = PBXGroup;
+                        children = (
+                                1AB1F7711D1B2F7E007C9BD1 /* WebPaymentCoordinator.cpp */,
+                                1AB1F7721D1B2F7E007C9BD1 /* WebPaymentCoordinator.h */,
+                                1AB1F7731D1B2F7E007C9BD1 /* WebPaymentCoordinator.messages.in */,
+                        );
+                        path = ApplePay;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
+                1AB1F7761D1B30A9007C9BD1 /* ApplePay */ = {
+                        isa = PBXGroup;
+                        children = (
+                                1AB1F7771D1B30A9007C9BD1 /* cocoa */,
+                                1AB1F77A1D1B30A9007C9BD1 /* ios */,
+                                1AB1F77C1D1B30A9007C9BD1 /* mac */,
+                                1AB1F7881D1B3355007C9BD1 /* WebPaymentCoordinatorProxy.cpp */,
+                                1AB1F7891D1B3355007C9BD1 /* WebPaymentCoordinatorProxy.h */,
+                                1AB1F78A1D1B3355007C9BD1 /* WebPaymentCoordinatorProxy.messages.in */,
+                        );
+                        path = ApplePay;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
+                1AB1F7771D1B30A9007C9BD1 /* cocoa */ = {
+                        isa = PBXGroup;
+                        children = (
+                                1AB1F7781D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyCocoa.h */,
+                                1AB1F7791D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyCocoa.mm */,
+                        );
+                        path = cocoa;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
+                1AB1F77A1D1B30A9007C9BD1 /* ios */ = {
+                        isa = PBXGroup;
+                        children = (
+                                1AB1F77B1D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyIOS.mm */,
+                        );
+                        path = ios;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
+                1AB1F77C1D1B30A9007C9BD1 /* mac */ = {
+                        isa = PBXGroup;
+                        children = (
+                                1AB1F77D1D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyMac.mm */,
+                        );
+                        path = mac;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
</ins><span class="cx">                 1AB7D4C71288AA9A00CFD08C /* Downloads */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -5163,9 +5238,11 @@
</span><span class="cx">                         path = Cocoa;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="cx">                 };
</span><del>-                37C4C0901814B37B003688B9 /* Cocoa */ = {
</del><ins>+                37C4C0901814B37B003688B9 /* cocoa */ = {
</ins><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                1AB1F78E1D1B34A6007C9BD1 /* WebCoreArgumentCodersCocoa.mm */,
+                                1AB1F78F1D1B34A6007C9BD1 /* WebCoreArgumentCodersCocoa.h */,
</ins><span class="cx">                                 1A1EF1971A1D5B420023200A /* APIDataCocoa.mm */,
</span><span class="cx">                                 378E1A3B181ED6FF0031007A /* APIObject.mm */,
</span><span class="cx">                                 37BEC4DF19491486008B4286 /* CompletionHandlerCallChecker.h */,
</span><span class="lines">@@ -5172,7 +5249,6 @@
</span><span class="cx">                                 37BEC4DE19491486008B4286 /* CompletionHandlerCallChecker.mm */,
</span><span class="cx">                                 C55F916C1C595E440029E92D /* DataDetectionResult.h */,
</span><span class="cx">                                 C55F916D1C595E440029E92D /* DataDetectionResult.mm */,
</span><del>-                                1A781AE51C5714DA00FB96DD /* WebKitAdditions.mm */,
</del><span class="cx">                                 37C4C0921814B3AF003688B9 /* WKNSArray.h */,
</span><span class="cx">                                 37C4C0911814B3AF003688B9 /* WKNSArray.mm */,
</span><span class="cx">                                 373CEAD4185417AE008C363D /* WKNSData.h */,
</span><span class="lines">@@ -5192,6 +5268,7 @@
</span><span class="cx">                                 378E1A3F181EDA010031007A /* WKObject.h */,
</span><span class="cx">                                 374436871820E7240049579F /* WKObject.mm */,
</span><span class="cx">                         );
</span><ins>+                        name = cocoa;
</ins><span class="cx">                         path = Cocoa;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="cx">                 };
</span><span class="lines">@@ -5718,6 +5795,7 @@
</span><span class="cx">                 BC032D5C10F436D50058C15A /* WebProcess */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                1AB1F7701D1B2F5D007C9BD1 /* ApplePay */,
</ins><span class="cx">                                 1C0A19431C8FF1A800FE0EBB /* Automation */,
</span><span class="cx">                                 7C6E70F818B2D47E00F24E2E /* cocoa */,
</span><span class="cx">                                 3309344B1315B93A0097A7BC /* Cookies */,
</span><span class="lines">@@ -5857,6 +5935,7 @@
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 BC032DC410F4387C0058C15A /* API */,
</span><ins>+                                1AB1F7761D1B30A9007C9BD1 /* ApplePay */,
</ins><span class="cx">                                 512F588D12A8836F00629530 /* Authentication */,
</span><span class="cx">                                 9955A6E81C79809000EB6A93 /* Automation */,
</span><span class="cx">                                 1ABC3DF21899E415004F0626 /* Cocoa */,
</span><span class="lines">@@ -6866,6 +6945,10 @@
</span><span class="cx">                 C0CE729D1247E71D00BC0EC4 /* Derived Sources */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                1AB1F7921D1B3613007C9BD1 /* WebPaymentCoordinatorMessageReceiver.cpp */,
+                                1AB1F7931D1B3613007C9BD1 /* WebPaymentCoordinatorMessages.h */,
+                                1AB1F7941D1B3613007C9BD1 /* WebPaymentCoordinatorProxyMessageReceiver.cpp */,
+                                1AB1F7951D1B3613007C9BD1 /* WebPaymentCoordinatorProxyMessages.h */,
</ins><span class="cx">                                 512F58A012A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp */,
</span><span class="cx">                                 512F58A112A883AD00629530 /* AuthenticationManagerMessages.h */,
</span><span class="cx">                                 9955A6F01C79866400EB6A93 /* AutomationBackendDispatchers.cpp */,
</span><span class="lines">@@ -7705,6 +7788,7 @@
</span><span class="cx">                                 9391F2CB121B67AD00EBF7E8 /* WebFrameNetworkingContext.h in Headers */,
</span><span class="cx">                                 BCB9F6A01123A84B00A137E0 /* WebFramePolicyListenerProxy.h in Headers */,
</span><span class="cx">                                 BC9B38A110F538BE00443A15 /* WebFrameProxy.h in Headers */,
</span><ins>+                                1AB1F7991D1B3613007C9BD1 /* WebPaymentCoordinatorProxyMessages.h in Headers */,
</ins><span class="cx">                                 BC1BE1E012D54A410004A228 /* WebGeolocationClient.h in Headers */,
</span><span class="cx">                                 BC0E5FE512D697160012A72A /* WebGeolocationManager.h in Headers */,
</span><span class="cx">                                 BC0E606212D6BA910012A72A /* WebGeolocationManagerMessages.h in Headers */,
</span><span class="lines">@@ -7786,6 +7870,7 @@
</span><span class="cx">                                 BC306824125A6B9400E71278 /* WebProcessCreationParameters.h in Headers */,
</span><span class="cx">                                 1AFA4B901A65A9E2006C4AB4 /* WebProcessLifetimeObserver.h in Headers */,
</span><span class="cx">                                 1AFA4B8C1A65A1D0006C4AB4 /* WebProcessLifetimeTracker.h in Headers */,
</span><ins>+                                1AB1F78C1D1B3355007C9BD1 /* WebPaymentCoordinatorProxy.h in Headers */,
</ins><span class="cx">                                 BC3066BF125A442100E71278 /* WebProcessMessages.h in Headers */,
</span><span class="cx">                                 7CE4D21B1A4914A300C7F152 /* WebProcessPool.h in Headers */,
</span><span class="cx">                                 7CE4D2281A4916C200C7F152 /* WebProcessPoolMessages.h in Headers */,
</span><span class="lines">@@ -7906,6 +7991,7 @@
</span><span class="cx">                                 3309345B1315B9980097A7BC /* WKCookieManager.h in Headers */,
</span><span class="cx">                                 512F58FA12A88A5400629530 /* WKCredential.h in Headers */,
</span><span class="cx">                                 518ACF1112B015F800B04B83 /* WKCredentialTypes.h in Headers */,
</span><ins>+                                1AB1F7971D1B3613007C9BD1 /* WebPaymentCoordinatorMessages.h in Headers */,
</ins><span class="cx">                                 BC4075F8124FF0270068F20A /* WKData.h in Headers */,
</span><span class="cx">                                 377EAD4517E2C51A002D193D /* WKDeclarationSpecifiers.h in Headers */,
</span><span class="cx">                                 8372DB2F1A677D4A00C697C5 /* WKDiagnosticLoggingResultType.h in Headers */,
</span><span class="lines">@@ -8053,10 +8139,12 @@
</span><span class="cx">                                 1AD01BCD1905D54900C9C45F /* WKReloadFrameErrorRecoveryAttempter.h in Headers */,
</span><span class="cx">                                 1A9E329B1822E1CC00F5D04C /* WKRemoteObject.h in Headers */,
</span><span class="cx">                                 1A9E329F1822FEDD00F5D04C /* WKRemoteObjectCoder.h in Headers */,
</span><ins>+                                1AB1F7911D1B34A6007C9BD1 /* WebCoreArgumentCodersCocoa.h in Headers */,
</ins><span class="cx">                                 37948409150C4B9700E52CE9 /* WKRenderLayer.h in Headers */,
</span><span class="cx">                                 37608823150414F700FC82C7 /* WKRenderObject.h in Headers */,
</span><span class="cx">                                 3336763B130C99DC006C9DE2 /* WKResourceCacheManager.h in Headers */,
</span><span class="cx">                                 A19DD3C01D07D16800AC823B /* _WKWebViewPrintFormatterInternal.h in Headers */,
</span><ins>+                                1AB1F77E1D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyCocoa.h in Headers */,
</ins><span class="cx">                                 BC8A501511765F5600757573 /* WKRetainPtr.h in Headers */,
</span><span class="cx">                                 1A7E377918E4A4FE003D0FFF /* WKScriptMessage.h in Headers */,
</span><span class="cx">                                 1A7E377518E4A33A003D0FFF /* WKScriptMessageHandler.h in Headers */,
</span><span class="lines">@@ -9009,6 +9097,7 @@
</span><span class="cx">                                 BCC43ABA127B95DC00317F16 /* PlatformPopupMenuData.cpp in Sources */,
</span><span class="cx">                                 1A6FB7D211E651E200DB1371 /* Plugin.cpp in Sources */,
</span><span class="cx">                                 31A67E0C165B2A99006CBA66 /* PlugInAutoStartProvider.cpp in Sources */,
</span><ins>+                                1AB1F7961D1B3613007C9BD1 /* WebPaymentCoordinatorMessageReceiver.cpp in Sources */,
</ins><span class="cx">                                 1A8EF4CC1252403700F7067F /* PluginControllerProxy.cpp in Sources */,
</span><span class="cx">                                 1A2D91A61281D739001EB962 /* PluginControllerProxyMac.mm in Sources */,
</span><span class="cx">                                 1A8EF96E1252AF6B00F7067F /* PluginControllerProxyMessageReceiver.cpp in Sources */,
</span><span class="lines">@@ -9030,6 +9119,7 @@
</span><span class="cx">                                 1A0EC75F124BC7B2007EF4A5 /* PluginProcessProxy.cpp in Sources */,
</span><span class="cx">                                 1A2D90BB1281C931001EB962 /* PluginProcessProxyMac.mm in Sources */,
</span><span class="cx">                                 1A043B5D124D5E9D00FFBFB5 /* PluginProcessProxyMessageReceiver.cpp in Sources */,
</span><ins>+                                1AB1F7741D1B2F8A007C9BD1 /* WebPaymentCoordinator.cpp in Sources */,
</ins><span class="cx">                                 1A043DC2124FF87500FFBFB5 /* PluginProxy.cpp in Sources */,
</span><span class="cx">                                 1A2D92211281DC1B001EB962 /* PluginProxyMac.mm in Sources */,
</span><span class="cx">                                 1A8EFA701252B84100F7067F /* PluginProxyMessageReceiver.cpp in Sources */,
</span><span class="lines">@@ -9209,6 +9299,7 @@
</span><span class="cx">                                 51834592134532E90092B696 /* WebIconDatabaseClient.cpp in Sources */,
</span><span class="cx">                                 51D02F64132EC5B900BEAA96 /* WebIconDatabaseMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 511B24A6132E095700065A0C /* WebIconDatabaseProxy.cpp in Sources */,
</span><ins>+                                1AB1F77F1D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyCocoa.mm in Sources */,
</ins><span class="cx">                                 51D02F6B132EC73700BEAA96 /* WebIconDatabaseProxyMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 5105236F1C739D42007993CB /* WebIDBConnectionToClient.cpp in Sources */,
</span><span class="cx">                                 510523791C73DA77007993CB /* WebIDBConnectionToClientMessageReceiver.cpp in Sources */,
</span><span class="lines">@@ -9229,7 +9320,6 @@
</span><span class="cx">                                 C0337DD3127A2A0E008FF4F4 /* WebKeyboardEvent.cpp in Sources */,
</span><span class="cx">                                 1A6280F31919982A006AD9F9 /* WebKit.m in Sources */,
</span><span class="cx">                                 BC9BA5041697C45300E44616 /* WebKit2Initialize.cpp in Sources */,
</span><del>-                                1A781AE71C5714DA00FB96DD /* WebKitAdditions.mm in Sources */,
</del><span class="cx">                                 51FB08FF1639DE1A00EC324A /* WebLoaderStrategy.cpp in Sources */,
</span><span class="cx">                                 CD003A5219D49B5D005ABCE0 /* WebMediaKeyStorageManager.cpp in Sources */,
</span><span class="cx">                                 C98C48A51B6FD4C300145103 /* WebMediaSessionFocusManager.cpp in Sources */,
</span><span class="lines">@@ -9249,8 +9339,10 @@
</span><span class="cx">                                 BC857F8612B82D0B00EDEB2E /* WebOpenPanelResultListener.cpp in Sources */,
</span><span class="cx">                                 BC857F7E12B82CEE00EDEB2E /* WebOpenPanelResultListenerProxy.cpp in Sources */,
</span><span class="cx">                                 BC963D6B113DD19200574BE2 /* WebPage.cpp in Sources */,
</span><ins>+                                1AB1F78B1D1B3355007C9BD1 /* WebPaymentCoordinatorProxy.cpp in Sources */,
</ins><span class="cx">                                 C06C6095124C144B0001682F /* WebPageCreationParameters.cpp in Sources */,
</span><span class="cx">                                 8372DB281A67562800C697C5 /* WebPageDiagnosticLoggingClient.cpp in Sources */,
</span><ins>+                                1AB1F7981D1B3613007C9BD1 /* WebPaymentCoordinatorProxyMessageReceiver.cpp in Sources */,
</ins><span class="cx">                                 BC7B6207129A0A6700D174A4 /* WebPageGroup.cpp in Sources */,
</span><span class="cx">                                 BC7B625312A43C9600D174A4 /* WebPageGroupData.cpp in Sources */,
</span><span class="cx">                                 BC7B621612A4219A00D174A4 /* WebPageGroupProxy.cpp in Sources */,
</span><span class="lines">@@ -9371,6 +9463,7 @@
</span><span class="cx">                                 EDCA71B7128DDA8C00201B26 /* WKBundlePageOverlay.cpp in Sources */,
</span><span class="cx">                                 BC60C57A1240A546008C5E29 /* WKBundleRangeHandle.cpp in Sources */,
</span><span class="cx">                                 BC14DF9E120B635F00826C0C /* WKBundleScriptWorld.cpp in Sources */,
</span><ins>+                                1AB1F7801D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyIOS.mm in Sources */,
</ins><span class="cx">                                 BC4075F5124FF0270068F20A /* WKCertificateInfo.cpp in Sources */,
</span><span class="cx">                                 BC407628124FF0400068F20A /* WKCertificateInfoMac.mm in Sources */,
</span><span class="cx">                                 BCA284D61492F2C7001F9042 /* WKConnection.mm in Sources */,
</span><span class="lines">@@ -9384,6 +9477,7 @@
</span><span class="cx">                                 3309345A1315B9980097A7BC /* WKCookieManager.cpp in Sources */,
</span><span class="cx">                                 512F58F912A88A5400629530 /* WKCredential.cpp in Sources */,
</span><span class="cx">                                 BC4075F7124FF0270068F20A /* WKData.cpp in Sources */,
</span><ins>+                                1AB1F7901D1B34A6007C9BD1 /* WebCoreArgumentCodersCocoa.mm in Sources */,
</ins><span class="cx">                                 1AFF49001833DE78009AB15A /* WKDeprecatedFunctions.cpp in Sources */,
</span><span class="cx">                                 BC4075F9124FF0270068F20A /* WKDictionary.cpp in Sources */,
</span><span class="cx">                                 BC017D0816260FF4007054F5 /* WKDOMDocument.mm in Sources */,
</span><span class="lines">@@ -9497,6 +9591,7 @@
</span><span class="cx">                                 0FCB4E6918BBE3D9000FCFC9 /* WKTextInputWindowController.mm in Sources */,
</span><span class="cx">                                 BC407607124FF0270068F20A /* WKType.cpp in Sources */,
</span><span class="cx">                                 7CD5EBBE1746B04C000C1C45 /* WKTypeRefWrapper.mm in Sources */,
</span><ins>+                                1AB1F7811D1B30A9007C9BD1 /* WebPaymentCoordinatorProxyMac.mm in Sources */,
</ins><span class="cx">                                 BC407609124FF0270068F20A /* WKURL.cpp in Sources */,
</span><span class="cx">                                 BC40761B124FF0370068F20A /* WKURLCF.mm in Sources */,
</span><span class="cx">                                 BC40760B124FF0270068F20A /* WKURLRequest.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessApplePayWebPaymentCoordinatorcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.cpp (0 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.cpp                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.cpp        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -0,0 +1,174 @@
</span><ins>+/*
+ * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;WebPaymentCoordinator.h&quot;
+
+#if ENABLE(APPLE_PAY)
+
+#include &quot;DataReference.h&quot;
+#include &quot;WebPage.h&quot;
+#include &quot;WebPaymentCoordinatorMessages.h&quot;
+#include &quot;WebPaymentCoordinatorProxyMessages.h&quot;
+#include &quot;WebProcess.h&quot;
+#include &lt;WebCore/MainFrame.h&gt;
+#include &lt;WebCore/PaymentCoordinator.h&gt;
+#include &lt;WebCore/URL.h&gt;
+
+namespace WebKit {
+
+WebPaymentCoordinator::WebPaymentCoordinator(WebPage&amp; webPage)
+    : m_webPage(webPage)
+{
+    WebProcess::singleton().addMessageReceiver(Messages::WebPaymentCoordinator::messageReceiverName(), m_webPage.pageID(), *this);
+}
+
+WebPaymentCoordinator::~WebPaymentCoordinator()
+{
+    WebProcess::singleton().removeMessageReceiver(Messages::WebPaymentCoordinator::messageReceiverName(), m_webPage.pageID());
+}
+
+bool WebPaymentCoordinator::supportsVersion(unsigned version)
+{
+    ASSERT(version &gt; 0);
+
+    if (version == 1)
+        return true;
+
+    return false;
+}
+
+bool WebPaymentCoordinator::canMakePayments()
+{
+    bool canMakePayments;
+    if (!m_webPage.sendSync(Messages::WebPaymentCoordinatorProxy::CanMakePayments(), Messages::WebPaymentCoordinatorProxy::CanMakePayments::Reply(canMakePayments)))
+        return false;
+
+    return canMakePayments;
+}
+
+static uint64_t generateCanMakePaymentsWithActiveCardReplyID()
+{
+    static uint64_t canMakePaymentsWithActiveCardReplyID;
+
+    return ++canMakePaymentsWithActiveCardReplyID;
+}
+
+void WebPaymentCoordinator::canMakePaymentsWithActiveCard(const String&amp; merchantIdentifier, const String&amp; domainName, std::function&lt;void (bool)&gt; completionHandler)
+{
+    auto replyID = generateCanMakePaymentsWithActiveCardReplyID();
+
+    m_pendingCanMakePaymentsWithActiveCardCallbacks.add(replyID, WTFMove(completionHandler));
+    m_webPage.send(Messages::WebPaymentCoordinatorProxy::CanMakePaymentsWithActiveCard(merchantIdentifier, domainName, replyID));
+}
+
+void WebPaymentCoordinator::showPaymentUI(const WebCore::URL&amp; originatingURL, const Vector&lt;WebCore::URL&gt;&amp; linkIconURLs, const WebCore::PaymentRequest&amp; paymentRequest)
+{
+    Vector&lt;String&gt; linkIconURLStrings;
+    for (const auto&amp; linkIconURL : linkIconURLs)
+        linkIconURLStrings.append(linkIconURL.string());
+
+    m_webPage.send(Messages::WebPaymentCoordinatorProxy::ShowPaymentUI(originatingURL.string(), linkIconURLStrings, paymentRequest));
+}
+
+void WebPaymentCoordinator::completeMerchantValidation(const WebCore::PaymentMerchantSession&amp; paymentMerchantSession)
+{
+    m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteMerchantValidation(paymentMerchantSession));
+}
+
+void WebPaymentCoordinator::completeShippingMethodSelection(WebCore::PaymentAuthorizationStatus status, Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt; newTotalAndItems)
+{
+    m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteShippingMethodSelection(static_cast&lt;uint32_t&gt;(status), newTotalAndItems));
+}
+
+void WebPaymentCoordinator::completeShippingContactSelection(WebCore::PaymentAuthorizationStatus status, const Vector&lt;WebCore::PaymentRequest::ShippingMethod&gt;&amp; newShippingMethods, Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt; newTotalAndItems)
+{
+    m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompleteShippingContactSelection(static_cast&lt;uint32_t&gt;(status), newShippingMethods, newTotalAndItems));
+}
+
+void WebPaymentCoordinator::completePaymentMethodSelection(Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt; newTotalAndItems)
+{
+    m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompletePaymentMethodSelection(newTotalAndItems));
+}
+
+void WebPaymentCoordinator::completePaymentSession(WebCore::PaymentAuthorizationStatus status)
+{
+    m_webPage.send(Messages::WebPaymentCoordinatorProxy::CompletePaymentSession(static_cast&lt;uint32_t&gt;(status)));
+}
+
+void WebPaymentCoordinator::abortPaymentSession()
+{
+    m_webPage.send(Messages::WebPaymentCoordinatorProxy::AbortPaymentSession());
+}
+
+void WebPaymentCoordinator::mainFrameDestroyed()
+{
+    delete this;
+}
+
+void WebPaymentCoordinator::validateMerchant(const String&amp; validationURLString)
+{
+    paymentCoordinator().validateMerchant(WebCore::URL(WebCore::URL(), validationURLString));
+}
+
+void WebPaymentCoordinator::didAuthorizePayment(const WebCore::Payment&amp; payment)
+{
+    paymentCoordinator().didAuthorizePayment(payment);
+}
+
+void WebPaymentCoordinator::didSelectShippingMethod(const WebCore::PaymentRequest::ShippingMethod&amp; shippingMethod)
+{
+    paymentCoordinator().didSelectShippingMethod(shippingMethod);
+}
+
+void WebPaymentCoordinator::didSelectShippingContact(const WebCore::PaymentContact&amp; shippingContact)
+{
+    paymentCoordinator().didSelectShippingContact(shippingContact);
+}
+
+void WebPaymentCoordinator::didSelectPaymentMethod(const WebCore::PaymentMethod&amp; paymentMethod)
+{
+    paymentCoordinator().didSelectPaymentMethod(paymentMethod);
+}
+
+void WebPaymentCoordinator::didCancelPayment()
+{
+    paymentCoordinator().didCancelPayment();
+}
+
+void WebPaymentCoordinator::canMakePaymentsWithActiveCardReply(uint64_t requestID, bool canMakePayments)
+{
+    auto callback = m_pendingCanMakePaymentsWithActiveCardCallbacks.take(requestID);
+    callback(canMakePayments);
+}
+
+WebCore::PaymentCoordinator&amp; WebPaymentCoordinator::paymentCoordinator()
+{
+    return m_webPage.mainFrame()-&gt;paymentCoordinator();
+}
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessApplePayWebPaymentCoordinatorh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.h (0 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.h                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.h        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -0,0 +1,89 @@
</span><ins>+/*
+ * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(APPLE_PAY)
+
+#include &quot;MessageReceiver.h&quot;
+#include &lt;WebCore/PaymentCoordinatorClient.h&gt;
+#include &lt;WebCore/PaymentHeaders.h&gt;
+#include &lt;wtf/Forward.h&gt;
+#include &lt;wtf/HashMap.h&gt;
+
+namespace IPC {
+class DataReference;
+}
+
+namespace WebCore {
+class PaymentCoordinator;
+class PaymentContact;
+}
+
+namespace WebKit {
+
+class WebPage;
+
+class WebPaymentCoordinator final : public WebCore::PaymentCoordinatorClient, private IPC::MessageReceiver {
+public:
+    explicit WebPaymentCoordinator(WebPage&amp;);
+    ~WebPaymentCoordinator();
+
+private:
+    // WebCore::PaymentCoordinatorClient.
+    bool supportsVersion(unsigned version) override;
+    bool canMakePayments() override;
+    void canMakePaymentsWithActiveCard(const String&amp; merchantIdentifier, const String&amp; domainName, std::function&lt;void (bool)&gt; completionHandler) override;
+    void showPaymentUI(const WebCore::URL&amp; originatingURL, const Vector&lt;WebCore::URL&gt;&amp; linkIconURLs, const WebCore::PaymentRequest&amp;) override;
+    void completeMerchantValidation(const WebCore::PaymentMerchantSession&amp;) override;
+    void completeShippingMethodSelection(WebCore::PaymentAuthorizationStatus, Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt; newTotalAndItems) override;
+    void completeShippingContactSelection(WebCore::PaymentAuthorizationStatus, const Vector&lt;WebCore::PaymentRequest::ShippingMethod&gt;&amp;, Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt; newTotalAndItems) override;
+    void completePaymentMethodSelection(Optional&lt;WebCore::PaymentRequest::TotalAndLineItems&gt;) override;
+    void completePaymentSession(WebCore::PaymentAuthorizationStatus) override;
+    void abortPaymentSession() override;
+
+    void mainFrameDestroyed() override;
+
+    // IPC::MessageReceiver.
+    void didReceiveMessage(IPC::Connection&amp;, IPC::MessageDecoder&amp;) override;
+
+    // Message handlers.
+    void validateMerchant(const String&amp; validationURLString);
+    void didAuthorizePayment(const WebCore::Payment&amp;);
+    void didSelectShippingMethod(const WebCore::PaymentRequest::ShippingMethod&amp;);
+    void didSelectShippingContact(const WebCore::PaymentContact&amp;);
+    void didSelectPaymentMethod(const WebCore::PaymentMethod&amp;);
+    void didCancelPayment();
+    void canMakePaymentsWithActiveCardReply(uint64_t requestID, bool canMakePayments);
+
+    WebCore::PaymentCoordinator&amp; paymentCoordinator();
+
+    WebPage&amp; m_webPage;
+
+    HashMap&lt;uint64_t, std::function&lt;void (bool)&gt;&gt; m_pendingCanMakePaymentsWithActiveCardCallbacks;
+};
+
+}
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessApplePayWebPaymentCoordinatormessagesin"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.messages.in (0 => 202432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.messages.in                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.messages.in        2016-06-24 18:31:05 UTC (rev 202432)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+# Copyright (C) 2016 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+#/
+
+#if ENABLE(APPLE_PAY)
+
+messages -&gt; WebPaymentCoordinator {
+
+    ValidateMerchant(String validationURLString)
+    DidAuthorizePayment(WebCore::Payment payment)
+    DidSelectShippingMethod(WebCore::PaymentRequest::ShippingMethod shippingMethod)
+    DidSelectShippingContact(WebCore::PaymentContact shippingContact)
+    DidSelectPaymentMethod(WebCore::PaymentMethod paymentMethod)
+    DidCancelPayment()
+    CanMakePaymentsWithActiveCardReply(uint64_t requestID, bool canMakePayments)
+}
+
+#endif
</ins></span></pre>
</div>
</div>

</body>
</html>