| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #import "ios/chrome/browser/payments/shipping_address_selection_mediator.h" | 7 #import "ios/chrome/browser/payments/shipping_address_selection_mediator.h" |
| 8 | 8 |
| 9 #include "components/autofill/core/browser/autofill_profile.h" | 9 #include "components/autofill/core/browser/autofill_profile.h" |
| 10 #include "components/strings/grit/components_strings.h" | 10 #include "components/strings/grit/components_strings.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // pointer and should outlive this class. | 33 // pointer and should outlive this class. |
| 34 @property(nonatomic, assign) PaymentRequest* paymentRequest; | 34 @property(nonatomic, assign) PaymentRequest* paymentRequest; |
| 35 | 35 |
| 36 // The selectable items to display in the collection. | 36 // The selectable items to display in the collection. |
| 37 @property(nonatomic, strong) NSArray<AutofillProfileItem*>* items; | 37 @property(nonatomic, strong) NSArray<AutofillProfileItem*>* items; |
| 38 | 38 |
| 39 @end | 39 @end |
| 40 | 40 |
| 41 @implementation ShippingAddressSelectionMediator | 41 @implementation ShippingAddressSelectionMediator |
| 42 | 42 |
| 43 @synthesize headerText = _headerText; |
| 43 @synthesize state = _state; | 44 @synthesize state = _state; |
| 44 @synthesize selectedItemIndex = _selectedItemIndex; | 45 @synthesize selectedItemIndex = _selectedItemIndex; |
| 45 @synthesize paymentRequest = _paymentRequest; | 46 @synthesize paymentRequest = _paymentRequest; |
| 46 @synthesize items = _items; | 47 @synthesize items = _items; |
| 47 @synthesize headerText = _headerText; | |
| 48 | 48 |
| 49 - (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest { | 49 - (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest { |
| 50 self = [super init]; | 50 self = [super init]; |
| 51 if (self) { | 51 if (self) { |
| 52 _paymentRequest = paymentRequest; | 52 _paymentRequest = paymentRequest; |
| 53 _selectedItemIndex = NSUIntegerMax; | 53 _selectedItemIndex = NSUIntegerMax; |
| 54 _items = [self createItems]; | 54 _items = [self createItems]; |
| 55 } | 55 } |
| 56 return self; | 56 return self; |
| 57 } | 57 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 item.phoneNumber = GetPhoneNumberLabelFromAutofillProfile(*shippingAddress); | 101 item.phoneNumber = GetPhoneNumberLabelFromAutofillProfile(*shippingAddress); |
| 102 if (_paymentRequest->selected_shipping_profile() == shippingAddress) | 102 if (_paymentRequest->selected_shipping_profile() == shippingAddress) |
| 103 _selectedItemIndex = index; | 103 _selectedItemIndex = index; |
| 104 | 104 |
| 105 [items addObject:item]; | 105 [items addObject:item]; |
| 106 } | 106 } |
| 107 return items; | 107 return items; |
| 108 } | 108 } |
| 109 | 109 |
| 110 @end | 110 @end |
| OLD | NEW |