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/payment_request_view_controller.h" | 5 #import "ios/chrome/browser/payments/payment_request_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/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 using ::payment_request_util::GetEmailLabelFromAutofillProfile; | 53 using ::payment_request_util::GetEmailLabelFromAutofillProfile; |
54 using ::payment_request_util::GetShippingSectionTitle; | 54 using ::payment_request_util::GetShippingSectionTitle; |
55 using ::payment_request_util::GetShippingAddressSelectorTitle; | 55 using ::payment_request_util::GetShippingAddressSelectorTitle; |
56 using ::payment_request_util::GetShippingOptionSelectorTitle; | 56 using ::payment_request_util::GetShippingOptionSelectorTitle; |
57 | 57 |
58 // String used as the "URL" to take the user to the settings page for card and | 58 // String used as the "URL" to take the user to the settings page for card and |
59 // address options. Needs to be URL-like; otherwise, the link will not appear | 59 // address options. Needs to be URL-like; otherwise, the link will not appear |
60 // as a link in the UI (see setLabelLinkURL: in CollectionViewFooterCell). | 60 // as a link in the UI (see setLabelLinkURL: in CollectionViewFooterCell). |
61 const char kSettingsURL[] = "settings://card-and-address"; | 61 const char kSettingsURL[] = "settings://card-and-address"; |
62 | 62 |
| 63 const CGFloat kFooterCellHorizontalPadding = 16; |
| 64 |
63 } // namespace | 65 } // namespace |
64 | 66 |
65 NSString* const kPaymentRequestCollectionViewID = | 67 NSString* const kPaymentRequestCollectionViewID = |
66 @"kPaymentRequestCollectionViewID"; | 68 @"kPaymentRequestCollectionViewID"; |
67 | 69 |
68 namespace { | 70 namespace { |
69 | 71 |
70 const CGFloat kButtonEdgeInset = 9; | 72 const CGFloat kButtonEdgeInset = 9; |
71 const CGFloat kSeparatorEdgeInset = 14; | 73 const CGFloat kSeparatorEdgeInset = 14; |
72 | 74 |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 [self.collectionViewModel itemTypeForIndexPath:indexPath]; | 517 [self.collectionViewModel itemTypeForIndexPath:indexPath]; |
516 switch (itemType) { | 518 switch (itemType) { |
517 case ItemTypeAddShippingAddress: { | 519 case ItemTypeAddShippingAddress: { |
518 CollectionViewDetailCell* detailCell = | 520 CollectionViewDetailCell* detailCell = |
519 base::mac::ObjCCastStrict<CollectionViewDetailCell>(cell); | 521 base::mac::ObjCCastStrict<CollectionViewDetailCell>(cell); |
520 detailCell.detailTextLabel.font = [MDCTypography body2Font]; | 522 detailCell.detailTextLabel.font = [MDCTypography body2Font]; |
521 detailCell.detailTextLabel.textColor = | 523 detailCell.detailTextLabel.textColor = |
522 [[MDCPalette cr_bluePalette] tint700]; | 524 [[MDCPalette cr_bluePalette] tint700]; |
523 break; | 525 break; |
524 } | 526 } |
| 527 case ItemTypeFooterText: { |
| 528 CollectionViewFooterCell* footerCell = |
| 529 base::mac::ObjCCastStrict<CollectionViewFooterCell>(cell); |
| 530 footerCell.textLabel.font = [MDCTypography body2Font]; |
| 531 footerCell.textLabel.textColor = [[MDCPalette greyPalette] tint600]; |
| 532 footerCell.textLabel.shadowColor = nil; // No shadow. |
| 533 footerCell.horizontalPadding = kFooterCellHorizontalPadding; |
| 534 break; |
| 535 } |
525 default: | 536 default: |
526 break; | 537 break; |
527 } | 538 } |
528 return cell; | 539 return cell; |
529 } | 540 } |
530 | 541 |
531 #pragma mark UICollectionViewDelegate | 542 #pragma mark UICollectionViewDelegate |
532 | 543 |
533 - (void)collectionView:(UICollectionView*)collectionView | 544 - (void)collectionView:(UICollectionView*)collectionView |
534 didSelectItemAtIndexPath:(NSIndexPath*)indexPath { | 545 didSelectItemAtIndexPath:(NSIndexPath*)indexPath { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 | 629 |
619 - (BOOL)collectionView:(UICollectionView*)collectionView | 630 - (BOOL)collectionView:(UICollectionView*)collectionView |
620 shouldHideItemBackgroundAtIndexPath:(NSIndexPath*)indexPath { | 631 shouldHideItemBackgroundAtIndexPath:(NSIndexPath*)indexPath { |
621 // No background on the footer text item. | 632 // No background on the footer text item. |
622 NSInteger sectionIdentifier = | 633 NSInteger sectionIdentifier = |
623 [self.collectionViewModel sectionIdentifierForSection:indexPath.section]; | 634 [self.collectionViewModel sectionIdentifierForSection:indexPath.section]; |
624 return sectionIdentifier == SectionIdentifierFooter ? YES : NO; | 635 return sectionIdentifier == SectionIdentifierFooter ? YES : NO; |
625 } | 636 } |
626 | 637 |
627 @end | 638 @end |
OLD | NEW |