Chromium Code Reviews| Index: components/autofill/core/browser/phone_number.cc |
| diff --git a/components/autofill/core/browser/phone_number.cc b/components/autofill/core/browser/phone_number.cc |
| index 1952e58568f87dfce82ee1614c7089059b538e79..751c01805921a0f39cddb97901fa65d436fa1404 100644 |
| --- a/components/autofill/core/browser/phone_number.cc |
| +++ b/components/autofill/core/browser/phone_number.cc |
| @@ -164,13 +164,26 @@ void PhoneNumber::GetMatchingTypes(const base::string16& text, |
| matching_types->insert(PHONE_HOME_NUMBER); |
| } |
| + // To match whole phone numbers with the "+" in front of the country code. |
|
Mathieu
2016/01/25 20:32:16
is the + always present?
sebsg
2016/01/26 21:31:07
I put a better comment.
|
| base::string16 whole_number = |
| GetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER), app_locale); |
| if (!whole_number.empty()) { |
| base::string16 normalized_number = |
| i18n::NormalizePhoneNumber(text, GetRegion(*profile_, app_locale)); |
| - if (normalized_number == whole_number) |
| + if (normalized_number == whole_number) { |
|
Mathieu
2016/01/25 20:32:16
revert change to add {}
sebsg
2016/01/26 21:31:07
Done.
|
| matching_types->insert(PHONE_HOME_WHOLE_NUMBER); |
| + } |
| + } |
| + |
| + // If both PHONE_HOME_CITY_AND_NUMBER and PHONE_HOME_WHOLE_NUMBER, it means |
|
Mathieu
2016/01/25 20:32:16
nit: sentence is missing a few words
sebsg
2016/01/26 21:31:07
Done.
|
| + // there is no country code and we should only return |
| + // PHONE_HOME_CITY_AND_NUMBER. |
| + ServerFieldTypeSet::iterator whole_number_iterator = |
| + matching_types->find(PHONE_HOME_WHOLE_NUMBER); |
| + if (whole_number_iterator != matching_types->end() && |
| + matching_types->find(PHONE_HOME_CITY_AND_NUMBER) != |
| + matching_types->end()) { |
| + matching_types->erase(whole_number_iterator); |
| } |
| } |