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 #import "ios/chrome/browser/chrome_coordinator.h" | 10 #import "ios/chrome/browser/chrome_coordinator.h" |
11 #import "ios/chrome/browser/payments/payment_items_display_coordinator.h" | 11 #import "ios/chrome/browser/payments/payment_items_display_coordinator.h" |
12 #import "ios/chrome/browser/payments/payment_method_selection_coordinator.h" | 12 #import "ios/chrome/browser/payments/payment_method_selection_coordinator.h" |
13 #import "ios/chrome/browser/payments/payment_request_view_controller.h" | 13 #import "ios/chrome/browser/payments/payment_request_view_controller.h" |
14 #import "ios/chrome/browser/payments/shipping_address_selection_coordinator.h" | 14 #import "ios/chrome/browser/payments/shipping_address_selection_coordinator.h" |
| 15 #import "ios/chrome/browser/payments/shipping_option_selection_coordinator.h" |
15 #include "ios/web/public/payments/payment_request.h" | 16 #include "ios/web/public/payments/payment_request.h" |
16 | 17 |
17 namespace autofill { | 18 namespace autofill { |
18 class AutofillProfile; | 19 class AutofillProfile; |
19 class CreditCard; | 20 class CreditCard; |
20 class PersonalDataManager; | 21 class PersonalDataManager; |
21 } | 22 } |
22 | 23 |
23 @protocol PaymentRequestCoordinatorDelegate<NSObject> | 24 @protocol PaymentRequestCoordinatorDelegate<NSObject> |
24 - (void)paymentRequestCoordinatorDidCancel; | 25 - (void)paymentRequestCoordinatorDidCancel; |
25 - (void)paymentRequestCoordinatorDidConfirm: | 26 - (void)paymentRequestCoordinatorDidConfirm: |
26 (web::PaymentResponse)paymentResponse; | 27 (web::PaymentResponse)paymentResponse; |
27 | 28 |
28 @end | 29 @end |
29 | 30 |
30 // Coordinator responsible for creating and presenting the PaymentRequest view | 31 // Coordinator responsible for creating and presenting the PaymentRequest view |
31 // controller. The PR view controller will be presented by the view controller | 32 // controller. The PR view controller will be presented by the view controller |
32 // provided in the initializer. | 33 // provided in the initializer. |
33 @interface PaymentRequestCoordinator | 34 @interface PaymentRequestCoordinator |
34 : ChromeCoordinator<PaymentRequestViewControllerDelegate, | 35 : ChromeCoordinator<PaymentRequestViewControllerDelegate, |
35 PaymentItemsDisplayCoordinatorDelegate, | 36 PaymentItemsDisplayCoordinatorDelegate, |
36 PaymentMethodSelectionCoordinatorDelegate, | 37 PaymentMethodSelectionCoordinatorDelegate, |
37 ShippingAddressSelectionCoordinatorDelegate> | 38 ShippingAddressSelectionCoordinatorDelegate, |
| 39 ShippingOptionSelectionCoordinatorDelegate> |
38 | 40 |
39 // Creates a Payment Request coordinator that will present UI on | 41 // Creates a Payment Request coordinator that will present UI on |
40 // |viewController| using data available from |personalDataManager|. | 42 // |viewController| using data available from |personalDataManager|. |
41 - (instancetype)initWithBaseViewController:(UIViewController*)viewController | 43 - (instancetype)initWithBaseViewController:(UIViewController*)viewController |
42 personalDataManager: | 44 personalDataManager: |
43 (autofill::PersonalDataManager*)personalDataManager | 45 (autofill::PersonalDataManager*)personalDataManager |
44 NS_DESIGNATED_INITIALIZER; | 46 NS_DESIGNATED_INITIALIZER; |
45 | 47 |
46 - (instancetype)initWithBaseViewController:(UIViewController*)viewController | 48 - (instancetype)initWithBaseViewController:(UIViewController*)viewController |
47 NS_UNAVAILABLE; | 49 NS_UNAVAILABLE; |
(...skipping 11 matching lines...) Expand all Loading... |
59 @property(nonatomic, copy) NSString* pageTitle; | 61 @property(nonatomic, copy) NSString* pageTitle; |
60 | 62 |
61 // The host of the page invoking the Payment Request API. Should be set before | 63 // The host of the page invoking the Payment Request API. Should be set before |
62 // calling |start|. | 64 // calling |start|. |
63 @property(nonatomic, copy) NSString* pageHost; | 65 @property(nonatomic, copy) NSString* pageHost; |
64 | 66 |
65 // The currently selected shipping address, if any. | 67 // The currently selected shipping address, if any. |
66 @property(nonatomic, readonly) | 68 @property(nonatomic, readonly) |
67 autofill::AutofillProfile* selectedShippingAddress; | 69 autofill::AutofillProfile* selectedShippingAddress; |
68 | 70 |
| 71 // The currently selected shipping option, if any. |
| 72 @property(nonatomic, readonly) |
| 73 web::PaymentShippingOption* selectedShippingOption; |
| 74 |
69 // The payment method selected by the user, if any. | 75 // The payment method selected by the user, if any. |
70 @property(nonatomic, readonly) autofill::CreditCard* selectedPaymentMethod; | 76 @property(nonatomic, readonly) autofill::CreditCard* selectedPaymentMethod; |
71 | 77 |
72 // The delegate to be notified when the user confirms or cancels the request. | 78 // The delegate to be notified when the user confirms or cancels the request. |
73 @property(nonatomic, weak) id<PaymentRequestCoordinatorDelegate> delegate; | 79 @property(nonatomic, weak) id<PaymentRequestCoordinatorDelegate> delegate; |
74 | 80 |
75 @end | 81 @end |
76 | 82 |
77 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_COORDINATOR_H_ | 83 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_COORDINATOR_H_ |
OLD | NEW |