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

Side by Side Diff: components/autofill/ios/browser/credit_card_util.mm

Issue 1540423004: Add card details and legal message to Android save credit card infobar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Justin's nits. Created 4 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "components/autofill/ios/browser/credit_card_util.h" 5 #include "components/autofill/ios/browser/credit_card_util.h"
6 6
7 #include "base/strings/sys_string_conversions.h" 7 #include "base/strings/sys_string_conversions.h"
8 #include "components/autofill/core/browser/autofill_type.h" 8 #include "components/autofill/core/browser/autofill_type.h"
9 #include "components/autofill/core/browser/credit_card.h" 9 #include "components/autofill/core/browser/credit_card.h"
10 10
11 namespace autofill { 11 namespace autofill {
12 12
13 NSString* GetCreditCardName(const CreditCard& credit_card, 13 NSString* GetCreditCardName(const CreditCard& credit_card,
14 const std::string& locale) { 14 const std::string& locale) {
15 return base::SysUTF16ToNSString(credit_card.GetInfo( 15 return base::SysUTF16ToNSString(credit_card.GetInfo(
16 autofill::AutofillType(autofill::CREDIT_CARD_NAME), locale)); 16 autofill::AutofillType(autofill::CREDIT_CARD_NAME), locale));
17 } 17 }
18 18
19 NSString* GetCreditCardObfuscatedNumber(const CreditCard& credit_card) { 19 NSString* GetCreditCardObfuscatedNumber(const CreditCard& credit_card) {
20 return base::SysUTF16ToNSString(credit_card.TypeAndLastFourDigits()); 20 return base::SysUTF16ToNSString(
21 credit_card.TypeAndLastFourDigitsForDisplay());
21 } 22 }
22 23
23 NSDateComponents* GetCreditCardExpirationDate(const CreditCard& credit_card) { 24 NSDateComponents* GetCreditCardExpirationDate(const CreditCard& credit_card) {
24 NSDateComponents* expiration_date = 25 NSDateComponents* expiration_date =
25 [[[NSDateComponents alloc] init] autorelease]; 26 [[[NSDateComponents alloc] init] autorelease];
26 expiration_date.year = credit_card.expiration_year(); 27 expiration_date.year = credit_card.expiration_year();
27 expiration_date.month = credit_card.expiration_month(); 28 expiration_date.month = credit_card.expiration_month();
28 return expiration_date; 29 return expiration_date;
29 } 30 }
30 31
31 BOOL IsCreditCardLocal(const CreditCard& credit_card) { 32 BOOL IsCreditCardLocal(const CreditCard& credit_card) {
32 return credit_card.record_type() == autofill::CreditCard::LOCAL_CARD; 33 return credit_card.record_type() == autofill::CreditCard::LOCAL_CARD;
33 } 34 }
34 35
35 } // namespace autofill 36 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698