Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Unified Diff: components/autofill/core/browser/phone_number.cc

Issue 1623803002: [Autofill] Fix phone upload bug. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed metrics tests Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/autofill/core/browser/autofill_metrics_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « components/autofill/core/browser/autofill_metrics_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698