| 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 #import "ios/chrome/browser/payments/shipping_address_selection_view_controller.
     h" |    5 #import "ios/chrome/browser/payments/shipping_address_selection_view_controller.
     h" | 
|    6  |    6  | 
|    7 #include "base/mac/foundation_util.h" |    7 #include "base/mac/foundation_util.h" | 
|    8  |    8  | 
|    9 #include "base/strings/sys_string_conversions.h" |    9 #include "base/strings/sys_string_conversions.h" | 
|   10 #include "components/autofill/core/browser/autofill_profile.h" |   10 #include "components/autofill/core/browser/autofill_profile.h" | 
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  102  |  102  | 
|  103 - (void)loadModel { |  103 - (void)loadModel { | 
|  104   [super loadModel]; |  104   [super loadModel]; | 
|  105   CollectionViewModel* model = self.collectionViewModel; |  105   CollectionViewModel* model = self.collectionViewModel; | 
|  106   _selectedItem = nil; |  106   _selectedItem = nil; | 
|  107  |  107  | 
|  108   [model addSectionWithIdentifier:SectionIdentifierShippingAddress]; |  108   [model addSectionWithIdentifier:SectionIdentifierShippingAddress]; | 
|  109  |  109  | 
|  110   if (_pending) { |  110   if (_pending) { | 
|  111     StatusItem* statusItem = [[StatusItem alloc] initWithType:ItemTypeSpinner]; |  111     StatusItem* statusItem = [[StatusItem alloc] initWithType:ItemTypeSpinner]; | 
|  112     statusItem.text = |  112     statusItem.text = l10n_util::GetNSString(IDS_PAYMENTS_CHECKING_OPTION); | 
|  113         l10n_util::GetNSString(IDS_IOS_PAYMENT_REQUEST_CHECKING_LABEL); |  | 
|  114     [model addItem:statusItem |  113     [model addItem:statusItem | 
|  115         toSectionWithIdentifier:SectionIdentifierShippingAddress]; |  114         toSectionWithIdentifier:SectionIdentifierShippingAddress]; | 
|  116     return; |  115     return; | 
|  117   } |  116   } | 
|  118  |  117  | 
|  119   PaymentsTextItem* messageItem = |  118   PaymentsTextItem* messageItem = | 
|  120       [[PaymentsTextItem alloc] initWithType:ItemTypeMessage]; |  119       [[PaymentsTextItem alloc] initWithType:ItemTypeMessage]; | 
|  121   if (_errorMessage) { |  120   if (_errorMessage) { | 
|  122     messageItem.text = _errorMessage; |  121     messageItem.text = _errorMessage; | 
|  123     messageItem.image = NativeImage(IDR_IOS_PAYMENTS_WARNING); |  122     messageItem.image = NativeImage(IDR_IOS_PAYMENTS_WARNING); | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
|  139     if (_paymentRequest->selected_shipping_profile() == shippingAddress) { |  138     if (_paymentRequest->selected_shipping_profile() == shippingAddress) { | 
|  140       item.accessoryType = MDCCollectionViewCellAccessoryCheckmark; |  139       item.accessoryType = MDCCollectionViewCellAccessoryCheckmark; | 
|  141       _selectedItem = item; |  140       _selectedItem = item; | 
|  142     } |  141     } | 
|  143     [model addItem:item |  142     [model addItem:item | 
|  144         toSectionWithIdentifier:SectionIdentifierShippingAddress]; |  143         toSectionWithIdentifier:SectionIdentifierShippingAddress]; | 
|  145   } |  144   } | 
|  146  |  145  | 
|  147   PaymentsTextItem* addShippingAddress = |  146   PaymentsTextItem* addShippingAddress = | 
|  148       [[PaymentsTextItem alloc] initWithType:ItemTypeAddShippingAddress]; |  147       [[PaymentsTextItem alloc] initWithType:ItemTypeAddShippingAddress]; | 
|  149   addShippingAddress.text = l10n_util::GetNSString( |  148   addShippingAddress.text = l10n_util::GetNSString(IDS_PAYMENTS_ADD_ADDRESS); | 
|  150       IDS_IOS_PAYMENT_REQUEST_SHIPPING_ADDRESS_SELECTION_ADD_BUTTON); |  | 
|  151   addShippingAddress.image = NativeImage(IDR_IOS_PAYMENTS_ADD); |  149   addShippingAddress.image = NativeImage(IDR_IOS_PAYMENTS_ADD); | 
|  152   addShippingAddress.accessibilityTraits |= UIAccessibilityTraitButton; |  150   addShippingAddress.accessibilityTraits |= UIAccessibilityTraitButton; | 
|  153   [model addItem:addShippingAddress |  151   [model addItem:addShippingAddress | 
|  154       toSectionWithIdentifier:SectionIdentifierShippingAddress]; |  152       toSectionWithIdentifier:SectionIdentifierShippingAddress]; | 
|  155 } |  153 } | 
|  156  |  154  | 
|  157 - (void)viewDidLoad { |  155 - (void)viewDidLoad { | 
|  158   [super viewDidLoad]; |  156   [super viewDidLoad]; | 
|  159   self.collectionView.accessibilityIdentifier = |  157   self.collectionView.accessibilityIdentifier = | 
|  160       kShippingAddressSelectionCollectionViewID; |  158       kShippingAddressSelectionCollectionViewID; | 
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  257     hidesInkViewAtIndexPath:(NSIndexPath*)indexPath { |  255     hidesInkViewAtIndexPath:(NSIndexPath*)indexPath { | 
|  258   NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; |  256   NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; | 
|  259   if (type == ItemTypeMessage) { |  257   if (type == ItemTypeMessage) { | 
|  260     return YES; |  258     return YES; | 
|  261   } else { |  259   } else { | 
|  262     return NO; |  260     return NO; | 
|  263   } |  261   } | 
|  264 } |  262 } | 
|  265  |  263  | 
|  266 @end |  264 @end | 
| OLD | NEW |