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

Side by Side Diff: ios/chrome/browser/ui/settings/autofill_credit_card_edit_collection_view_controller.mm

Issue 2844463004: Rename card 'type' into 'issuer network.' (Closed)
Patch Set: read -> use Created 3 years, 8 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 #import "ios/chrome/browser/ui/settings/autofill_credit_card_edit_collection_vie w_controller.h" 5 #import "ios/chrome/browser/ui/settings/autofill_credit_card_edit_collection_vie w_controller.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #import "base/ios/block_types.h" 8 #import "base/ios/block_types.h"
9 #import "base/mac/foundation_util.h" 9 #import "base/mac/foundation_util.h"
10 #include "base/mac/scoped_block.h" 10 #include "base/mac/scoped_block.h"
(...skipping 25 matching lines...) Expand all
36 #if !defined(__has_feature) || !__has_feature(objc_arc) 36 #if !defined(__has_feature) || !__has_feature(objc_arc)
37 #error "This file requires ARC support." 37 #error "This file requires ARC support."
38 #endif 38 #endif
39 39
40 namespace { 40 namespace {
41 using ::AutofillTypeFromAutofillUIType; 41 using ::AutofillTypeFromAutofillUIType;
42 42
43 NSString* const kAutofillCreditCardEditCollectionViewId = 43 NSString* const kAutofillCreditCardEditCollectionViewId =
44 @"kAutofillCreditCardEditCollectionViewId"; 44 @"kAutofillCreditCardEditCollectionViewId";
45 45
46 const CGFloat kCardTypeIconDimension = 30.0; 46 const CGFloat kCardIssuerNetworkIconDimension = 30.0;
47 47
48 typedef NS_ENUM(NSInteger, SectionIdentifier) { 48 typedef NS_ENUM(NSInteger, SectionIdentifier) {
49 SectionIdentifierFields = kSectionIdentifierEnumZero, 49 SectionIdentifierFields = kSectionIdentifierEnumZero,
50 SectionIdentifierCopiedToChrome, 50 SectionIdentifierCopiedToChrome,
51 }; 51 };
52 52
53 typedef NS_ENUM(NSInteger, ItemType) { 53 typedef NS_ENUM(NSInteger, ItemType) {
54 ItemTypeCardholderName = kItemTypeEnumZero, 54 ItemTypeCardholderName = kItemTypeEnumZero,
55 ItemTypeCardNumber, 55 ItemTypeCardNumber,
56 ItemTypeExpirationMonth, 56 ItemTypeExpirationMonth,
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 311
312 // Reset the copy of the card data used for display immediately. 312 // Reset the copy of the card data used for display immediately.
313 _creditCard.set_record_type(autofill::CreditCard::MASKED_SERVER_CARD); 313 _creditCard.set_record_type(autofill::CreditCard::MASKED_SERVER_CARD);
314 _creditCard.SetNumber(_creditCard.LastFourDigits()); 314 _creditCard.SetNumber(_creditCard.LastFourDigits());
315 [self reloadData]; 315 [self reloadData];
316 } 316 }
317 317
318 #pragma mark - Helper Methods 318 #pragma mark - Helper Methods
319 319
320 - (UIImage*)cardTypeIconFromCardNumber:(NSString*)cardNumber { 320 - (UIImage*)cardTypeIconFromCardNumber:(NSString*)cardNumber {
321 const char* cardType = autofill::CreditCard::GetCreditCardType( 321 const char* network = autofill::CreditCard::GetCardNetwork(
322 base::SysNSStringToUTF16(cardNumber)); 322 base::SysNSStringToUTF16(cardNumber));
323 if (cardType != autofill::kGenericCard) { 323 if (network != autofill::kGenericCard) {
324 int resourceID = 324 int resourceID =
325 autofill::data_util::GetPaymentRequestData(cardType).icon_resource_id; 325 autofill::data_util::GetPaymentRequestData(network).icon_resource_id;
326 // Resize and set the card type icon. 326 // Resize and set the card issuer network icon.
327 CGFloat dimension = kCardTypeIconDimension; 327 CGFloat dimension = kCardIssuerNetworkIconDimension;
328 return ResizeImage(NativeImage(resourceID), 328 return ResizeImage(NativeImage(resourceID),
329 CGSizeMake(dimension, dimension), 329 CGSizeMake(dimension, dimension),
330 ProjectionMode::kAspectFillNoClipping); 330 ProjectionMode::kAspectFillNoClipping);
331 } else { 331 } else {
332 return nil; 332 return nil;
333 } 333 }
334 } 334 }
335 335
336 @end 336 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698