Chromium Code Reviews| 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/ui/payments/payment_request_view_controller.h" | 5 #import "ios/chrome/browser/ui/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" |
|
please use gerrit instead
2017/05/25 19:42:44
Remove.
macourteau
2017/05/25 19:53:47
Done.
| |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "components/autofill/core/browser/autofill_data_util.h" | 12 #include "components/autofill/core/browser/autofill_data_util.h" |
| 13 #include "components/autofill/core/browser/autofill_profile.h" | 13 #include "components/autofill/core/browser/autofill_profile.h" |
| 14 #include "components/autofill/core/browser/credit_card.h" | 14 #include "components/autofill/core/browser/credit_card.h" |
| 15 #include "components/autofill/core/browser/field_types.h" | 15 #include "components/autofill/core/browser/field_types.h" |
| 16 #include "components/autofill/core/browser/personal_data_manager.h" | 16 #include "components/autofill/core/browser/personal_data_manager.h" |
| 17 #include "components/payments/core/currency_formatter.h" | 17 #include "components/payments/core/currency_formatter.h" |
| 18 #include "components/payments/core/strings_util.h" | 18 #include "components/payments/core/strings_util.h" |
| 19 #include "components/strings/grit/components_strings.h" | 19 #include "components/strings/grit/components_strings.h" |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 toSectionWithIdentifier:SectionIdentifierContactInfo]; | 370 toSectionWithIdentifier:SectionIdentifierContactInfo]; |
| 371 | 371 |
| 372 // Footer Text section. | 372 // Footer Text section. |
| 373 [model addSectionWithIdentifier:SectionIdentifierFooter]; | 373 [model addSectionWithIdentifier:SectionIdentifierFooter]; |
| 374 CollectionViewFooterItem* footer = | 374 CollectionViewFooterItem* footer = |
| 375 [[CollectionViewFooterItem alloc] initWithType:ItemTypeFooterText]; | 375 [[CollectionViewFooterItem alloc] initWithType:ItemTypeFooterText]; |
| 376 if (!_showPaymentDataSource) { | 376 if (!_showPaymentDataSource) { |
| 377 footer.text = | 377 footer.text = |
| 378 l10n_util::GetNSString(IDS_PAYMENTS_CARD_AND_ADDRESS_SETTINGS); | 378 l10n_util::GetNSString(IDS_PAYMENTS_CARD_AND_ADDRESS_SETTINGS); |
| 379 } else if ([[_dataSource authenticatedAccountName] length]) { | 379 } else if ([[_dataSource authenticatedAccountName] length]) { |
| 380 const std::string unformattedString = l10n_util::GetStringUTF8( | 380 const base::string16 accountName = |
| 381 IDS_PAYMENTS_CARD_AND_ADDRESS_SETTINGS_SIGNED_IN); | 381 base::SysNSStringToUTF16([_dataSource authenticatedAccountName]); |
|
please use gerrit instead
2017/05/25 19:42:44
I would be more comfortable with using std::string
macourteau
2017/05/25 19:53:47
There's no variant of GetStringFUTF8 that takes an
| |
| 382 const std::string accountName = | 382 const std::string formattedString = l10n_util::GetStringFUTF8( |
| 383 base::SysNSStringToUTF8([_dataSource authenticatedAccountName]); | 383 IDS_PAYMENTS_CARD_AND_ADDRESS_SETTINGS_SIGNED_IN, accountName); |
| 384 const std::string formattedString = | |
| 385 base::StringPrintf(unformattedString.c_str(), accountName.c_str()); | |
| 386 footer.text = base::SysUTF8ToNSString(formattedString); | 384 footer.text = base::SysUTF8ToNSString(formattedString); |
| 387 } else { | 385 } else { |
| 388 footer.text = l10n_util::GetNSString( | 386 footer.text = l10n_util::GetNSString( |
| 389 IDS_PAYMENTS_CARD_AND_ADDRESS_SETTINGS_SIGNED_OUT); | 387 IDS_PAYMENTS_CARD_AND_ADDRESS_SETTINGS_SIGNED_OUT); |
| 390 } | 388 } |
| 391 footer.linkURL = GURL(kSettingsURL); | 389 footer.linkURL = GURL(kSettingsURL); |
| 392 footer.linkDelegate = self; | 390 footer.linkDelegate = self; |
| 393 [model addItem:footer toSectionWithIdentifier:SectionIdentifierFooter]; | 391 [model addItem:footer toSectionWithIdentifier:SectionIdentifierFooter]; |
| 394 } | 392 } |
| 395 | 393 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 621 | 619 |
| 622 - (BOOL)collectionView:(UICollectionView*)collectionView | 620 - (BOOL)collectionView:(UICollectionView*)collectionView |
| 623 shouldHideItemBackgroundAtIndexPath:(NSIndexPath*)indexPath { | 621 shouldHideItemBackgroundAtIndexPath:(NSIndexPath*)indexPath { |
| 624 // No background on the footer text item. | 622 // No background on the footer text item. |
| 625 NSInteger sectionIdentifier = | 623 NSInteger sectionIdentifier = |
| 626 [self.collectionViewModel sectionIdentifierForSection:indexPath.section]; | 624 [self.collectionViewModel sectionIdentifierForSection:indexPath.section]; |
| 627 return sectionIdentifier == SectionIdentifierFooter ? YES : NO; | 625 return sectionIdentifier == SectionIdentifierFooter ? YES : NO; |
| 628 } | 626 } |
| 629 | 627 |
| 630 @end | 628 @end |
| OLD | NEW |