Diff
Modified: trunk/Source/WebCore/ChangeLog (222914 => 222915)
--- trunk/Source/WebCore/ChangeLog 2017-10-05 17:18:15 UTC (rev 222914)
+++ trunk/Source/WebCore/ChangeLog 2017-10-05 17:31:58 UTC (rev 222915)
@@ -1,3 +1,24 @@
+2017-10-05 Andy Estes <[email protected]>
+
+ [Payment Request] Factor out ApplePaySession's interface to PaymentCoordinator into a base class
+ https://bugs.webkit.org/show_bug.cgi?id=177904
+
+ Reviewed by Daniel Bates.
+
+ In a follow-on patch, something other than ApplePaySession will need to be the
+ PaymentCoordinator's active session during PaymentRequest sessions.
+
+ To support this, this patch factors out the ApplePaySession functions called by
+ PaymentCoordinator into a new base class called PaymentSession.
+
+ * Modules/applepay/ApplePaySession.h:
+ * Modules/applepay/PaymentCoordinator.cpp:
+ (WebCore::PaymentCoordinator::beginPaymentSession):
+ * Modules/applepay/PaymentCoordinator.h:
+ * Modules/applepay/PaymentSession.h: Added.
+ (WebCore::PaymentSession::~PaymentSession):
+ * WebCore.xcodeproj/project.pbxproj:
+
2017-10-05 Zalan Bujtas <[email protected]>
Move multicolumn flow clear to RenderTreeUpdater
Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySession.h (222914 => 222915)
--- trunk/Source/WebCore/Modules/applepay/ApplePaySession.h 2017-10-05 17:18:15 UTC (rev 222914)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySession.h 2017-10-05 17:31:58 UTC (rev 222915)
@@ -31,6 +31,7 @@
#include "ApplePayPaymentRequest.h"
#include "EventTarget.h"
#include "ExceptionOr.h"
+#include "PaymentSession.h"
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
@@ -57,7 +58,7 @@
struct ApplePayShippingContactUpdate;
struct ApplePayShippingMethodUpdate;
-class ApplePaySession final : public RefCounted<ApplePaySession>, public ActiveDOMObject, public EventTargetWithInlineData {
+class ApplePaySession final : public PaymentSession, public ActiveDOMObject, public EventTargetWithInlineData {
public:
static ExceptionOr<Ref<ApplePaySession>> create(Document&, unsigned version, ApplePayPaymentRequest&&);
virtual ~ApplePaySession();
@@ -92,16 +93,9 @@
const ApplePaySessionPaymentRequest& paymentRequest() const { return m_paymentRequest; }
- void validateMerchant(const URL&);
- void didAuthorizePayment(const Payment&);
- void didSelectShippingMethod(const ApplePaySessionPaymentRequest::ShippingMethod&);
- void didSelectShippingContact(const PaymentContact&);
- void didSelectPaymentMethod(const PaymentMethod&);
- void didCancelPaymentSession();
+ using PaymentSession::ref;
+ using PaymentSession::deref;
- using RefCounted<ApplePaySession>::ref;
- using RefCounted<ApplePaySession>::deref;
-
private:
ApplePaySession(Document&, ApplePaySessionPaymentRequest&&);
@@ -116,6 +110,14 @@
void refEventTarget() override { ref(); }
void derefEventTarget() override { deref(); }
+ // PaymentSession
+ void validateMerchant(const URL&) override;
+ void didAuthorizePayment(const Payment&) override;
+ void didSelectShippingMethod(const ApplePaySessionPaymentRequest::ShippingMethod&) override;
+ void didSelectShippingContact(const PaymentContact&) override;
+ void didSelectPaymentMethod(const PaymentMethod&) override;
+ void didCancelPaymentSession() override;
+
PaymentCoordinator& paymentCoordinator() const;
bool canBegin() const;
Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp (222914 => 222915)
--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp 2017-10-05 17:18:15 UTC (rev 222914)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp 2017-10-05 17:31:58 UTC (rev 222915)
@@ -28,9 +28,9 @@
#if ENABLE(APPLE_PAY)
-#include "ApplePaySession.h"
#include "PaymentAuthorizationStatus.h"
#include "PaymentCoordinatorClient.h"
+#include "PaymentSession.h"
#include "URL.h"
namespace WebCore {
@@ -65,7 +65,7 @@
m_client.openPaymentSetup(merchantIdentifier, domainName, WTFMove(completionHandler));
}
-bool PaymentCoordinator::beginPaymentSession(ApplePaySession& paymentSession, const URL& originatingURL, const Vector<URL>& linkIconURLs, const ApplePaySessionPaymentRequest& paymentRequest)
+bool PaymentCoordinator::beginPaymentSession(PaymentSession& paymentSession, const URL& originatingURL, const Vector<URL>& linkIconURLs, const ApplePaySessionPaymentRequest& paymentRequest)
{
ASSERT(!m_activeSession);
Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h (222914 => 222915)
--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h 2017-10-05 17:18:15 UTC (rev 222914)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h 2017-10-05 17:31:58 UTC (rev 222915)
@@ -32,12 +32,12 @@
namespace WebCore {
-class ApplePaySession;
class Payment;
class PaymentCoordinatorClient;
class PaymentContact;
class PaymentMerchantSession;
class PaymentMethod;
+class PaymentSession;
class URL;
enum class PaymentAuthorizationStatus;
struct PaymentAuthorizationResult;
@@ -57,7 +57,7 @@
bool hasActiveSession() const { return m_activeSession; }
- bool beginPaymentSession(ApplePaySession&, const URL& originatingURL, const Vector<URL>& linkIconURLs, const ApplePaySessionPaymentRequest&);
+ bool beginPaymentSession(PaymentSession&, const URL& originatingURL, const Vector<URL>& linkIconURLs, const ApplePaySessionPaymentRequest&);
void completeMerchantValidation(const PaymentMerchantSession&);
void completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&&);
void completeShippingContactSelection(std::optional<ShippingContactUpdate>&&);
@@ -76,7 +76,7 @@
private:
PaymentCoordinatorClient& m_client;
- RefPtr<ApplePaySession> m_activeSession;
+ RefPtr<PaymentSession> m_activeSession;
};
}
Added: trunk/Source/WebCore/Modules/applepay/PaymentSession.h (0 => 222915)
--- trunk/Source/WebCore/Modules/applepay/PaymentSession.h (rev 0)
+++ trunk/Source/WebCore/Modules/applepay/PaymentSession.h 2017-10-05 17:31:58 UTC (rev 222915)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2017 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 "ApplePaySessionPaymentRequest.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class Payment;
+class PaymentContact;
+class PaymentMethod;
+class URL;
+
+class PaymentSession : public RefCounted<PaymentSession> {
+public:
+ virtual ~PaymentSession() { }
+
+ virtual void validateMerchant(const URL&) = 0;
+ virtual void didAuthorizePayment(const Payment&) = 0;
+ virtual void didSelectShippingMethod(const ApplePaySessionPaymentRequest::ShippingMethod&) = 0;
+ virtual void didSelectShippingContact(const PaymentContact&) = 0;
+ virtual void didSelectPaymentMethod(const PaymentMethod&) = 0;
+ virtual void didCancelPaymentSession() = 0;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(APPLE_PAY)
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (222914 => 222915)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-10-05 17:18:15 UTC (rev 222914)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-10-05 17:31:58 UTC (rev 222915)
@@ -4410,6 +4410,7 @@
A14832CC187F67C400DA63A6 /* WebCoreThreadRun.h in Headers */ = {isa = PBXBuildFile; fileRef = A148329E187F508700DA63A6 /* WebCoreThreadRun.h */; settings = {ATTRIBUTES = (Private, ); }; };
A14832CE187F683400DA63A6 /* WebCoreThreadSystemInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A14832A0187F508700DA63A6 /* WebCoreThreadSystemInterface.cpp */; };
A14832CF187F684700DA63A6 /* WebCoreThreadSystemInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = A14832A1187F508700DA63A6 /* WebCoreThreadSystemInterface.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A1491DA31F859D870095F5D4 /* PaymentSession.h in Headers */ = {isa = PBXBuildFile; fileRef = A1491DA21F859D870095F5D4 /* PaymentSession.h */; };
A149786E1ABAF33800CEF7E4 /* ContentFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A149786C1ABAF33800CEF7E4 /* ContentFilter.cpp */; };
A149786F1ABAF33800CEF7E4 /* ContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A149786D1ABAF33800CEF7E4 /* ContentFilter.h */; };
A14978711ABAF3A500CEF7E4 /* PlatformContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A14978701ABAF3A500CEF7E4 /* PlatformContentFilter.h */; };
@@ -12854,6 +12855,7 @@
A14832A9187F508700DA63A6 /* WKView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKView.h; sourceTree = "<group>"; };
A14832AA187F508700DA63A6 /* WKView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKView.mm; sourceTree = "<group>"; };
A14832AB187F508700DA63A6 /* WKViewPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKViewPrivate.h; sourceTree = "<group>"; };
+ A1491DA21F859D870095F5D4 /* PaymentSession.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaymentSession.h; sourceTree = "<group>"; };
A149786C1ABAF33800CEF7E4 /* ContentFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentFilter.cpp; sourceTree = "<group>"; };
A149786D1ABAF33800CEF7E4 /* ContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentFilter.h; sourceTree = "<group>"; };
A14978701ABAF3A500CEF7E4 /* PlatformContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformContentFilter.h; sourceTree = "<group>"; };
@@ -17227,6 +17229,7 @@
1A8A64391D19FC5300D0E00F /* PaymentMethod.h */,
1A8A64651D19FDFF00D0E00F /* PaymentRequestValidator.cpp */,
1A8A64661D19FDFF00D0E00F /* PaymentRequestValidator.h */,
+ A1491DA21F859D870095F5D4 /* PaymentSession.h */,
);
path = applepay;
sourceTree = "<group>";
@@ -29479,6 +29482,7 @@
A1F6004D1F475A5E0077E83F /* PaymentRequestUpdateEventInit.h in Headers */,
1A8A64681D19FDFF00D0E00F /* PaymentRequestValidator.h in Headers */,
A1F76B3D1F44CF240014C318 /* PaymentResponse.h in Headers */,
+ A1491DA31F859D870095F5D4 /* PaymentSession.h in Headers */,
A1F76B551F44D2C70014C318 /* PaymentShippingOption.h in Headers */,
A1F76B491F44D07A0014C318 /* PaymentShippingType.h in Headers */,
B27535650B053814002CE64F /* PDFDocumentImage.h in Headers */,