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 #import "ios/chrome/browser/ui/payments/payment_request_edit_view_controller.h" | 5 #import "ios/chrome/browser/ui/payments/payment_request_edit_view_controller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #import "base/mac/foundation_util.h" | 8 #import "base/mac/foundation_util.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "components/strings/grit/components_strings.h" | 10 #include "components/strings/grit/components_strings.h" |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 if ([self.collectionViewModel | 541 if ([self.collectionViewModel |
542 hasSectionForSectionIdentifier:SectionIdentifierHeader]) | 542 hasSectionForSectionIdentifier:SectionIdentifierHeader]) |
543 index--; | 543 index--; |
544 DCHECK(index >= 0 && index < static_cast<NSInteger>(self.fields.count)); | 544 DCHECK(index >= 0 && index < static_cast<NSInteger>(self.fields.count)); |
545 EditorField* field = [self.fields objectAtIndex:index]; | 545 EditorField* field = [self.fields objectAtIndex:index]; |
546 | 546 |
547 // If a selector field is selected, blur the focused text field. | 547 // If a selector field is selected, blur the focused text field. |
548 if (field.fieldType == EditorFieldTypeSelector) | 548 if (field.fieldType == EditorFieldTypeSelector) |
549 [[_currentEditingCell textField] resignFirstResponder]; | 549 [[_currentEditingCell textField] resignFirstResponder]; |
550 | 550 |
551 [_delegate paymentRequestEditViewController:self didSelectField:field]; | 551 if ([self.delegate respondsToSelector:@selector |
| 552 (paymentRequestEditViewController:didSelectField:)]) { |
| 553 [_delegate paymentRequestEditViewController:self didSelectField:field]; |
| 554 } |
552 } | 555 } |
553 | 556 |
554 #pragma mark MDCCollectionViewStylingDelegate | 557 #pragma mark MDCCollectionViewStylingDelegate |
555 | 558 |
556 - (CGFloat)collectionView:(UICollectionView*)collectionView | 559 - (CGFloat)collectionView:(UICollectionView*)collectionView |
557 cellHeightAtIndexPath:(NSIndexPath*)indexPath { | 560 cellHeightAtIndexPath:(NSIndexPath*)indexPath { |
558 CollectionViewItem* item = | 561 CollectionViewItem* item = |
559 [self.collectionViewModel itemAtIndexPath:indexPath]; | 562 [self.collectionViewModel itemAtIndexPath:indexPath]; |
560 switch (item.type) { | 563 switch (item.type) { |
561 case ItemTypeHeader: | 564 case ItemTypeHeader: |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 [_currentEditingCell.textField resignFirstResponder]; | 737 [_currentEditingCell.textField resignFirstResponder]; |
735 | 738 |
736 if (![self validateForm]) | 739 if (![self validateForm]) |
737 return; | 740 return; |
738 | 741 |
739 [self.delegate paymentRequestEditViewController:self | 742 [self.delegate paymentRequestEditViewController:self |
740 didFinishEditingFields:self.fields]; | 743 didFinishEditingFields:self.fields]; |
741 } | 744 } |
742 | 745 |
743 @end | 746 @end |
OLD | NEW |