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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 | 665 |
666 // The value of the stored data for this field type in the |credit_card|. | 666 // The value of the stored data for this field type in the |credit_card|. |
667 base::string16 creditcard_field_value = | 667 base::string16 creditcard_field_value = |
668 credit_card->GetInfo(type, app_locale_); | 668 credit_card->GetInfo(type, app_locale_); |
669 if (!creditcard_field_value.empty() && | 669 if (!creditcard_field_value.empty() && |
670 StartsWith(creditcard_field_value, field_contents, false)) { | 670 StartsWith(creditcard_field_value, field_contents, false)) { |
671 if (type.GetStorableType() == CREDIT_CARD_NUMBER) | 671 if (type.GetStorableType() == CREDIT_CARD_NUMBER) |
672 creditcard_field_value = credit_card->ObfuscatedNumber(); | 672 creditcard_field_value = credit_card->ObfuscatedNumber(); |
673 | 673 |
674 base::string16 label; | 674 base::string16 label; |
675 if (credit_card->number().empty()) { | 675 if (credit_card->GetNumber().empty()) { |
676 // If there is no CC number, return name to show something. | 676 // If there is no CC number, return name to show something. |
677 label = | 677 label = |
678 credit_card->GetInfo(AutofillType(CREDIT_CARD_NAME), app_locale_); | 678 credit_card->GetInfo(AutofillType(CREDIT_CARD_NAME), app_locale_); |
679 } else { | 679 } else { |
680 label = kCreditCardPrefix; | 680 label = kCreditCardPrefix; |
681 label.append(credit_card->LastFourDigits()); | 681 label.append(credit_card->LastFourDigits()); |
682 } | 682 } |
683 | 683 |
684 values->push_back(creditcard_field_value); | 684 values->push_back(creditcard_field_value); |
685 labels->push_back(label); | 685 labels->push_back(label); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 return guid; | 1006 return guid; |
1007 } | 1007 } |
1008 | 1008 |
1009 void PersonalDataManager::NotifyPersonalDataChanged() { | 1009 void PersonalDataManager::NotifyPersonalDataChanged() { |
1010 FOR_EACH_OBSERVER(PersonalDataManagerObserver, observers_, | 1010 FOR_EACH_OBSERVER(PersonalDataManagerObserver, observers_, |
1011 OnPersonalDataChanged()); | 1011 OnPersonalDataChanged()); |
1012 } | 1012 } |
1013 | 1013 |
1014 std::string PersonalDataManager::SaveImportedCreditCard( | 1014 std::string PersonalDataManager::SaveImportedCreditCard( |
1015 const CreditCard& imported_card) { | 1015 const CreditCard& imported_card) { |
1016 DCHECK(!imported_card.number().empty()); | 1016 DCHECK(!imported_card.GetNumber().empty()); |
1017 if (is_off_the_record_) | 1017 if (is_off_the_record_) |
1018 return std::string(); | 1018 return std::string(); |
1019 | 1019 |
1020 // Set to true if |imported_card| is merged into the credit card list. | 1020 // Set to true if |imported_card| is merged into the credit card list. |
1021 bool merged = false; | 1021 bool merged = false; |
1022 | 1022 |
1023 std::string guid = imported_card.guid(); | 1023 std::string guid = imported_card.guid(); |
1024 std::vector<CreditCard> credit_cards; | 1024 std::vector<CreditCard> credit_cards; |
1025 for (std::vector<CreditCard*>::const_iterator iter = credit_cards_.begin(); | 1025 for (std::vector<CreditCard*>::const_iterator iter = credit_cards_.begin(); |
1026 iter != credit_cards_.end(); | 1026 iter != credit_cards_.end(); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 // Populates |auxiliary_profiles_|. | 1102 // Populates |auxiliary_profiles_|. |
1103 LoadAuxiliaryProfiles(record_metrics); | 1103 LoadAuxiliaryProfiles(record_metrics); |
1104 | 1104 |
1105 profiles_.insert(profiles_.end(), web_profiles_.begin(), web_profiles_.end()); | 1105 profiles_.insert(profiles_.end(), web_profiles_.begin(), web_profiles_.end()); |
1106 profiles_.insert( | 1106 profiles_.insert( |
1107 profiles_.end(), auxiliary_profiles_.begin(), auxiliary_profiles_.end()); | 1107 profiles_.end(), auxiliary_profiles_.begin(), auxiliary_profiles_.end()); |
1108 return profiles_; | 1108 return profiles_; |
1109 } | 1109 } |
1110 | 1110 |
1111 } // namespace autofill | 1111 } // namespace autofill |
OLD | NEW |