Changeset 246235 in webkit


Ignore:
Timestamp:
Jun 8, 2019 4:45:28 PM (5 years ago)
Author:
aestes@apple.com
Message:

[Apple Pay] If we have a bound interface identifier, set it on new PKPaymentRequests
https://bugs.webkit.org/show_bug.cgi?id=198690
<rdar://problem/48041803>

Reviewed by Tim Horton.

Source/WebCore/PAL:

  • pal/spi/cocoa/PassKitSPI.h: Included PKPaymentRequest_WebKit.h to declare some

WebKit-specific PKPaymentRequest SPIs for internal SDKs, and re-declared these SPIs - now
including the boundInterfaceIdentifier property - for public SDKs.

Source/WebKit:

  • NetworkProcess/cocoa/NetworkSessionCocoa.h:
  • NetworkProcess/cocoa/NetworkSessionCocoa.mm:

(WebKit::NetworkSessionCocoa::boundInterfaceIdentifier const): Implemented a public getter
for m_boundInterfaceIdentifier.

  • NetworkProcess/NetworkConnectionToWebProcess.h:
  • NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm:

(WebKit::NetworkConnectionToWebProcess::paymentCoordinatorBoundInterfaceIdentifier):
Implemented an override for paymentCoordinatorBoundInterfaceIdentifier.

  • Shared/ApplePay/WebPaymentCoordinatorProxy.h: Declared

paymentCoordinatorBoundInterfaceIdentifier for clients to override.

  • Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:

(WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): If the client has a non-empty
bound interface identifier, set it on the new PKPaymentRequest.

  • UIProcess/WebPageProxy.h:
  • UIProcess/Cocoa/WebPageProxyCocoa.mm:

(WebKit::WebPageProxy::paymentCoordinatorBoundInterfaceIdentifier): Implemented an override
for paymentCoordinatorBoundInterfaceIdentifier.

Source/WTF:

  • wtf/FeatureDefines.h: Defined HAVE_PASSKIT_BOUND_INTERFACE_IDENTIFIER, and cleaned up some

other PassKit HAVEs.

