| 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 16 matching lines...) Expand all Loading... |
| 27 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" | 27 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" |
| 28 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h
" | 28 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h
" |
| 29 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" | 29 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" |
| 30 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" | 30 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" |
| 31 #include "ios/chrome/browser/ui/rtl_geometry.h" | 31 #include "ios/chrome/browser/ui/rtl_geometry.h" |
| 32 #include "ios/chrome/browser/ui/uikit_ui_util.h" | 32 #include "ios/chrome/browser/ui/uikit_ui_util.h" |
| 33 #include "ios/chrome/grit/ios_strings.h" | 33 #include "ios/chrome/grit/ios_strings.h" |
| 34 #import "ios/third_party/material_components_ios/src/components/Buttons/src/Mate
rialButtons.h" | 34 #import "ios/third_party/material_components_ios/src/components/Buttons/src/Mate
rialButtons.h" |
| 35 #import "ios/third_party/material_components_ios/src/components/CollectionCells/
src/MaterialCollectionCells.h" | 35 #import "ios/third_party/material_components_ios/src/components/CollectionCells/
src/MaterialCollectionCells.h" |
| 36 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" | 36 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
| 37 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | |
| 38 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
| 39 #include "ui/base/resource/resource_bundle.h" | 38 #include "ui/base/resource/resource_bundle.h" |
| 40 | 39 |
| 41 #if !defined(__has_feature) || !__has_feature(objc_arc) | 40 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 42 #error "This file requires ARC support." | 41 #error "This file requires ARC support." |
| 43 #endif | 42 #endif |
| 44 | 43 |
| 45 namespace { | 44 namespace { |
| 46 using ::payment_request_util::GetNameLabelFromAutofillProfile; | 45 using ::payment_request_util::GetNameLabelFromAutofillProfile; |
| 47 using ::payment_request_util::GetAddressLabelFromAutofillProfile; | 46 using ::payment_request_util::GetShippingAddressLabelFromAutofillProfile; |
| 48 using ::payment_request_util::GetPhoneNumberLabelFromAutofillProfile; | 47 using ::payment_request_util::GetPhoneNumberLabelFromAutofillProfile; |
| 49 using ::payment_request_util::GetEmailLabelFromAutofillProfile; | 48 using ::payment_request_util::GetEmailLabelFromAutofillProfile; |
| 50 using ::payment_request_util::GetShippingSectionTitle; | 49 using ::payment_request_util::GetShippingSectionTitle; |
| 51 using ::payment_request_util::GetShippingAddressSelectorTitle; | 50 using ::payment_request_util::GetShippingAddressSelectorTitle; |
| 52 using ::payment_request_util::GetShippingOptionSelectorTitle; | 51 using ::payment_request_util::GetShippingOptionSelectorTitle; |
| 53 | 52 |
| 54 } // namespace | 53 } // namespace |
| 55 | 54 |
| 56 NSString* const kPaymentRequestCollectionViewID = | 55 NSString* const kPaymentRequestCollectionViewID = |
| 57 @"kPaymentRequestCollectionViewID"; | 56 @"kPaymentRequestCollectionViewID"; |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 currencyFormatter->Format(base::UTF16ToASCII(paymentItem.amount.value)))); | 412 currencyFormatter->Format(base::UTF16ToASCII(paymentItem.amount.value)))); |
| 414 item.notification = totalValueChanged | 413 item.notification = totalValueChanged |
| 415 ? l10n_util::GetNSString(IDS_PAYMENTS_UPDATED_LABEL) | 414 ? l10n_util::GetNSString(IDS_PAYMENTS_UPDATED_LABEL) |
| 416 : nil; | 415 : nil; |
| 417 } | 416 } |
| 418 | 417 |
| 419 - (void)fillShippingAddressItem:(AutofillProfileItem*)item | 418 - (void)fillShippingAddressItem:(AutofillProfileItem*)item |
| 420 withAutofillProfile:(autofill::AutofillProfile*)profile { | 419 withAutofillProfile:(autofill::AutofillProfile*)profile { |
| 421 DCHECK(profile); | 420 DCHECK(profile); |
| 422 item.name = GetNameLabelFromAutofillProfile(*profile); | 421 item.name = GetNameLabelFromAutofillProfile(*profile); |
| 423 item.address = GetAddressLabelFromAutofillProfile(*profile); | 422 item.address = GetShippingAddressLabelFromAutofillProfile(*profile); |
| 424 item.phoneNumber = GetPhoneNumberLabelFromAutofillProfile(*profile); | 423 item.phoneNumber = GetPhoneNumberLabelFromAutofillProfile(*profile); |
| 425 } | 424 } |
| 426 | 425 |
| 427 - (void)fillShippingOptionItem:(CollectionViewTextItem*)item | 426 - (void)fillShippingOptionItem:(CollectionViewTextItem*)item |
| 428 withOption:(web::PaymentShippingOption*)option { | 427 withOption:(web::PaymentShippingOption*)option { |
| 429 item.text = base::SysUTF16ToNSString(option->label); | 428 item.text = base::SysUTF16ToNSString(option->label); |
| 430 payments::CurrencyFormatter* currencyFormatter = | 429 payments::CurrencyFormatter* currencyFormatter = |
| 431 _paymentRequest->GetOrCreateCurrencyFormatter(); | 430 _paymentRequest->GetOrCreateCurrencyFormatter(); |
| 432 item.detailText = SysUTF16ToNSString( | 431 item.detailText = SysUTF16ToNSString( |
| 433 currencyFormatter->Format(base::UTF16ToASCII(option->amount.value))); | 432 currencyFormatter->Format(base::UTF16ToASCII(option->amount.value))); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; | 559 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; |
| 561 if (type == ItemTypeSummaryTotal && | 560 if (type == ItemTypeSummaryTotal && |
| 562 _paymentRequest->payment_details().display_items.empty()) { | 561 _paymentRequest->payment_details().display_items.empty()) { |
| 563 return YES; | 562 return YES; |
| 564 } else { | 563 } else { |
| 565 return NO; | 564 return NO; |
| 566 } | 565 } |
| 567 } | 566 } |
| 568 | 567 |
| 569 @end | 568 @end |
| OLD | NEW |