Index: components/autofill/core/browser/phone_number_i18n.cc |
diff --git a/components/autofill/core/browser/phone_number_i18n.cc b/components/autofill/core/browser/phone_number_i18n.cc |
index 10a71d6a7964a22a831e27001a86c657503156b2..246c5eb46ff85bd73f1987b8f611c4dca8598176 100644 |
--- a/components/autofill/core/browser/phone_number_i18n.cc |
+++ b/components/autofill/core/browser/phone_number_i18n.cc |
@@ -65,12 +65,24 @@ void FormatValidatedNumber(const PhoneNumber& number, |
std::string processed_number; |
phone_util->Format(number, format, &processed_number); |
+ std::string region_code; |
+ phone_util->GetRegionCodeForNumber(number, ®ion_code); |
+ |
+ // Drop the leading '+' for US numbers as some US sites can't handle the "+", |
+ // and in the US dialing "+1..." is the same as dialing "1...". |
+ std::string prefix; |
+ if (processed_number[0] == '+') { |
+ processed_number = processed_number.substr(1); |
+ if (region_code != "US") |
+ prefix = "+"; |
+ } |
+ |
if (formatted_number) |
- *formatted_number = base::UTF8ToUTF16(processed_number); |
+ *formatted_number = base::UTF8ToUTF16(prefix + processed_number); |
if (normalized_number) { |
phone_util->NormalizeDigitsOnly(&processed_number); |
- *normalized_number = base::UTF8ToUTF16(processed_number); |
+ *normalized_number = base::UTF8ToUTF16(prefix + processed_number); |
} |
} |