| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/autofill/form_suggestion_label.h" | 5 #import "ios/chrome/browser/autofill/form_suggestion_label.h" |
| 6 | 6 |
| 7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Structure that record the image for each icon. | 46 // Structure that record the image for each icon. |
| 47 struct IconImageMap { | 47 struct IconImageMap { |
| 48 const char* const icon_name; | 48 const char* const icon_name; |
| 49 NSString* image_name; | 49 NSString* image_name; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 const IconImageMap kCreditCardIconImageMap[] = { | 52 const IconImageMap kCreditCardIconImageMap[] = { |
| 53 {autofill::kAmericanExpressCard, @"autofill_card_american_express"}, | 53 {autofill::kAmericanExpressCard, @"autofill_card_american_express"}, |
| 54 {autofill::kDiscoverCard, @"autofill_card_discover"}, | 54 {autofill::kDiscoverCard, @"autofill_card_discover"}, |
| 55 {autofill::kMasterCard, @"autofill_card_mastercard"}, | 55 {autofill::kMasterCard, @"autofill_card_mastercard"}, |
| 56 {autofill::kMirCard, @"autofill_card_mir"}, |
| 56 {autofill::kVisaCard, @"autofill_card_visa"}, | 57 {autofill::kVisaCard, @"autofill_card_visa"}, |
| 57 {autofill::kDinersCard, @"autofill_card_diners"}, | 58 {autofill::kDinersCard, @"autofill_card_diners"}, |
| 58 {autofill::kGenericCard, @"autofill_card_generic"}, | 59 {autofill::kGenericCard, @"autofill_card_generic"}, |
| 59 {autofill::kJCBCard, @"autofill_card_jcb"}, | 60 {autofill::kJCBCard, @"autofill_card_jcb"}, |
| 60 {autofill::kUnionPay, @"autofill_card_unionpay"}, | 61 {autofill::kUnionPay, @"autofill_card_unionpay"}, |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 // Creates a label with the given |text| and |alpha| suitable for use in a | 64 // Creates a label with the given |text| and |alpha| suitable for use in a |
| 64 // suggestion button in the keyboard accessory view. | 65 // suggestion button in the keyboard accessory view. |
| 65 UILabel* TextLabel(NSString* text, CGFloat alpha, BOOL bold) { | 66 UILabel* TextLabel(NSString* text, CGFloat alpha, BOOL bold) { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 std::string iconName(base::SysNSStringToUTF8(icon)); | 197 std::string iconName(base::SysNSStringToUTF8(icon)); |
| 197 for (size_t i = 0; i < arraysize(kCreditCardIconImageMap); ++i) { | 198 for (size_t i = 0; i < arraysize(kCreditCardIconImageMap); ++i) { |
| 198 if (iconName.compare(kCreditCardIconImageMap[i].icon_name) == 0) { | 199 if (iconName.compare(kCreditCardIconImageMap[i].icon_name) == 0) { |
| 199 return kCreditCardIconImageMap[i].image_name; | 200 return kCreditCardIconImageMap[i].image_name; |
| 200 } | 201 } |
| 201 } | 202 } |
| 202 return nil; | 203 return nil; |
| 203 } | 204 } |
| 204 | 205 |
| 205 @end | 206 @end |
| OLD | NEW |