Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: ios/chrome/browser/ui/payments/payment_request_view_controller.mm

Issue 2907883002: Revert of Fixes formatting of the signed-in setting string on iOS. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
11 #include "components/autofill/core/browser/autofill_data_util.h" 12 #include "components/autofill/core/browser/autofill_data_util.h"
12 #include "components/autofill/core/browser/autofill_profile.h" 13 #include "components/autofill/core/browser/autofill_profile.h"
13 #include "components/autofill/core/browser/credit_card.h" 14 #include "components/autofill/core/browser/credit_card.h"
14 #include "components/autofill/core/browser/field_types.h" 15 #include "components/autofill/core/browser/field_types.h"
15 #include "components/autofill/core/browser/personal_data_manager.h" 16 #include "components/autofill/core/browser/personal_data_manager.h"
16 #include "components/payments/core/currency_formatter.h" 17 #include "components/payments/core/currency_formatter.h"
17 #include "components/payments/core/strings_util.h" 18 #include "components/payments/core/strings_util.h"
18 #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
369 toSectionWithIdentifier:SectionIdentifierContactInfo]; 370 toSectionWithIdentifier:SectionIdentifierContactInfo];
370 371
371 // Footer Text section. 372 // Footer Text section.
372 [model addSectionWithIdentifier:SectionIdentifierFooter]; 373 [model addSectionWithIdentifier:SectionIdentifierFooter];
373 CollectionViewFooterItem* footer = 374 CollectionViewFooterItem* footer =
374 [[CollectionViewFooterItem alloc] initWithType:ItemTypeFooterText]; 375 [[CollectionViewFooterItem alloc] initWithType:ItemTypeFooterText];
375 if (!_showPaymentDataSource) { 376 if (!_showPaymentDataSource) {
376 footer.text = 377 footer.text =
377 l10n_util::GetNSString(IDS_PAYMENTS_CARD_AND_ADDRESS_SETTINGS); 378 l10n_util::GetNSString(IDS_PAYMENTS_CARD_AND_ADDRESS_SETTINGS);
378 } else if ([[_dataSource authenticatedAccountName] length]) { 379 } else if ([[_dataSource authenticatedAccountName] length]) {
379 const base::string16 accountName = 380 const std::string unformattedString = l10n_util::GetStringUTF8(
380 base::SysNSStringToUTF16([_dataSource authenticatedAccountName]); 381 IDS_PAYMENTS_CARD_AND_ADDRESS_SETTINGS_SIGNED_IN);
381 const std::string formattedString = l10n_util::GetStringFUTF8( 382 const std::string accountName =
382 IDS_PAYMENTS_CARD_AND_ADDRESS_SETTINGS_SIGNED_IN, accountName); 383 base::SysNSStringToUTF8([_dataSource authenticatedAccountName]);
384 const std::string formattedString =
385 base::StringPrintf(unformattedString.c_str(), accountName.c_str());
383 footer.text = base::SysUTF8ToNSString(formattedString); 386 footer.text = base::SysUTF8ToNSString(formattedString);
384 } else { 387 } else {
385 footer.text = l10n_util::GetNSString( 388 footer.text = l10n_util::GetNSString(
386 IDS_PAYMENTS_CARD_AND_ADDRESS_SETTINGS_SIGNED_OUT); 389 IDS_PAYMENTS_CARD_AND_ADDRESS_SETTINGS_SIGNED_OUT);
387 } 390 }
388 footer.linkURL = GURL(kSettingsURL); 391 footer.linkURL = GURL(kSettingsURL);
389 footer.linkDelegate = self; 392 footer.linkDelegate = self;
390 [model addItem:footer toSectionWithIdentifier:SectionIdentifierFooter]; 393 [model addItem:footer toSectionWithIdentifier:SectionIdentifierFooter];
391 } 394 }
392 395
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 621
619 - (BOOL)collectionView:(UICollectionView*)collectionView 622 - (BOOL)collectionView:(UICollectionView*)collectionView
620 shouldHideItemBackgroundAtIndexPath:(NSIndexPath*)indexPath { 623 shouldHideItemBackgroundAtIndexPath:(NSIndexPath*)indexPath {
621 // No background on the footer text item. 624 // No background on the footer text item.
622 NSInteger sectionIdentifier = 625 NSInteger sectionIdentifier =
623 [self.collectionViewModel sectionIdentifierForSection:indexPath.section]; 626 [self.collectionViewModel sectionIdentifierForSection:indexPath.section];
624 return sectionIdentifier == SectionIdentifierFooter ? YES : NO; 627 return sectionIdentifier == SectionIdentifierFooter ? YES : NO;
625 } 628 }
626 629
627 @end 630 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/payments/BUILD.gn ('k') | ios/chrome/browser/ui/payments/payment_request_view_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698