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 #include "components/autofill/core/browser/credit_card.h" | 5 #include "components/autofill/core/browser/credit_card.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 #include <ostream> | 11 #include <ostream> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/guid.h" | 14 #include "base/guid.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/metrics/histogram_macros.h" | 17 #include "base/metrics/histogram_macros.h" |
18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/string_split.h" | 20 #include "base/strings/string_split.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
23 #include "base/time/time.h" | 23 #include "base/time/time.h" |
24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 25 #include "components/autofill/core/browser/autofill_data_util.h" |
25 #include "components/autofill/core/browser/autofill_field.h" | 26 #include "components/autofill/core/browser/autofill_field.h" |
26 #include "components/autofill/core/browser/autofill_type.h" | 27 #include "components/autofill/core/browser/autofill_type.h" |
27 #include "components/autofill/core/browser/validation.h" | 28 #include "components/autofill/core/browser/validation.h" |
28 #include "components/autofill/core/common/autofill_l10n_util.h" | 29 #include "components/autofill/core/common/autofill_l10n_util.h" |
29 #include "components/autofill/core/common/autofill_regexes.h" | 30 #include "components/autofill/core/common/autofill_regexes.h" |
30 #include "components/autofill/core/common/form_field_data.h" | 31 #include "components/autofill/core/common/form_field_data.h" |
31 #include "grit/components_scaled_resources.h" | 32 #include "grit/components_scaled_resources.h" |
32 #include "grit/components_strings.h" | 33 #include "grit/components_strings.h" |
33 #include "third_party/icu/source/common/unicode/uloc.h" | 34 #include "third_party/icu/source/common/unicode/uloc.h" |
34 #include "third_party/icu/source/i18n/unicode/dtfmtsym.h" | 35 #include "third_party/icu/source/i18n/unicode/dtfmtsym.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 DCHECK_NE(LOCAL_CARD, record_type()); | 261 DCHECK_NE(LOCAL_CARD, record_type()); |
261 return server_status_; | 262 return server_status_; |
262 } | 263 } |
263 | 264 |
264 base::string16 CreditCard::GetRawInfo(ServerFieldType type) const { | 265 base::string16 CreditCard::GetRawInfo(ServerFieldType type) const { |
265 DCHECK_EQ(CREDIT_CARD, AutofillType(type).group()); | 266 DCHECK_EQ(CREDIT_CARD, AutofillType(type).group()); |
266 switch (type) { | 267 switch (type) { |
267 case CREDIT_CARD_NAME: | 268 case CREDIT_CARD_NAME: |
268 return name_on_card_; | 269 return name_on_card_; |
269 | 270 |
| 271 case CREDIT_CARD_NAME_FIRST: |
| 272 return data_util::SplitName(name_on_card_).given; |
| 273 |
| 274 case CREDIT_CARD_NAME_LAST: |
| 275 return data_util::SplitName(name_on_card_).family; |
| 276 |
270 case CREDIT_CARD_EXP_MONTH: | 277 case CREDIT_CARD_EXP_MONTH: |
271 return ExpirationMonthAsString(); | 278 return ExpirationMonthAsString(); |
272 | 279 |
273 case CREDIT_CARD_EXP_2_DIGIT_YEAR: | 280 case CREDIT_CARD_EXP_2_DIGIT_YEAR: |
274 return Expiration2DigitYearAsString(); | 281 return Expiration2DigitYearAsString(); |
275 | 282 |
276 case CREDIT_CARD_EXP_4_DIGIT_YEAR: | 283 case CREDIT_CARD_EXP_4_DIGIT_YEAR: |
277 return Expiration4DigitYearAsString(); | 284 return Expiration4DigitYearAsString(); |
278 | 285 |
279 case CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR: { | 286 case CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR: { |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 const char kAmericanExpressCard[] = "americanExpressCC"; | 795 const char kAmericanExpressCard[] = "americanExpressCC"; |
789 const char kDinersCard[] = "dinersCC"; | 796 const char kDinersCard[] = "dinersCC"; |
790 const char kDiscoverCard[] = "discoverCC"; | 797 const char kDiscoverCard[] = "discoverCC"; |
791 const char kGenericCard[] = "genericCC"; | 798 const char kGenericCard[] = "genericCC"; |
792 const char kJCBCard[] = "jcbCC"; | 799 const char kJCBCard[] = "jcbCC"; |
793 const char kMasterCard[] = "masterCardCC"; | 800 const char kMasterCard[] = "masterCardCC"; |
794 const char kUnionPay[] = "unionPayCC"; | 801 const char kUnionPay[] = "unionPayCC"; |
795 const char kVisaCard[] = "visaCC"; | 802 const char kVisaCard[] = "visaCC"; |
796 | 803 |
797 } // namespace autofill | 804 } // namespace autofill |
OLD | NEW |