| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 ItemTypeContactInfo, | 94 ItemTypeContactInfo, |
| 95 ItemTypeAddContactInfo, | 95 ItemTypeAddContactInfo, |
| 96 ItemTypeFooterText, | 96 ItemTypeFooterText, |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 } // namespace | 99 } // namespace |
| 100 | 100 |
| 101 @interface PaymentRequestViewController ()< | 101 @interface PaymentRequestViewController ()< |
| 102 PaymentRequestViewControllerActions> { | 102 PaymentRequestViewControllerActions> { |
| 103 UIBarButtonItem* _cancelButton; | 103 UIBarButtonItem* _cancelButton; |
| 104 MDCFlatButton* _payButton; | 104 MDCButton* _payButton; |
| 105 | 105 |
| 106 // The PaymentRequest object having a copy of web::PaymentRequest as provided | 106 // The PaymentRequest object having a copy of web::PaymentRequest as provided |
| 107 // by the page invoking the Payment Request API. This is a weak pointer and | 107 // by the page invoking the Payment Request API. This is a weak pointer and |
| 108 // should outlive this class. | 108 // should outlive this class. |
| 109 PaymentRequest* _paymentRequest; | 109 PaymentRequest* _paymentRequest; |
| 110 | 110 |
| 111 __weak PriceItem* _paymentSummaryItem; | 111 __weak PriceItem* _paymentSummaryItem; |
| 112 __weak AutofillProfileItem* _selectedShippingAddressItem; | 112 __weak AutofillProfileItem* _selectedShippingAddressItem; |
| 113 __weak CollectionViewTextItem* _selectedShippingOptionItem; | 113 __weak CollectionViewTextItem* _selectedShippingOptionItem; |
| 114 __weak PaymentMethodItem* _selectedPaymentMethodItem; | 114 __weak PaymentMethodItem* _selectedPaymentMethodItem; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 140 action:@selector(onCancel)]; | 140 action:@selector(onCancel)]; |
| 141 [_cancelButton setTitleTextAttributes:@{ | 141 [_cancelButton setTitleTextAttributes:@{ |
| 142 NSForegroundColorAttributeName : [UIColor lightGrayColor] | 142 NSForegroundColorAttributeName : [UIColor lightGrayColor] |
| 143 } | 143 } |
| 144 forState:UIControlStateDisabled]; | 144 forState:UIControlStateDisabled]; |
| 145 [_cancelButton | 145 [_cancelButton |
| 146 setAccessibilityLabel:l10n_util::GetNSString(IDS_ACCNAME_CANCEL)]; | 146 setAccessibilityLabel:l10n_util::GetNSString(IDS_ACCNAME_CANCEL)]; |
| 147 [self navigationItem].leftBarButtonItem = _cancelButton; | 147 [self navigationItem].leftBarButtonItem = _cancelButton; |
| 148 | 148 |
| 149 // Set up trailing (pay) button. | 149 // Set up trailing (pay) button. |
| 150 _payButton = [[MDCFlatButton alloc] init]; | 150 _payButton = [[MDCButton alloc] init]; |
| 151 [_payButton setTitle:l10n_util::GetNSString(IDS_PAYMENTS_PAY_BUTTON) | 151 [_payButton setTitle:l10n_util::GetNSString(IDS_PAYMENTS_PAY_BUTTON) |
| 152 forState:UIControlStateNormal]; | 152 forState:UIControlStateNormal]; |
| 153 [_payButton setBackgroundColor:[[MDCPalette cr_bluePalette] tint500] | 153 [_payButton setCustomTitleColor:[UIColor whiteColor]]; |
| 154 forState:UIControlStateNormal]; | |
| 155 [_payButton setInkColor:[UIColor colorWithWhite:1 alpha:0.2]]; | 154 [_payButton setInkColor:[UIColor colorWithWhite:1 alpha:0.2]]; |
| 156 [_payButton setBackgroundColor:[UIColor grayColor] | |
| 157 forState:UIControlStateDisabled]; | |
| 158 [_payButton addTarget:nil | 155 [_payButton addTarget:nil |
| 159 action:@selector(onConfirm) | 156 action:@selector(onConfirm) |
| 160 forControlEvents:UIControlEventTouchUpInside]; | 157 forControlEvents:UIControlEventTouchUpInside]; |
| 161 [_payButton sizeToFit]; | 158 [_payButton sizeToFit]; |
| 162 [_payButton setEnabled:(paymentRequest->selected_credit_card() != nil)]; | 159 [_payButton setEnabled:(paymentRequest->selected_credit_card() != nil)]; |
| 163 [_payButton setAutoresizingMask:UIViewAutoresizingFlexibleTrailingMargin() | | 160 [_payButton setAutoresizingMask:UIViewAutoresizingFlexibleTrailingMargin() | |
| 164 UIViewAutoresizingFlexibleTopMargin | | 161 UIViewAutoresizingFlexibleTopMargin | |
| 165 UIViewAutoresizingFlexibleBottomMargin]; | 162 UIViewAutoresizingFlexibleBottomMargin]; |
| 166 | 163 |
| 167 // The navigation bar will set the rightBarButtonItem's height to the full | 164 // The navigation bar will set the rightBarButtonItem's height to the full |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 | 615 |
| 619 - (BOOL)collectionView:(UICollectionView*)collectionView | 616 - (BOOL)collectionView:(UICollectionView*)collectionView |
| 620 shouldHideItemBackgroundAtIndexPath:(NSIndexPath*)indexPath { | 617 shouldHideItemBackgroundAtIndexPath:(NSIndexPath*)indexPath { |
| 621 // No background on the footer text item. | 618 // No background on the footer text item. |
| 622 NSInteger sectionIdentifier = | 619 NSInteger sectionIdentifier = |
| 623 [self.collectionViewModel sectionIdentifierForSection:indexPath.section]; | 620 [self.collectionViewModel sectionIdentifierForSection:indexPath.section]; |
| 624 return sectionIdentifier == SectionIdentifierFooter ? YES : NO; | 621 return sectionIdentifier == SectionIdentifierFooter ? YES : NO; |
| 625 } | 622 } |
| 626 | 623 |
| 627 @end | 624 @end |
| OLD | NEW |