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

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

Issue 2849533003: [ObjC ARC] Converts components/autofill/ios/browser:browser to ARC. (Closed)
Patch Set: Address comments Created 3 years, 7 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 #if !defined(__has_feature) || !__has_feature(objc_arc)
12 #error "This file requires ARC support."
13 #endif
14
11 namespace autofill { 15 namespace autofill {
12 16
13 NSString* GetCreditCardName(const CreditCard& credit_card, 17 NSString* GetCreditCardName(const CreditCard& credit_card,
14 const std::string& locale) { 18 const std::string& locale) {
15 return base::SysUTF16ToNSString(credit_card.GetInfo( 19 return base::SysUTF16ToNSString(credit_card.GetInfo(
16 autofill::AutofillType(autofill::CREDIT_CARD_NAME_FULL), locale)); 20 autofill::AutofillType(autofill::CREDIT_CARD_NAME_FULL), locale));
17 } 21 }
18 22
19 NSString* GetCreditCardObfuscatedNumber(const CreditCard& credit_card) { 23 NSString* GetCreditCardObfuscatedNumber(const CreditCard& credit_card) {
20 return base::SysUTF16ToNSString(credit_card.TypeAndLastFourDigits()); 24 return base::SysUTF16ToNSString(credit_card.TypeAndLastFourDigits());
21 } 25 }
22 26
23 NSDateComponents* GetCreditCardExpirationDate(const CreditCard& credit_card) { 27 NSDateComponents* GetCreditCardExpirationDate(const CreditCard& credit_card) {
24 NSDateComponents* expiration_date = 28 NSDateComponents* expiration_date = [[NSDateComponents alloc] init];
25 [[[NSDateComponents alloc] init] autorelease];
26 expiration_date.year = credit_card.expiration_year(); 29 expiration_date.year = credit_card.expiration_year();
27 expiration_date.month = credit_card.expiration_month(); 30 expiration_date.month = credit_card.expiration_month();
28 return expiration_date; 31 return expiration_date;
29 } 32 }
30 33
31 BOOL IsCreditCardLocal(const CreditCard& credit_card) { 34 BOOL IsCreditCardLocal(const CreditCard& credit_card) {
32 return credit_card.record_type() == autofill::CreditCard::LOCAL_CARD; 35 return credit_card.record_type() == autofill::CreditCard::LOCAL_CARD;
33 } 36 }
34 37
35 } // namespace autofill 38 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698