Location:
trunk/Source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r246146 r246235  
     12019-06-08  Andy Estes  <aestes@apple.com>
     2
     3        [Apple Pay] If we have a bound interface identifier, set it on new PKPaymentRequests
     4        https://bugs.webkit.org/show_bug.cgi?id=198690
     5        <rdar://problem/48041803>
     6
     7        Reviewed by Tim Horton.
     8
     9        * wtf/FeatureDefines.h: Defined HAVE_PASSKIT_BOUND_INTERFACE_IDENTIFIER, and cleaned up some
     10        other PassKit HAVEs.
     11
    1122019-06-06  Caio Lima  <ticaiolima@gmail.com>
    213
  • trunk/Source/WTF/wtf/FeatureDefines.h

    r245898 r246235  
    206206#endif
    207207
     208#if !defined(HAVE_PASSKIT_BOUND_INTERFACE_IDENTIFIER)
     209#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000
     210#define HAVE_PASSKIT_BOUND_INTERFACE_IDENTIFIER 1
     211#endif
     212#endif
     213
    208214#endif /* PLATFORM(IOS_FAMILY) */
    209215
     
    287293
    288294#if !defined(HAVE_PASSKIT_GRANULAR_ERRORS)
    289 #define HAVE_PASSKIT_GRANULAR_ERRORS __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
     295#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
     296#define HAVE_PASSKIT_GRANULAR_ERRORS 1
     297#endif
    290298#endif
    291299
    292300#if !defined(HAVE_PASSKIT_API_TYPE)
    293 #define HAVE_PASSKIT_API_TYPE __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300 && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101304
     301#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300 && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101304
     302#define HAVE_PASSKIT_API_TYPE 1
     303#endif
     304#endif
     305
     306#if !defined(HAVE_PASSKIT_BOUND_INTERFACE_IDENTIFIER)
     307#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
     308#define HAVE_PASSKIT_BOUND_INTERFACE_IDENTIFIER 1
     309#endif
    294310#endif
    295311
  • trunk/Source/WebCore/PAL/ChangeLog

    r246126 r246235  
     12019-06-08  Andy Estes  <aestes@apple.com>
     2
     3        [Apple Pay] If we have a bound interface identifier, set it on new PKPaymentRequests
     4        https://bugs.webkit.org/show_bug.cgi?id=198690
     5        <rdar://problem/48041803>
     6
     7        Reviewed by Tim Horton.
     8
     9        * pal/spi/cocoa/PassKitSPI.h: Included PKPaymentRequest_WebKit.h to declare some
     10        WebKit-specific PKPaymentRequest SPIs for internal SDKs, and re-declared these SPIs - now
     11        including the boundInterfaceIdentifier property - for public SDKs.
     12
    1132019-06-05  Alex Christensen  <achristensen@webkit.org>
    214
  • trunk/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h

    r243412 r246235  
    4343#import <PassKit/PKPaymentAuthorizationViewController_Private.h>
    4444#import <PassKit/PKPaymentRequest_Private.h>
     45#import <PassKitCore/PKPaymentRequest_WebKit.h>
    4546
    4647#if PLATFORM(IOS_FAMILY)
     
    297298@end
    298299
     300@interface PKPaymentRequest ()
     301@property (nonatomic, strong) NSArray *thumbnailURLs;
     302@property (nonatomic, retain) NSURL *originatingURL;
     303@property (nonatomic, assign) BOOL expectsMerchantSession;
     304@property (nonatomic, strong) NSString *sourceApplicationBundleIdentifier;
     305@property (nonatomic, strong) NSString *sourceApplicationSecondaryIdentifier;
     306@property (nonatomic, strong) NSString *CTDataConnectionServiceType;
     307@end
     308
    299309#if HAVE(PASSKIT_API_TYPE)
    300310@interface PKPaymentRequest ()
    301311@property (nonatomic, assign) PKPaymentRequestAPIType APIType;
     312@end
     313#endif
     314
     315#if HAVE(PASSKIT_BOUND_INTERFACE_IDENTIFIER)
     316@interface PKPaymentRequest ()
     317@property (nonatomic, copy) NSString *boundInterfaceIdentifier;
    302318@end
    303319#endif
     
    371387@end
    372388
    373 @interface PKPaymentRequest ()
    374 @property (nonatomic, strong) NSString *sourceApplicationBundleIdentifier;
    375 @property (nonatomic, strong) NSString *sourceApplicationSecondaryIdentifier;
    376 @property (nonatomic, strong) NSString *CTDataConnectionServiceType;
    377 @end
    378 
    379389typedef void(^PKCanMakePaymentsCompletion)(BOOL isValid, NSError *);
    380390
  • trunk/Source/WebKit/ChangeLog

    r246230 r246235  
     12019-06-08  Andy Estes  <aestes@apple.com>
     2
     3        [Apple Pay] If we have a bound interface identifier, set it on new PKPaymentRequests
     4        https://bugs.webkit.org/show_bug.cgi?id=198690
     5        <rdar://problem/48041803>
     6
     7        Reviewed by Tim Horton.
     8
     9        * NetworkProcess/cocoa/NetworkSessionCocoa.h:
     10        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
     11        (WebKit::NetworkSessionCocoa::boundInterfaceIdentifier const): Implemented a public getter
     12        for m_boundInterfaceIdentifier.
     13
     14        * NetworkProcess/NetworkConnectionToWebProcess.h:
     15        * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm:
     16        (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorBoundInterfaceIdentifier):
     17        Implemented an override for paymentCoordinatorBoundInterfaceIdentifier.
     18
     19        * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Declared
     20        paymentCoordinatorBoundInterfaceIdentifier for clients to override.
     21
     22        * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
     23        (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): If the client has a non-empty
     24        bound interface identifier, set it on the new PKPaymentRequest.
     25
     26        * UIProcess/WebPageProxy.h:
     27        * UIProcess/Cocoa/WebPageProxyCocoa.mm:
     28        (WebKit::WebPageProxy::paymentCoordinatorBoundInterfaceIdentifier): Implemented an override
     29        for paymentCoordinatorBoundInterfaceIdentifier.
     30
    1312019-06-07  Antti Koivisto  <antti@apple.com>
    232
  • trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h

    r245796 r246235  
    272272    IPC::Connection* paymentCoordinatorConnection(const WebPaymentCoordinatorProxy&) final;
    273273    UIViewController *paymentCoordinatorPresentingViewController(const WebPaymentCoordinatorProxy&) final;
     274    const String& paymentCoordinatorBoundInterfaceIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) final;
    274275    const String& paymentCoordinatorCTDataConnectionServiceType(const WebPaymentCoordinatorProxy&, PAL::SessionID) final;
    275276    const String& paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) final;
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h

    r245979 r246235  
    5151    void initializeEphemeralStatelessCookielessSession();
    5252
     53    const String& boundInterfaceIdentifier() const;
    5354    const String& sourceApplicationBundleIdentifier() const;
    5455    const String& sourceApplicationSecondaryIdentifier() const;
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm

    r245979 r246235  
    829829}
    830830
     831const String& NetworkSessionCocoa::boundInterfaceIdentifier() const
     832{
     833    return m_boundInterfaceIdentifier;
     834}
     835
    831836const String& NetworkSessionCocoa::sourceApplicationBundleIdentifier() const
    832837{
  • trunk/Source/WebKit/NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm

    r242748 r246235  
    5353}
    5454
     55const String& NetworkConnectionToWebProcess::paymentCoordinatorBoundInterfaceIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID sessionID)
     56{
     57    if (auto session = static_cast<NetworkSessionCocoa*>(m_networkProcess->networkSession(sessionID)))
     58        return session->boundInterfaceIdentifier();
     59    return emptyString();
     60}
     61
    5562const String& NetworkConnectionToWebProcess::paymentCoordinatorCTDataConnectionServiceType(const WebPaymentCoordinatorProxy&, PAL::SessionID sessionID)
    5663{
  • trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h

    r245796 r246235  
    7878
    7979        virtual IPC::Connection* paymentCoordinatorConnection(const WebPaymentCoordinatorProxy&) = 0;
     80        virtual const String& paymentCoordinatorBoundInterfaceIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) = 0;
    8081        virtual const String& paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) = 0;
    8182        virtual const String& paymentCoordinatorSourceApplicationSecondaryIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) = 0;
  • trunk/Source/WebKit/Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm

    r243443 r246235  
    3838#import <wtf/URL.h>
    3939
    40 // FIXME: Once rdar://problem/24420024 has been fixed, import PKPaymentRequest_Private.h instead.
     40// FIXME: We don't support any platforms without -setThumbnailURLs:, so this can be removed.
    4141@interface PKPaymentRequest ()
    42 @property (nonatomic, retain) NSURL *originatingURL;
     42@property (nonatomic, strong) NSURL *thumbnailURL;
    4343@end
    4444
    45 @interface PKPaymentRequest ()
    46 // FIXME: Remove this once it's in an SDK.
    47 @property (nonatomic, strong) NSArray *thumbnailURLs;
    48 @property (nonatomic, strong) NSURL *thumbnailURL;
    49 
    50 @property (nonatomic, assign) BOOL expectsMerchantSession;
     45#if HAVE(PASSKIT_BOUND_INTERFACE_IDENTIFIER)
     46// FIXME: Remove once rdar://problem/48041516 is widely available in SDKs.
     47@interface PKPaymentRequest (Staging)
     48@property (nonatomic, copy) NSString *boundInterfaceIdentifier;
    5149@end
     50#endif
    5251
    5352namespace WebKit {
     
    250249    [result setOriginatingURL:originatingURL];
    251250
     251    // FIXME: We don't support any platforms without -setThumbnailURLs:, so this can be simplified.
    252252    if ([result respondsToSelector:@selector(setThumbnailURLs:)]) {
    253253        auto thumbnailURLs = adoptNS([[NSMutableArray alloc] init]);
     
    307307#endif
    308308
     309#if HAVE(PASSKIT_BOUND_INTERFACE_IDENTIFIER)
     310    // FIXME: Remove -respondsToSelector: check once rdar://problem/48041516 is widely available in SDKs.
     311    auto& boundInterfaceIdentifier = m_client.paymentCoordinatorBoundInterfaceIdentifier(*this, sessionID);
     312    if (!boundInterfaceIdentifier.isEmpty() && [result respondsToSelector:@selector(setBoundInterfaceIdentifier:)])
     313        [result setBoundInterfaceIdentifier:boundInterfaceIdentifier];
     314#endif
     315
    309316    // FIXME: Instead of using respondsToSelector, this should use a proper #if version check.
    310317    auto& bundleIdentifier = m_client.paymentCoordinatorSourceApplicationBundleIdentifier(*this, sessionID);
  • trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm

    r246201 r246235  
    226226}
    227227
     228const String& WebPageProxy::paymentCoordinatorBoundInterfaceIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID sessionID)
     229{
     230    ASSERT_UNUSED(sessionID, sessionID == websiteDataStore().sessionID());
     231    return websiteDataStore().boundInterfaceIdentifier();
     232}
     233
    228234const String& WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID sessionID)
    229235{
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r246213 r246235  
    20662066#if ENABLE(APPLE_PAY)
    20672067    IPC::Connection* paymentCoordinatorConnection(const WebPaymentCoordinatorProxy&) final;
     2068    const String& paymentCoordinatorBoundInterfaceIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) final;
    20682069    const String& paymentCoordinatorSourceApplicationBundleIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) final;
    20692070    const String& paymentCoordinatorSourceApplicationSecondaryIdentifier(const WebPaymentCoordinatorProxy&, PAL::SessionID) final;
Note: See TracChangeset for help on using the changeset viewer.