| 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" | |
| 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" | 10 #import "ios/chrome/browser/ui/collection_view/collection_view_controller.h" |
| 11 #import "ios/chrome/browser/ui/payments/payment_request_view_controller_data_sou
rce.h" |
| 13 | 12 |
| 14 extern NSString* const kPaymentRequestCollectionViewID; | 13 extern NSString* const kPaymentRequestCollectionViewID; |
| 15 | 14 |
| 16 class PaymentRequest; | |
| 17 | |
| 18 @class PaymentRequestViewController; | 15 @class PaymentRequestViewController; |
| 19 | 16 |
| 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 | |
| 29 // Delegate protocol for PaymentRequestViewController. | 17 // Delegate protocol for PaymentRequestViewController. |
| 30 @protocol PaymentRequestViewControllerDelegate<NSObject> | 18 @protocol PaymentRequestViewControllerDelegate<NSObject> |
| 31 | 19 |
| 32 // Notifies the delegate that the user has canceled the payment request. | 20 // Notifies the delegate that the user has canceled the payment request. |
| 33 - (void)paymentRequestViewControllerDidCancel: | 21 - (void)paymentRequestViewControllerDidCancel: |
| 34 (PaymentRequestViewController*)controller; | 22 (PaymentRequestViewController*)controller; |
| 35 | 23 |
| 36 // Notifies the delegate that the user has confirmed the payment request. | 24 // Notifies the delegate that the user has confirmed the payment request. |
| 37 - (void)paymentRequestViewControllerDidConfirm: | 25 - (void)paymentRequestViewControllerDidConfirm: |
| 38 (PaymentRequestViewController*)controller; | 26 (PaymentRequestViewController*)controller; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 59 (PaymentRequestViewController*)controller; | 47 (PaymentRequestViewController*)controller; |
| 60 | 48 |
| 61 // Notifies the delegate that the user has selected the payment method item. | 49 // Notifies the delegate that the user has selected the payment method item. |
| 62 - (void)paymentRequestViewControllerDidSelectPaymentMethodItem: | 50 - (void)paymentRequestViewControllerDidSelectPaymentMethodItem: |
| 63 (PaymentRequestViewController*)controller; | 51 (PaymentRequestViewController*)controller; |
| 64 | 52 |
| 65 @end | 53 @end |
| 66 | 54 |
| 67 // View controller responsible for presenting the details of a PaymentRequest to | 55 // View controller responsible for presenting the details of a PaymentRequest to |
| 68 // the user and communicating their choices to the supplied delegate. | 56 // the user and communicating their choices to the supplied delegate. |
| 69 @interface PaymentRequestViewController | 57 @interface PaymentRequestViewController : CollectionViewController |
| 70 : CollectionViewController<CollectionViewFooterLinkDelegate> | |
| 71 | 58 |
| 72 // The favicon of the page invoking the Payment Request API. | 59 // The favicon of the page invoking the Payment Request API. |
| 73 @property(nonatomic, strong) UIImage* pageFavicon; | 60 @property(nonatomic, strong) UIImage* pageFavicon; |
| 74 | 61 |
| 75 // The title of the page invoking the Payment Request API. | 62 // The title of the page invoking the Payment Request API. |
| 76 @property(nonatomic, copy) NSString* pageTitle; | 63 @property(nonatomic, copy) NSString* pageTitle; |
| 77 | 64 |
| 78 // The host of the page invoking the Payment Request API. | 65 // The host of the page invoking the Payment Request API. |
| 79 @property(nonatomic, copy) NSString* pageHost; | 66 @property(nonatomic, copy) NSString* pageHost; |
| 80 | 67 |
| 81 // Whether or not the connection is secure. | 68 // Whether or not the connection is secure. |
| 82 @property(nonatomic, assign, getter=isConnectionSecure) BOOL connectionSecure; | 69 @property(nonatomic, assign, getter=isConnectionSecure) BOOL connectionSecure; |
| 83 | 70 |
| 84 // Whether or not the view is in a pending state. | 71 // Whether or not the view is in a pending state. |
| 85 @property(nonatomic, assign, getter=isPending) BOOL pending; | 72 @property(nonatomic, assign, getter=isPending) BOOL pending; |
| 86 | 73 |
| 87 // The delegate to be notified when the user confirms or cancels the request. | 74 // The delegate to be notified when the user confirms or cancels the request. |
| 88 @property(nonatomic, weak) id<PaymentRequestViewControllerDelegate> delegate; | 75 @property(nonatomic, weak) id<PaymentRequestViewControllerDelegate> delegate; |
| 89 | 76 |
| 90 // Whether the data source should be shown (usually until the first payment | 77 // The data source for this view controller. |
| 91 // has been completed) or not. | |
| 92 @property(nonatomic, assign) BOOL showPaymentDataSource; | |
| 93 | |
| 94 @property(nonatomic, weak) id<PaymentRequestViewControllerDataSource> | 78 @property(nonatomic, weak) id<PaymentRequestViewControllerDataSource> |
| 95 dataSource; | 79 dataSource; |
| 96 | 80 |
| 97 // Updates the payment summary section UI. If |totalValueChanged| is YES, | 81 // Updates the payment summary item in the summary section. |
| 98 // adds a label to the total amount item indicating that the total amount was | 82 - (void)updatePaymentSummaryItem; |
| 99 // updated. | |
| 100 - (void)updatePaymentSummaryWithTotalValueChanged:(BOOL)totalValueChanged; | |
| 101 | 83 |
| 102 // Updates the selected shipping address. | 84 // Updates the shipping section. |
| 103 - (void)updateSelectedShippingAddressUI; | 85 - (void)updateShippingSection; |
| 104 | 86 |
| 105 // Updates the selected shipping option. | 87 // Updates the payment method section. |
| 106 - (void)updateSelectedShippingOptionUI; | 88 - (void)updatePaymentMethodSection; |
| 107 | 89 |
| 108 // Updates the selected payment method. | 90 // Updates the contact info section. |
| 109 - (void)updateSelectedPaymentMethodUI; | 91 - (void)updateContactInfoSection; |
| 110 | 92 |
| 111 // Updates the selected contact info. | 93 - (instancetype)init NS_DESIGNATED_INITIALIZER; |
| 112 - (void)updateSelectedContactInfoUI; | |
| 113 | |
| 114 // Initializes this object with an instance of PaymentRequest which has a copy | |
| 115 // of web::PaymentRequest as provided by the page invoking the Payment Request | |
| 116 // API. This object will not take ownership of |paymentRequest|. | |
| 117 - (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest | |
| 118 NS_DESIGNATED_INITIALIZER; | |
| 119 | |
| 120 - (instancetype)init NS_UNAVAILABLE; | |
| 121 | 94 |
| 122 - (instancetype)initWithStyle:(CollectionViewControllerStyle)style | 95 - (instancetype)initWithStyle:(CollectionViewControllerStyle)style |
| 123 NS_UNAVAILABLE; | 96 NS_UNAVAILABLE; |
| 124 | 97 |
| 125 @end | 98 @end |
| 126 | 99 |
| 127 #endif // IOS_CHROME_BROWSER_UI_PAYMENTS_PAYMENT_REQUEST_VIEW_CONTROLLER_H_ | 100 #endif // IOS_CHROME_BROWSER_UI_PAYMENTS_PAYMENT_REQUEST_VIEW_CONTROLLER_H_ |
| OLD | NEW |