| 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/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 uppercaseStringWithLocale:[NSLocale currentLocale]]; | 253 uppercaseStringWithLocale:[NSLocale currentLocale]]; |
| 254 addAddressItem.accessibilityTraits |= UIAccessibilityTraitButton; | 254 addAddressItem.accessibilityTraits |= UIAccessibilityTraitButton; |
| 255 } | 255 } |
| 256 [model addItem:shippingAddressItem | 256 [model addItem:shippingAddressItem |
| 257 toSectionWithIdentifier:SectionIdentifierShipping]; | 257 toSectionWithIdentifier:SectionIdentifierShipping]; |
| 258 | 258 |
| 259 CollectionViewItem* shippingOptionItem = nil; | 259 CollectionViewItem* shippingOptionItem = nil; |
| 260 if (_paymentRequest->selected_shipping_option()) { | 260 if (_paymentRequest->selected_shipping_option()) { |
| 261 CollectionViewTextItem* selectedShippingOptionItem = | 261 CollectionViewTextItem* selectedShippingOptionItem = |
| 262 [[CollectionViewTextItem alloc] initWithType:ItemTypeShippingOption]; | 262 [[CollectionViewTextItem alloc] initWithType:ItemTypeShippingOption]; |
| 263 selectedShippingOptionItem.textFont = [MDCTypography body2Font]; |
| 264 selectedShippingOptionItem.textColor = [[MDCPalette greyPalette] tint900]; |
| 265 selectedShippingOptionItem.detailTextFont = [MDCTypography body1Font]; |
| 266 selectedShippingOptionItem.detailTextColor = |
| 267 [[MDCPalette greyPalette] tint900]; |
| 263 shippingOptionItem = selectedShippingOptionItem; | 268 shippingOptionItem = selectedShippingOptionItem; |
| 269 |
| 264 _selectedShippingOptionItem = selectedShippingOptionItem; | 270 _selectedShippingOptionItem = selectedShippingOptionItem; |
| 265 [self fillShippingOptionItem:selectedShippingOptionItem | 271 [self fillShippingOptionItem:selectedShippingOptionItem |
| 266 withOption:_paymentRequest->selected_shipping_option()]; | 272 withOption:_paymentRequest->selected_shipping_option()]; |
| 267 selectedShippingOptionItem.accessoryType = | 273 selectedShippingOptionItem.accessoryType = |
| 268 MDCCollectionViewCellAccessoryDisclosureIndicator; | 274 MDCCollectionViewCellAccessoryDisclosureIndicator; |
| 269 selectedShippingOptionItem.accessibilityTraits |= | 275 selectedShippingOptionItem.accessibilityTraits |= |
| 270 UIAccessibilityTraitButton; | 276 UIAccessibilityTraitButton; |
| 271 } else { | 277 } else { |
| 272 CollectionViewDetailItem* selectShippingOptionItem = | 278 CollectionViewDetailItem* selectShippingOptionItem = |
| 273 [[CollectionViewDetailItem alloc] | 279 [[CollectionViewDetailItem alloc] |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 [self.collectionViewModel itemTypeForIndexPath:indexPath]; | 469 [self.collectionViewModel itemTypeForIndexPath:indexPath]; |
| 464 switch (itemType) { | 470 switch (itemType) { |
| 465 case ItemTypeAddShippingAddress: { | 471 case ItemTypeAddShippingAddress: { |
| 466 CollectionViewDetailCell* detailCell = | 472 CollectionViewDetailCell* detailCell = |
| 467 base::mac::ObjCCastStrict<CollectionViewDetailCell>(cell); | 473 base::mac::ObjCCastStrict<CollectionViewDetailCell>(cell); |
| 468 detailCell.detailTextLabel.font = [MDCTypography body2Font]; | 474 detailCell.detailTextLabel.font = [MDCTypography body2Font]; |
| 469 detailCell.detailTextLabel.textColor = | 475 detailCell.detailTextLabel.textColor = |
| 470 [[MDCPalette cr_bluePalette] tint700]; | 476 [[MDCPalette cr_bluePalette] tint700]; |
| 471 break; | 477 break; |
| 472 } | 478 } |
| 473 case ItemTypeShippingOption: { | |
| 474 MDCCollectionViewTextCell* textCell = | |
| 475 base::mac::ObjCCastStrict<MDCCollectionViewTextCell>(cell); | |
| 476 textCell.textLabel.font = [MDCTypography body2Font]; | |
| 477 textCell.textLabel.textColor = [[MDCPalette greyPalette] tint900]; | |
| 478 textCell.detailTextLabel.font = [MDCTypography body1Font]; | |
| 479 textCell.detailTextLabel.textColor = [[MDCPalette greyPalette] tint900]; | |
| 480 break; | |
| 481 } | |
| 482 default: | 479 default: |
| 483 break; | 480 break; |
| 484 } | 481 } |
| 485 return cell; | 482 return cell; |
| 486 } | 483 } |
| 487 | 484 |
| 488 #pragma mark UICollectionViewDelegate | 485 #pragma mark UICollectionViewDelegate |
| 489 | 486 |
| 490 - (void)collectionView:(UICollectionView*)collectionView | 487 - (void)collectionView:(UICollectionView*)collectionView |
| 491 didSelectItemAtIndexPath:(NSIndexPath*)indexPath { | 488 didSelectItemAtIndexPath:(NSIndexPath*)indexPath { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; | 557 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; |
| 561 if (type == ItemTypeSummaryTotal && | 558 if (type == ItemTypeSummaryTotal && |
| 562 _paymentRequest->payment_details().display_items.empty()) { | 559 _paymentRequest->payment_details().display_items.empty()) { |
| 563 return YES; | 560 return YES; |
| 564 } else { | 561 } else { |
| 565 return NO; | 562 return NO; |
| 566 } | 563 } |
| 567 } | 564 } |
| 568 | 565 |
| 569 @end | 566 @end |
| OLD | NEW |