| 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/autofill_profile.h" | 5 #include "components/autofill/core/browser/autofill_profile.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <ostream> | 10 #include <ostream> |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 // of |this|. Likewise, ignore the compound "street address" type, as we | 475 // of |this|. Likewise, ignore the compound "street address" type, as we |
| 476 // are only interested in matching line-by-line. | 476 // are only interested in matching line-by-line. |
| 477 continue; | 477 continue; |
| 478 } else if (AutofillType(*it).group() == PHONE_HOME) { | 478 } else if (AutofillType(*it).group() == PHONE_HOME) { |
| 479 // Phone numbers should be canonicalized prior to being compared. | 479 // Phone numbers should be canonicalized prior to being compared. |
| 480 if (*it != PHONE_HOME_WHOLE_NUMBER) { | 480 if (*it != PHONE_HOME_WHOLE_NUMBER) { |
| 481 continue; | 481 continue; |
| 482 } else if (!i18n::PhoneNumbersMatch( | 482 } else if (!i18n::PhoneNumbersMatch( |
| 483 GetRawInfo(*it), | 483 GetRawInfo(*it), |
| 484 profile.GetRawInfo(*it), | 484 profile.GetRawInfo(*it), |
| 485 UTF16ToASCII(GetRawInfo(ADDRESS_HOME_COUNTRY)), | 485 base::UTF16ToASCII(GetRawInfo(ADDRESS_HOME_COUNTRY)), |
| 486 app_locale)) { | 486 app_locale)) { |
| 487 return false; | 487 return false; |
| 488 } | 488 } |
| 489 } else if (StringToLowerASCII(GetRawInfo(*it)) != | 489 } else if (StringToLowerASCII(GetRawInfo(*it)) != |
| 490 StringToLowerASCII(profile.GetRawInfo(*it))) { | 490 StringToLowerASCII(profile.GetRawInfo(*it))) { |
| 491 return false; | 491 return false; |
| 492 } | 492 } |
| 493 } | 493 } |
| 494 | 494 |
| 495 return true; | 495 return true; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 } | 643 } |
| 644 } | 644 } |
| 645 | 645 |
| 646 void AutofillProfile::AddPhoneIfUnique( | 646 void AutofillProfile::AddPhoneIfUnique( |
| 647 const base::string16& phone, | 647 const base::string16& phone, |
| 648 const std::string& app_locale, | 648 const std::string& app_locale, |
| 649 std::vector<base::string16>* existing_phones) { | 649 std::vector<base::string16>* existing_phones) { |
| 650 DCHECK(existing_phones); | 650 DCHECK(existing_phones); |
| 651 // Phones allow "fuzzy" matching, so "1-800-FLOWERS", "18003569377", | 651 // Phones allow "fuzzy" matching, so "1-800-FLOWERS", "18003569377", |
| 652 // "(800)356-9377" and "356-9377" are considered the same. | 652 // "(800)356-9377" and "356-9377" are considered the same. |
| 653 std::string country_code = UTF16ToASCII(GetRawInfo(ADDRESS_HOME_COUNTRY)); | 653 std::string country_code = |
| 654 base::UTF16ToASCII(GetRawInfo(ADDRESS_HOME_COUNTRY)); |
| 654 if (std::find_if(existing_phones->begin(), existing_phones->end(), | 655 if (std::find_if(existing_phones->begin(), existing_phones->end(), |
| 655 FindByPhone(phone, country_code, app_locale)) == | 656 FindByPhone(phone, country_code, app_locale)) == |
| 656 existing_phones->end()) { | 657 existing_phones->end()) { |
| 657 existing_phones->push_back(phone); | 658 existing_phones->push_back(phone); |
| 658 } | 659 } |
| 659 } | 660 } |
| 660 | 661 |
| 661 base::string16 AutofillProfile::ConstructInferredLabel( | 662 base::string16 AutofillProfile::ConstructInferredLabel( |
| 662 const std::vector<ServerFieldType>& included_fields, | 663 const std::vector<ServerFieldType>& included_fields, |
| 663 size_t num_fields_to_use) const { | 664 size_t num_fields_to_use) const { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) | 842 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) |
| 842 << " " | 843 << " " |
| 843 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) | 844 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) |
| 844 << " " | 845 << " " |
| 845 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) | 846 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) |
| 846 << " " | 847 << " " |
| 847 << UTF16ToUTF8(MultiString(profile, PHONE_HOME_WHOLE_NUMBER)); | 848 << UTF16ToUTF8(MultiString(profile, PHONE_HOME_WHOLE_NUMBER)); |
| 848 } | 849 } |
| 849 | 850 |
| 850 } // namespace autofill | 851 } // namespace autofill |
| OLD | NEW |