| 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_UI_PAYMENTS_PAYMENT_REQUEST_VIEW_CONTROLLER_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_PAYMENTS_PAYMENT_REQUEST_VIEW_CONTROLLER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_PAYMENTS_PAYMENT_REQUEST_VIEW_CONTROLLER_H_ | 6 #define IOS_CHROME_BROWSER_UI_PAYMENTS_PAYMENT_REQUEST_VIEW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 #include "ios/chrome/browser/payments/payment_request.h" | 10 #include "ios/chrome/browser/payments/payment_request.h" |
| 11 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item
.h" | 11 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item
.h" |
| 12 #import "ios/chrome/browser/ui/collection_view/collection_view_controller.h" | 12 #import "ios/chrome/browser/ui/collection_view/collection_view_controller.h" |
| 13 | 13 |
| 14 extern NSString* const kPaymentRequestCollectionViewID; | 14 extern NSString* const kPaymentRequestCollectionViewID; |
| 15 | 15 |
| 16 class PaymentRequest; | 16 class PaymentRequest; |
| 17 | 17 |
| 18 @class PaymentRequestViewController; | 18 @class PaymentRequestViewController; |
| 19 | 19 |
| 20 // Data source protocol for PaymentRequestViewController. |
| 21 @protocol PaymentRequestViewControllerDataSource<NSObject> |
| 22 |
| 23 // Returns the authenticated account name, if a user is authenticated. |
| 24 // Otherwise, returns nil. |
| 25 - (NSString*)authenticatedAccountName; |
| 26 |
| 27 @end |
| 28 |
| 20 // Delegate protocol for PaymentRequestViewController. | 29 // Delegate protocol for PaymentRequestViewController. |
| 21 @protocol PaymentRequestViewControllerDelegate<NSObject> | 30 @protocol PaymentRequestViewControllerDelegate<NSObject> |
| 22 | 31 |
| 23 // Notifies the delegate that the user has canceled the payment request. | 32 // Notifies the delegate that the user has canceled the payment request. |
| 24 - (void)paymentRequestViewControllerDidCancel: | 33 - (void)paymentRequestViewControllerDidCancel: |
| 25 (PaymentRequestViewController*)controller; | 34 (PaymentRequestViewController*)controller; |
| 26 | 35 |
| 27 // Notifies the delegate that the user has confirmed the payment request. | 36 // Notifies the delegate that the user has confirmed the payment request. |
| 28 - (void)paymentRequestViewControllerDidConfirm: | 37 - (void)paymentRequestViewControllerDidConfirm: |
| 29 (PaymentRequestViewController*)controller; | 38 (PaymentRequestViewController*)controller; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 @property(nonatomic, copy) NSString* pageHost; | 75 @property(nonatomic, copy) NSString* pageHost; |
| 67 | 76 |
| 68 // Whether or not the view is in a pending state. | 77 // Whether or not the view is in a pending state. |
| 69 @property(nonatomic, assign, getter=isPending) BOOL pending; | 78 @property(nonatomic, assign, getter=isPending) BOOL pending; |
| 70 | 79 |
| 71 // The delegate to be notified when the user confirms or cancels the request. | 80 // The delegate to be notified when the user confirms or cancels the request. |
| 72 @property(nonatomic, weak) id<PaymentRequestViewControllerDelegate> delegate; | 81 @property(nonatomic, weak) id<PaymentRequestViewControllerDelegate> delegate; |
| 73 | 82 |
| 74 // Whether the data source should be shown (usually until the first payment | 83 // Whether the data source should be shown (usually until the first payment |
| 75 // has been completed) or not. | 84 // has been completed) or not. |
| 76 @property(nonatomic, assign) BOOL showDataSource; | 85 @property(nonatomic, assign) BOOL showPaymentDataSource; |
| 77 | 86 |
| 78 // If the user is signed in, the name of the authenticated account. | 87 @property(nonatomic, weak) id<PaymentRequestViewControllerDataSource> |
| 79 @property(nonatomic, copy) NSString* authenticatedAccountName; | 88 dataSource; |
| 80 | 89 |
| 81 // Updates the payment summary section UI. If |totalValueChanged| is YES, | 90 // Updates the payment summary section UI. If |totalValueChanged| is YES, |
| 82 // adds a label to the total amount item indicating that the total amount was | 91 // adds a label to the total amount item indicating that the total amount was |
| 83 // updated. | 92 // updated. |
| 84 - (void)updatePaymentSummaryWithTotalValueChanged:(BOOL)totalValueChanged; | 93 - (void)updatePaymentSummaryWithTotalValueChanged:(BOOL)totalValueChanged; |
| 85 | 94 |
| 86 // Updates the selected shipping address. | 95 // Updates the selected shipping address. |
| 87 - (void)updateSelectedShippingAddressUI; | 96 - (void)updateSelectedShippingAddressUI; |
| 88 | 97 |
| 89 // Updates the selected shipping option. | 98 // Updates the selected shipping option. |
| 90 - (void)updateSelectedShippingOptionUI; | 99 - (void)updateSelectedShippingOptionUI; |
| 91 | 100 |
| 92 // Updates the selected payment method. | 101 // Updates the selected payment method. |
| 93 - (void)updateSelectedPaymentMethodUI; | 102 - (void)updateSelectedPaymentMethodUI; |
| 94 | 103 |
| 95 // Initializes this object with an instance of PaymentRequest which has a copy | 104 // Initializes this object with an instance of PaymentRequest which has a copy |
| 96 // of web::PaymentRequest as provided by the page invoking the Payment Request | 105 // of web::PaymentRequest as provided by the page invoking the Payment Request |
| 97 // API. This object will not take ownership of |paymentRequest|. | 106 // API. This object will not take ownership of |paymentRequest|. |
| 98 - (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest | 107 - (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest |
| 99 NS_DESIGNATED_INITIALIZER; | 108 NS_DESIGNATED_INITIALIZER; |
| 100 | 109 |
| 101 - (instancetype)init NS_UNAVAILABLE; | 110 - (instancetype)init NS_UNAVAILABLE; |
| 102 | 111 |
| 103 - (instancetype)initWithStyle:(CollectionViewControllerStyle)style | 112 - (instancetype)initWithStyle:(CollectionViewControllerStyle)style |
| 104 NS_UNAVAILABLE; | 113 NS_UNAVAILABLE; |
| 105 | 114 |
| 106 @end | 115 @end |
| 107 | 116 |
| 108 #endif // IOS_CHROME_BROWSER_UI_PAYMENTS_PAYMENT_REQUEST_VIEW_CONTROLLER_H_ | 117 #endif // IOS_CHROME_BROWSER_UI_PAYMENTS_PAYMENT_REQUEST_VIEW_CONTROLLER_H_ |
| OLD | NEW |