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/personal_data_manager.h" | 5 #include "components/autofill/core/browser/personal_data_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <iterator> | 9 #include <iterator> |
10 | 10 |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 | 666 |
667 const std::vector<CreditCard*>& credit_cards = GetCreditCards(); | 667 const std::vector<CreditCard*>& credit_cards = GetCreditCards(); |
668 for (std::vector<CreditCard*>::const_iterator iter = credit_cards.begin(); | 668 for (std::vector<CreditCard*>::const_iterator iter = credit_cards.begin(); |
669 iter != credit_cards.end(); ++iter) { | 669 iter != credit_cards.end(); ++iter) { |
670 CreditCard* credit_card = *iter; | 670 CreditCard* credit_card = *iter; |
671 | 671 |
672 // The value of the stored data for this field type in the |credit_card|. | 672 // The value of the stored data for this field type in the |credit_card|. |
673 base::string16 creditcard_field_value = | 673 base::string16 creditcard_field_value = |
674 credit_card->GetInfo(type, app_locale_); | 674 credit_card->GetInfo(type, app_locale_); |
675 if (!creditcard_field_value.empty() && | 675 if (!creditcard_field_value.empty() && |
676 StartsWith(creditcard_field_value, field_contents, false)) { | 676 (StartsWith(creditcard_field_value, field_contents, false) || |
677 if (type.GetStorableType() == CREDIT_CARD_NUMBER) | 677 (type.GetStorableType() == CREDIT_CARD_NUMBER && |
678 creditcard_field_value = credit_card->ObfuscatedNumber(); | 678 base::string16::npos != |
679 | 679 creditcard_field_value.find(field_contents)))) { |
680 // If the value is the card number, the label is the expiration date. | 680 // If the value is the card number, the label is the expiration date. |
681 // Otherwise the label is the card number, or if that is empty the | 681 // Otherwise the label is the card number, or if that is empty the |
682 // cardholder name. The label should never repeat the value. | 682 // cardholder name. The label should never repeat the value. |
683 base::string16 label; | 683 base::string16 label; |
684 if (type.GetStorableType() == CREDIT_CARD_NUMBER) { | 684 if (type.GetStorableType() == CREDIT_CARD_NUMBER) { |
| 685 creditcard_field_value = credit_card->ObfuscatedNumber(); |
685 label = credit_card->GetInfo( | 686 label = credit_card->GetInfo( |
686 AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR), app_locale_); | 687 AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR), app_locale_); |
687 } else if (credit_card->number().empty()) { | 688 } else if (credit_card->number().empty()) { |
688 if (type.GetStorableType() != CREDIT_CARD_NAME) { | 689 if (type.GetStorableType() != CREDIT_CARD_NAME) { |
689 label = | 690 label = |
690 credit_card->GetInfo(AutofillType(CREDIT_CARD_NAME), app_locale_); | 691 credit_card->GetInfo(AutofillType(CREDIT_CARD_NAME), app_locale_); |
691 } | 692 } |
692 } else { | 693 } else { |
693 label = kCreditCardPrefix; | 694 label = kCreditCardPrefix; |
694 label.append(credit_card->LastFourDigits()); | 695 label.append(credit_card->LastFourDigits()); |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 // Populates |auxiliary_profiles_|. | 1117 // Populates |auxiliary_profiles_|. |
1117 LoadAuxiliaryProfiles(record_metrics); | 1118 LoadAuxiliaryProfiles(record_metrics); |
1118 | 1119 |
1119 profiles_.insert(profiles_.end(), web_profiles_.begin(), web_profiles_.end()); | 1120 profiles_.insert(profiles_.end(), web_profiles_.begin(), web_profiles_.end()); |
1120 profiles_.insert( | 1121 profiles_.insert( |
1121 profiles_.end(), auxiliary_profiles_.begin(), auxiliary_profiles_.end()); | 1122 profiles_.end(), auxiliary_profiles_.begin(), auxiliary_profiles_.end()); |
1122 return profiles_; | 1123 return profiles_; |
1123 } | 1124 } |
1124 | 1125 |
1125 } // namespace autofill | 1126 } // namespace autofill |
OLD | NEW |