| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_VIEW_CONTROLLER_H_ | 5 #ifndef IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_VIEW_CONTROLLER_H_ |
| 6 #define IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_VIEW_CONTROLLER_H_ | 6 #define IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_VIEW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 #import "ios/chrome/browser/ui/collection_view/collection_view_controller.h" | 10 #import "ios/chrome/browser/ui/collection_view/collection_view_controller.h" |
| 11 #include "ios/web/public/payments/payment_request.h" | 11 #include "ios/web/public/payments/payment_request.h" |
| 12 | 12 |
| 13 namespace autofill { | 13 namespace autofill { |
| 14 class AutofillProfile; | 14 class AutofillProfile; |
| 15 class CreditCard; | 15 class CreditCard; |
| 16 } | 16 } |
| 17 | 17 |
| 18 @protocol PaymentRequestViewControllerDelegate<NSObject> | 18 @protocol PaymentRequestViewControllerDelegate<NSObject> |
| 19 - (void)paymentRequestViewControllerDidCancel; | 19 - (void)paymentRequestViewControllerDidCancel; |
| 20 - (void)paymentRequestViewControllerDidConfirm; | 20 - (void)paymentRequestViewControllerDidConfirm; |
| 21 - (void)paymentRequestViewControllerDisplayPaymentItems; | 21 - (void)paymentRequestViewControllerDisplayPaymentItems; |
| 22 - (void)paymentRequestViewControllerSelectShippingAddress; | 22 - (void)paymentRequestViewControllerSelectShippingAddress; |
| 23 - (void)paymentRequestViewControllerSelectShippingOption; |
| 23 - (void)paymentRequestViewControllerSelectPaymentMethod; | 24 - (void)paymentRequestViewControllerSelectPaymentMethod; |
| 24 | 25 |
| 25 @end | 26 @end |
| 26 | 27 |
| 27 // View controller responsible for presenting the details of a PaymentRequest to | 28 // View controller responsible for presenting the details of a PaymentRequest to |
| 28 // the user and communicating their choices to the supplied delegate. | 29 // the user and communicating their choices to the supplied delegate. |
| 29 @interface PaymentRequestViewController : CollectionViewController | 30 @interface PaymentRequestViewController : CollectionViewController |
| 30 | 31 |
| 31 // The PaymentRequest object as provided by the page invoking the Payment | 32 // The PaymentRequest object as provided by the page invoking the Payment |
| 32 // Request API. | 33 // Request API. |
| 33 @property(nonatomic, assign) web::PaymentRequest paymentRequest; | 34 @property(nonatomic, assign) web::PaymentRequest paymentRequest; |
| 34 | 35 |
| 35 // The favicon of the page invoking the Payment Request API. | 36 // The favicon of the page invoking the Payment Request API. |
| 36 @property(nonatomic, retain) UIImage* pageFavicon; | 37 @property(nonatomic, retain) UIImage* pageFavicon; |
| 37 | 38 |
| 38 // The title of the page invoking the Payment Request API. | 39 // The title of the page invoking the Payment Request API. |
| 39 @property(nonatomic, copy) NSString* pageTitle; | 40 @property(nonatomic, copy) NSString* pageTitle; |
| 40 | 41 |
| 41 // The host of the page invoking the Payment Request API. | 42 // The host of the page invoking the Payment Request API. |
| 42 @property(nonatomic, copy) NSString* pageHost; | 43 @property(nonatomic, copy) NSString* pageHost; |
| 43 | 44 |
| 44 // The currently selected and displayed shipping address, if any. | 45 // The currently selected and displayed shipping address, if any. |
| 45 @property(nonatomic, assign) autofill::AutofillProfile* selectedShippingAddress; | 46 @property(nonatomic, assign) autofill::AutofillProfile* selectedShippingAddress; |
| 46 | 47 |
| 48 // The currently selected and displayed shipping option, if any. |
| 49 @property(nonatomic, assign) web::PaymentShippingOption* selectedShippingOption; |
| 50 |
| 47 // The currently selected and displayed payment method, if any. | 51 // The currently selected and displayed payment method, if any. |
| 48 @property(nonatomic, assign) autofill::CreditCard* selectedPaymentMethod; | 52 @property(nonatomic, assign) autofill::CreditCard* selectedPaymentMethod; |
| 49 | 53 |
| 50 // The delegate to be notified when the user confirms or cancels the request. | 54 // The delegate to be notified when the user confirms or cancels the request. |
| 51 @property(nonatomic, weak) id<PaymentRequestViewControllerDelegate> delegate; | 55 @property(nonatomic, weak) id<PaymentRequestViewControllerDelegate> delegate; |
| 52 | 56 |
| 53 // Sets the selected shipping address and updates the UI. | 57 // Sets the selected shipping address and updates the UI. |
| 54 - (void)updateSelectedShippingAddress: | 58 - (void)updateSelectedShippingAddress: |
| 55 (autofill::AutofillProfile*)shippingAddress; | 59 (autofill::AutofillProfile*)shippingAddress; |
| 56 | 60 |
| 61 // Sets the selected shipping option and updates the UI. |
| 62 - (void)updateSelectedShippingOption: |
| 63 (web::PaymentShippingOption*)shippingOption; |
| 64 |
| 57 - (instancetype)init NS_DESIGNATED_INITIALIZER; | 65 - (instancetype)init NS_DESIGNATED_INITIALIZER; |
| 58 | 66 |
| 59 - (instancetype)initWithStyle:(CollectionViewControllerStyle)style | 67 - (instancetype)initWithStyle:(CollectionViewControllerStyle)style |
| 60 NS_UNAVAILABLE; | 68 NS_UNAVAILABLE; |
| 61 | 69 |
| 62 @end | 70 @end |
| 63 | 71 |
| 64 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_VIEW_CONTROLLER_H_ | 72 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_VIEW_CONTROLLER_H_ |
| OLD | NEW |