| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_comparator.h" | 5 #include "components/autofill/core/browser/autofill_profile_comparator.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/i18n/case_conversion.h" | 10 #include "base/i18n/case_conversion.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 VLOG(1) << "n1 = {" << n1 << "}"; | 302 VLOG(1) << "n1 = {" << n1 << "}"; |
| 303 VLOG(1) << "n2 = {" << n2 << "}"; | 303 VLOG(1) << "n2 = {" << n2 << "}"; |
| 304 VLOG(1) << "merged_number = {" << merged_number << "}"; | 304 VLOG(1) << "merged_number = {" << merged_number << "}"; |
| 305 VLOG(1) << "new_number = \"" << new_number << "\""; | 305 VLOG(1) << "new_number = \"" << new_number << "\""; |
| 306 | 306 |
| 307 // Check if it's a North American number that's missing the area code. | 307 // Check if it's a North American number that's missing the area code. |
| 308 // Libphonenumber doesn't know how to format short numbers; it will still | 308 // Libphonenumber doesn't know how to format short numbers; it will still |
| 309 // include the country code prefix. | 309 // include the country code prefix. |
| 310 if (merged_number.country_code() == 1 && | 310 if (merged_number.country_code() == 1 && |
| 311 merged_number.national_number() <= 9999999 && | 311 merged_number.national_number() <= 9999999 && |
| 312 new_number.find("+1") == 0) { | 312 base::StartsWith(new_number, "+1", base::CompareCase::SENSITIVE)) { |
| 313 size_t offset = 2; // The char just after "+1". | 313 size_t offset = 2; // The char just after "+1". |
| 314 while (offset < new_number.size() && | 314 while (offset < new_number.size() && |
| 315 base::IsAsciiWhitespace(new_number[offset])) { | 315 base::IsAsciiWhitespace(new_number[offset])) { |
| 316 ++offset; | 316 ++offset; |
| 317 } | 317 } |
| 318 new_number = new_number.substr(offset); | 318 new_number = new_number.substr(offset); |
| 319 } | 319 } |
| 320 | 320 |
| 321 phone_number->SetRawInfo(kWholePhoneNumber, UTF8ToUTF16(new_number)); | 321 phone_number->SetRawInfo(kWholePhoneNumber, UTF8ToUTF16(new_number)); |
| 322 | 322 |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 const base::string16& address2 = rewriter.Rewrite(NormalizeForComparison( | 741 const base::string16& address2 = rewriter.Rewrite(NormalizeForComparison( |
| 742 p2.GetInfo(AutofillType(ADDRESS_HOME_STREET_ADDRESS), app_locale_))); | 742 p2.GetInfo(AutofillType(ADDRESS_HOME_STREET_ADDRESS), app_locale_))); |
| 743 if (CompareTokens(address1, address2) == DIFFERENT_TOKENS) { | 743 if (CompareTokens(address1, address2) == DIFFERENT_TOKENS) { |
| 744 return false; | 744 return false; |
| 745 } | 745 } |
| 746 | 746 |
| 747 return true; | 747 return true; |
| 748 } | 748 } |
| 749 | 749 |
| 750 } // namespace autofill | 750 } // namespace autofill |
| OLD | NEW |