OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_COORDINATOR_H_ |
| 6 #define IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_COORDINATOR_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 #import "ios/chrome/browser/chrome_coordinator.h" |
| 11 #import "ios/chrome/browser/payments/payment_items_display_coordinator.h" |
| 12 #import "ios/chrome/browser/payments/payment_method_selection_coordinator.h" |
| 13 #import "ios/chrome/browser/payments/payment_request_view_controller.h" |
| 14 #import "ios/chrome/browser/payments/shipping_address_selection_coordinator.h" |
| 15 #include "ios/web/public/payments/payment_request.h" |
| 16 |
| 17 namespace autofill { |
| 18 class AutofillProfile; |
| 19 class CreditCard; |
| 20 class PersonalDataManager; |
| 21 } |
| 22 |
| 23 @protocol PaymentRequestCoordinatorDelegate<NSObject> |
| 24 - (void)paymentRequestCoordinatorDidCancel; |
| 25 - (void)paymentRequestCoordinatorDidConfirm: |
| 26 (web::PaymentResponse)paymentResponse; |
| 27 |
| 28 @end |
| 29 |
| 30 // Coordinator responsible for creating and presenting the PaymentRequest view |
| 31 // controller. The PR view controller will be presented by the view controller |
| 32 // provided in the initializer. |
| 33 @interface PaymentRequestCoordinator |
| 34 : ChromeCoordinator<PaymentRequestViewControllerDelegate, |
| 35 PaymentItemsDisplayCoordinatorDelegate, |
| 36 PaymentMethodSelectionCoordinatorDelegate, |
| 37 ShippingAddressSelectionCoordinatorDelegate> |
| 38 |
| 39 // Creates a Payment Request coordinator that will present UI on |
| 40 // |viewController| using data available from |personalDataManager|. |
| 41 - (instancetype)initWithBaseViewController:(UIViewController*)viewController |
| 42 personalDataManager: |
| 43 (autofill::PersonalDataManager*)personalDataManager |
| 44 NS_DESIGNATED_INITIALIZER; |
| 45 |
| 46 - (instancetype)initWithBaseViewController:(UIViewController*)viewController |
| 47 NS_UNAVAILABLE; |
| 48 |
| 49 // The PaymentRequest object as provided by the page invoking the Payment |
| 50 // Request API. Should be set before calling |start|. |
| 51 @property(nonatomic, assign) web::PaymentRequest paymentRequest; |
| 52 |
| 53 // The favicon of the page invoking the PaymentRequest API. Should be set before |
| 54 // calling |start|. |
| 55 @property(nonatomic, retain) UIImage* pageFavicon; |
| 56 |
| 57 // The title of the page invoking the Payment Request API. Should be set before |
| 58 // calling |start|. |
| 59 @property(nonatomic, copy) NSString* pageTitle; |
| 60 |
| 61 // The host of the page invoking the Payment Request API. Should be set before |
| 62 // calling |start|. |
| 63 @property(nonatomic, copy) NSString* pageHost; |
| 64 |
| 65 // The currently selected shipping address, if any. |
| 66 @property(nonatomic, readonly) |
| 67 autofill::AutofillProfile* selectedShippingAddress; |
| 68 |
| 69 // The payment method selected by the user, if any. |
| 70 @property(nonatomic, readonly) autofill::CreditCard* selectedPaymentMethod; |
| 71 |
| 72 // The delegate to be notified when the user confirms or cancels the request. |
| 73 @property(nonatomic, weak) id<PaymentRequestCoordinatorDelegate> delegate; |
| 74 |
| 75 @end |
| 76 |
| 77 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_COORDINATOR_H_ |
OLD | NEW |