| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/autofill/credit_card.h" | 5 #include "chrome/browser/autofill/credit_card.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 CreditCard::CreditCard(const CreditCard& card) : FormGroup() { | 36 CreditCard::CreditCard(const CreditCard& card) : FormGroup() { |
| 37 operator=(card); | 37 operator=(card); |
| 38 } | 38 } |
| 39 | 39 |
| 40 CreditCard::CreditCard() | 40 CreditCard::CreditCard() |
| 41 : expiration_month_(0), | 41 : expiration_month_(0), |
| 42 expiration_year_(0) { | 42 expiration_year_(0) { |
| 43 } | 43 } |
| 44 | 44 |
| 45 | |
| 46 FormGroup* CreditCard::Clone() const { | 45 FormGroup* CreditCard::Clone() const { |
| 47 return new CreditCard(*this); | 46 return new CreditCard(*this); |
| 48 } | 47 } |
| 49 | 48 |
| 50 void CreditCard::GetPossibleFieldTypes(const string16& text, | 49 void CreditCard::GetPossibleFieldTypes(const string16& text, |
| 51 FieldTypeSet* possible_types) const { | 50 FieldTypeSet* possible_types) const { |
| 52 if (IsNameOnCard(text)) | 51 if (IsNameOnCard(text)) |
| 53 possible_types->insert(CREDIT_CARD_NAME); | 52 possible_types->insert(CREDIT_CARD_NAME); |
| 54 | 53 |
| 55 if (IsCreditCardNumber(text)) | 54 if (IsCreditCardNumber(text)) |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 317 |
| 319 for (size_t index = 0; index < arraysize(types); ++index) { | 318 for (size_t index = 0; index < arraysize(types); ++index) { |
| 320 if (GetFieldText(AutoFillType(types[index])) != | 319 if (GetFieldText(AutoFillType(types[index])) != |
| 321 creditcard.GetFieldText(AutoFillType(types[index]))) | 320 creditcard.GetFieldText(AutoFillType(types[index]))) |
| 322 return false; | 321 return false; |
| 323 } | 322 } |
| 324 | 323 |
| 325 return true; | 324 return true; |
| 326 } | 325 } |
| 327 | 326 |
| 327 bool CreditCard::operator!=(const CreditCard& creditcard) const { |
| 328 return !operator==(creditcard); |
| 329 } |
| 330 |
| 328 bool CreditCard::FindInfoMatchesHelper(const AutoFillFieldType& field_type, | 331 bool CreditCard::FindInfoMatchesHelper(const AutoFillFieldType& field_type, |
| 329 const string16& info, | 332 const string16& info, |
| 330 string16* match) const { | 333 string16* match) const { |
| 331 if (match == NULL) { | 334 if (match == NULL) { |
| 332 DLOG(ERROR) << "NULL match string passed in"; | 335 DLOG(ERROR) << "NULL match string passed in"; |
| 333 return false; | 336 return false; |
| 334 } | 337 } |
| 335 | 338 |
| 336 match->clear(); | 339 match->clear(); |
| 337 switch (field_type) { | 340 switch (field_type) { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 << " " | 489 << " " |
| 487 << UTF16ToUTF8(creditcard.GetFieldText( | 490 << UTF16ToUTF8(creditcard.GetFieldText( |
| 488 AutoFillType(CREDIT_CARD_VERIFICATION_CODE))) | 491 AutoFillType(CREDIT_CARD_VERIFICATION_CODE))) |
| 489 << " " | 492 << " " |
| 490 << UTF16ToUTF8(creditcard.GetFieldText( | 493 << UTF16ToUTF8(creditcard.GetFieldText( |
| 491 AutoFillType(CREDIT_CARD_EXP_MONTH))) | 494 AutoFillType(CREDIT_CARD_EXP_MONTH))) |
| 492 << " " | 495 << " " |
| 493 << UTF16ToUTF8(creditcard.GetFieldText( | 496 << UTF16ToUTF8(creditcard.GetFieldText( |
| 494 AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR))); | 497 AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR))); |
| 495 } | 498 } |
| OLD | NEW |