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_COORDINATOR_H_ | 5 #ifndef IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_COORDINATOR_H_ |
6 #define IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_COORDINATOR_H_ | 6 #define IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_COORDINATOR_H_ |
7 | 7 |
8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
9 | 9 |
| 10 #include "base/ios/block_types.h" |
10 #include "components/autofill/core/browser/autofill_manager.h" | 11 #include "components/autofill/core/browser/autofill_manager.h" |
11 #import "ios/chrome/browser/chrome_coordinator.h" | 12 #import "ios/chrome/browser/chrome_coordinator.h" |
12 #import "ios/chrome/browser/payments/payment_items_display_coordinator.h" | 13 #import "ios/chrome/browser/payments/payment_items_display_coordinator.h" |
13 #import "ios/chrome/browser/payments/payment_method_selection_coordinator.h" | 14 #import "ios/chrome/browser/payments/payment_method_selection_coordinator.h" |
14 #include "ios/chrome/browser/payments/payment_request.h" | 15 #include "ios/chrome/browser/payments/payment_request.h" |
| 16 #include "ios/chrome/browser/payments/payment_request_error_coordinator.h" |
15 #import "ios/chrome/browser/payments/payment_request_view_controller.h" | 17 #import "ios/chrome/browser/payments/payment_request_view_controller.h" |
16 #import "ios/chrome/browser/payments/shipping_address_selection_coordinator.h" | 18 #import "ios/chrome/browser/payments/shipping_address_selection_coordinator.h" |
17 #import "ios/chrome/browser/payments/shipping_option_selection_coordinator.h" | 19 #import "ios/chrome/browser/payments/shipping_option_selection_coordinator.h" |
18 | 20 |
19 namespace ios { | 21 namespace ios { |
20 class ChromeBrowserState; | 22 class ChromeBrowserState; |
21 } | 23 } |
22 | 24 |
23 @class PaymentRequestCoordinator; | 25 @class PaymentRequestCoordinator; |
24 | 26 |
(...skipping 16 matching lines...) Expand all Loading... |
41 - (void)paymentRequestCoordinator:(PaymentRequestCoordinator*)coordinator | 43 - (void)paymentRequestCoordinator:(PaymentRequestCoordinator*)coordinator |
42 didSelectShippingOption:(web::PaymentShippingOption)shippingOption; | 44 didSelectShippingOption:(web::PaymentShippingOption)shippingOption; |
43 | 45 |
44 @end | 46 @end |
45 | 47 |
46 // Coordinator responsible for creating and presenting the PaymentRequest view | 48 // Coordinator responsible for creating and presenting the PaymentRequest view |
47 // controller. The PR view controller will be presented by the view controller | 49 // controller. The PR view controller will be presented by the view controller |
48 // provided in the initializer. | 50 // provided in the initializer. |
49 @interface PaymentRequestCoordinator | 51 @interface PaymentRequestCoordinator |
50 : ChromeCoordinator<PaymentRequestViewControllerDelegate, | 52 : ChromeCoordinator<PaymentRequestViewControllerDelegate, |
| 53 PaymentRequestErrorCoordinatorDelegate, |
51 PaymentItemsDisplayCoordinatorDelegate, | 54 PaymentItemsDisplayCoordinatorDelegate, |
52 PaymentMethodSelectionCoordinatorDelegate, | 55 PaymentMethodSelectionCoordinatorDelegate, |
53 ShippingAddressSelectionCoordinatorDelegate, | 56 ShippingAddressSelectionCoordinatorDelegate, |
54 ShippingOptionSelectionCoordinatorDelegate> | 57 ShippingOptionSelectionCoordinatorDelegate> |
55 | 58 |
56 // Creates a Payment Request coordinator that will present UI on | |
57 // |viewController| using data available from |personalDataManager|. | |
58 - (instancetype)initWithBaseViewController:(UIViewController*)viewController | |
59 NS_DESIGNATED_INITIALIZER; | |
60 | |
61 // The PaymentRequest object owning an instance of web::PaymentRequest as | 59 // The PaymentRequest object owning an instance of web::PaymentRequest as |
62 // provided by the page invoking the Payment Request API. This pointer is not | 60 // provided by the page invoking the Payment Request API. This pointer is not |
63 // owned by this class and should outlive it. | 61 // owned by this class and should outlive it. |
64 @property(nonatomic, assign) PaymentRequest* paymentRequest; | 62 @property(nonatomic, assign) PaymentRequest* paymentRequest; |
65 | 63 |
66 // An instance of autofill::AutofillManager used for credit card unmasking. This | 64 // An instance of autofill::AutofillManager used for credit card unmasking. This |
67 // reference is not owned by this class. | 65 // reference is not owned by this class. |
68 @property(nonatomic, assign) autofill::AutofillManager* autofillManager; | 66 @property(nonatomic, assign) autofill::AutofillManager* autofillManager; |
69 | 67 |
70 // An ios::ChromeBrowserState instance. This reference is not owned by this | 68 // An ios::ChromeBrowserState instance. This reference is not owned by this |
(...skipping 11 matching lines...) Expand all Loading... |
82 // The host of the page invoking the Payment Request API. Should be set before | 80 // The host of the page invoking the Payment Request API. Should be set before |
83 // calling |start|. | 81 // calling |start|. |
84 @property(nonatomic, copy) NSString* pageHost; | 82 @property(nonatomic, copy) NSString* pageHost; |
85 | 83 |
86 // The delegate to be notified when the user confirms or cancels the request. | 84 // The delegate to be notified when the user confirms or cancels the request. |
87 @property(nonatomic, weak) id<PaymentRequestCoordinatorDelegate> delegate; | 85 @property(nonatomic, weak) id<PaymentRequestCoordinatorDelegate> delegate; |
88 | 86 |
89 // Updates the payment details of the PaymentRequest and updates the UI. | 87 // Updates the payment details of the PaymentRequest and updates the UI. |
90 - (void)updatePaymentDetails:(web::PaymentDetails)paymentDetails; | 88 - (void)updatePaymentDetails:(web::PaymentDetails)paymentDetails; |
91 | 89 |
| 90 // Displays an error message. Invokes |callback| when the message is dismissed. |
| 91 - (void)displayErrorWithCallback:(ProceduralBlock)callback; |
| 92 |
92 // Called when a credit card has been successfully unmasked. | 93 // Called when a credit card has been successfully unmasked. |
93 - (void)fullCardRequestDidSucceedWithCard:(const autofill::CreditCard&)card | 94 - (void)fullCardRequestDidSucceedWithCard:(const autofill::CreditCard&)card |
94 CVC:(const base::string16&)cvc; | 95 CVC:(const base::string16&)cvc; |
95 | 96 |
96 @end | 97 @end |
97 | 98 |
98 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_COORDINATOR_H_ | 99 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_COORDINATOR_H_ |
OLD | NEW |