[email protected] | 7b37fbb | 2011-03-07 16:16:03 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome/browser/autofill/phone_number.h" |
| 6 | |
| 7 | #include "base/basictypes.h" |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 8 | #include "base/string_number_conversions.h" |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 9 | #include "base/string_util.h" |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 10 | #include "base/utf_string_conversions.h" |
[email protected] | 9b435be9 | 2010-03-04 21:20:15 | [diff] [blame] | 11 | #include "chrome/browser/autofill/autofill_profile.h" |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 12 | #include "chrome/browser/autofill/autofill_type.h" |
| 13 | #include "chrome/browser/autofill/field_types.h" |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 14 | #include "chrome/browser/autofill/phone_number_i18n.h" |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 15 | |
[email protected] | 9b435be9 | 2010-03-04 21:20:15 | [diff] [blame] | 16 | namespace { |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 17 | |
[email protected] | 9b435be9 | 2010-03-04 21:20:15 | [diff] [blame] | 18 | const char16 kPhoneNumberSeparators[] = { ' ', '.', '(', ')', '-', 0 }; |
| 19 | |
| 20 | // The number of digits in a phone number. |
| 21 | const size_t kPhoneNumberLength = 7; |
| 22 | |
| 23 | // The number of digits in an area code. |
| 24 | const size_t kPhoneCityCodeLength = 3; |
| 25 | |
[email protected] | 663bd9e | 2011-03-21 01:07:01 | [diff] [blame] | 26 | const AutofillType::FieldTypeSubGroup kAutofillPhoneTypes[] = { |
[email protected] | 7b37fbb | 2011-03-07 16:16:03 | [diff] [blame] | 27 | AutofillType::PHONE_NUMBER, |
| 28 | AutofillType::PHONE_CITY_CODE, |
| 29 | AutofillType::PHONE_COUNTRY_CODE, |
| 30 | AutofillType::PHONE_CITY_AND_NUMBER, |
| 31 | AutofillType::PHONE_WHOLE_NUMBER, |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 32 | }; |
| 33 | |
[email protected] | 663bd9e | 2011-03-21 01:07:01 | [diff] [blame] | 34 | const int kAutofillPhoneLength = arraysize(kAutofillPhoneTypes); |
[email protected] | 9b435be9 | 2010-03-04 21:20:15 | [diff] [blame] | 35 | |
| 36 | } // namespace |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 37 | |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 38 | PhoneNumber::PhoneNumber() |
| 39 | : phone_group_(AutofillType::NO_GROUP) { |
| 40 | } |
| 41 | |
| 42 | PhoneNumber::PhoneNumber(AutofillType::FieldTypeGroup phone_group) |
| 43 | : phone_group_(phone_group) { |
| 44 | } |
[email protected] | 8e38341 | 2010-10-19 16:57:03 | [diff] [blame] | 45 | |
[email protected] | 4389724 | 2011-03-09 03:52:11 | [diff] [blame] | 46 | PhoneNumber::PhoneNumber(const PhoneNumber& number) : FormGroup() { |
| 47 | *this = number; |
| 48 | } |
| 49 | |
[email protected] | 8e38341 | 2010-10-19 16:57:03 | [diff] [blame] | 50 | PhoneNumber::~PhoneNumber() {} |
| 51 | |
[email protected] | 4389724 | 2011-03-09 03:52:11 | [diff] [blame] | 52 | PhoneNumber& PhoneNumber::operator=(const PhoneNumber& number) { |
| 53 | if (this == &number) |
| 54 | return *this; |
[email protected] | 4389724 | 2011-03-09 03:52:11 | [diff] [blame] | 55 | number_ = number.number_; |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 56 | phone_group_ = number.phone_group_; |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 57 | ClearCachedNumbers(); |
[email protected] | 4389724 | 2011-03-09 03:52:11 | [diff] [blame] | 58 | return *this; |
| 59 | } |
| 60 | |
[email protected] | 1308c283 | 2011-05-09 18:30:23 | [diff] [blame] | 61 | void PhoneNumber::GetMatchingTypes(const string16& text, |
| 62 | FieldTypeSet* matching_types) const { |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 63 | string16 stripped_text(text); |
| 64 | StripPunctuation(&stripped_text); |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 65 | |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 66 | if (!UpdateCacheIfNeeded()) |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 67 | return; |
| 68 | |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 69 | if (IsNumber(stripped_text, cached_local_number_)) |
[email protected] | 1308c283 | 2011-05-09 18:30:23 | [diff] [blame] | 70 | matching_types->insert(GetNumberType()); |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 71 | |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 72 | if (stripped_text == cached_city_code_) |
[email protected] | 1308c283 | 2011-05-09 18:30:23 | [diff] [blame] | 73 | matching_types->insert(GetCityCodeType()); |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 74 | |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 75 | if (stripped_text == cached_country_code_) |
[email protected] | 1308c283 | 2011-05-09 18:30:23 | [diff] [blame] | 76 | matching_types->insert(GetCountryCodeType()); |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 77 | |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 78 | string16 city_and_local(cached_city_code_); |
| 79 | city_and_local.append(cached_local_number_); |
| 80 | if (stripped_text == city_and_local) |
[email protected] | 1308c283 | 2011-05-09 18:30:23 | [diff] [blame] | 81 | matching_types->insert(GetCityAndNumberType()); |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 82 | |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 83 | // Whole number is compared to unfiltered text - it would be parsed for phone |
| 84 | // comparision (e.g. 1-800-FLOWERS and 18003569377 are the same) |
| 85 | if (IsWholeNumber(text)) |
[email protected] | 1308c283 | 2011-05-09 18:30:23 | [diff] [blame] | 86 | matching_types->insert(GetWholeNumberType()); |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 87 | } |
| 88 | |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 89 | void PhoneNumber::GetNonEmptyTypes(FieldTypeSet* non_empty_types) const { |
| 90 | DCHECK(non_empty_types); |
[email protected] | cea1d11 | 2010-07-01 00:57:33 | [diff] [blame] | 91 | |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 92 | if (number_.empty()) |
| 93 | return; |
[email protected] | cea1d11 | 2010-07-01 00:57:33 | [diff] [blame] | 94 | |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 95 | non_empty_types->insert(GetWholeNumberType()); |
[email protected] | cea1d11 | 2010-07-01 00:57:33 | [diff] [blame] | 96 | |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 97 | if (!UpdateCacheIfNeeded()) |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 98 | return; |
[email protected] | cea1d11 | 2010-07-01 00:57:33 | [diff] [blame] | 99 | |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 100 | non_empty_types->insert(GetNumberType()); |
[email protected] | cea1d11 | 2010-07-01 00:57:33 | [diff] [blame] | 101 | |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 102 | if (!cached_city_code_.empty()) { |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 103 | non_empty_types->insert(GetCityCodeType()); |
| 104 | non_empty_types->insert(GetCityAndNumberType()); |
| 105 | } |
| 106 | |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 107 | if (!cached_country_code_.empty()) |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 108 | non_empty_types->insert(GetCountryCodeType()); |
[email protected] | cea1d11 | 2010-07-01 00:57:33 | [diff] [blame] | 109 | } |
| 110 | |
[email protected] | 3b3a0ca7 | 2011-03-17 23:04:55 | [diff] [blame] | 111 | string16 PhoneNumber::GetInfo(AutofillFieldType type) const { |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 112 | if (type == GetWholeNumberType()) |
| 113 | return number_; |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 114 | if (!UpdateCacheIfNeeded()) |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 115 | return string16(); |
| 116 | |
[email protected] | 1ffe8e99 | 2011-03-17 06:26:29 | [diff] [blame] | 117 | if (type == GetNumberType()) |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 118 | return cached_local_number_; |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 119 | |
[email protected] | 1ffe8e99 | 2011-03-17 06:26:29 | [diff] [blame] | 120 | if (type == GetCityCodeType()) |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 121 | return cached_city_code_; |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 122 | |
[email protected] | 1ffe8e99 | 2011-03-17 06:26:29 | [diff] [blame] | 123 | if (type == GetCountryCodeType()) |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 124 | return cached_country_code_; |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 125 | |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 126 | string16 city_and_local(cached_city_code_); |
| 127 | city_and_local.append(cached_local_number_); |
[email protected] | 1ffe8e99 | 2011-03-17 06:26:29 | [diff] [blame] | 128 | if (type == GetCityAndNumberType()) |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 129 | return city_and_local; |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 130 | |
[email protected] | cea1d11 | 2010-07-01 00:57:33 | [diff] [blame] | 131 | return string16(); |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 132 | } |
| 133 | |
[email protected] | 1ffe8e99 | 2011-03-17 06:26:29 | [diff] [blame] | 134 | void PhoneNumber::SetInfo(AutofillFieldType type, const string16& value) { |
[email protected] | 1ffe8e99 | 2011-03-17 06:26:29 | [diff] [blame] | 135 | FieldTypeSubGroup subgroup = AutofillType(type).subgroup(); |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 136 | FieldTypeGroup group = AutofillType(type).group(); |
| 137 | if (phone_group_ == AutofillType::NO_GROUP) |
| 138 | phone_group_ = group; // First call on empty phone - set the group. |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 139 | ClearCachedNumbers(); |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 140 | if (subgroup == AutofillType::PHONE_NUMBER) { |
| 141 | // Should not be set directly. |
| 142 | NOTREACHED(); |
| 143 | } else if (subgroup == AutofillType::PHONE_CITY_CODE) { |
| 144 | // Should not be set directly. |
| 145 | NOTREACHED(); |
| 146 | } else if (subgroup == AutofillType::PHONE_COUNTRY_CODE) { |
| 147 | // Should not be set directly. |
| 148 | NOTREACHED(); |
| 149 | } else if (subgroup == AutofillType::PHONE_CITY_AND_NUMBER || |
| 150 | subgroup == AutofillType::PHONE_WHOLE_NUMBER) { |
| 151 | number_ = value; |
| 152 | StripPunctuation(&number_); |
| 153 | } else { |
| 154 | NOTREACHED(); |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | bool PhoneNumber::NormalizePhone() { |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 159 | // Empty number does not need normalization. |
| 160 | if (number_.empty()) |
| 161 | return true; |
| 162 | |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 163 | ClearCachedNumbers(); |
[email protected] | f467247 | 2011-05-27 07:21:01 | [diff] [blame] | 164 | number_ = autofill_i18n::NormalizePhoneNumber(number_, locale_); |
| 165 | return !number_.empty(); |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 166 | } |
| 167 | |
| 168 | void PhoneNumber::set_locale(const std::string& locale) { |
| 169 | locale_ = locale; |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 170 | ClearCachedNumbers(); |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | AutofillFieldType PhoneNumber::GetNumberType() const { |
| 174 | if (phone_group_ == AutofillType::PHONE_HOME) |
| 175 | return PHONE_HOME_NUMBER; |
| 176 | else if (phone_group_ == AutofillType::PHONE_FAX) |
| 177 | return PHONE_FAX_NUMBER; |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 178 | else |
| 179 | NOTREACHED(); |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 180 | return UNKNOWN_TYPE; |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 181 | } |
| 182 | |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 183 | AutofillFieldType PhoneNumber::GetCityCodeType() const { |
| 184 | if (phone_group_ == AutofillType::PHONE_HOME) |
| 185 | return PHONE_HOME_CITY_CODE; |
| 186 | else if (phone_group_ == AutofillType::PHONE_FAX) |
| 187 | return PHONE_FAX_CITY_CODE; |
| 188 | else |
| 189 | NOTREACHED(); |
| 190 | return UNKNOWN_TYPE; |
| 191 | } |
[email protected] | 9b435be9 | 2010-03-04 21:20:15 | [diff] [blame] | 192 | |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 193 | AutofillFieldType PhoneNumber::GetCountryCodeType() const { |
| 194 | if (phone_group_ == AutofillType::PHONE_HOME) |
| 195 | return PHONE_HOME_COUNTRY_CODE; |
| 196 | else if (phone_group_ == AutofillType::PHONE_FAX) |
| 197 | return PHONE_FAX_COUNTRY_CODE; |
| 198 | else |
| 199 | NOTREACHED(); |
| 200 | return UNKNOWN_TYPE; |
| 201 | } |
[email protected] | 9b435be9 | 2010-03-04 21:20:15 | [diff] [blame] | 202 | |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 203 | AutofillFieldType PhoneNumber::GetCityAndNumberType() const { |
| 204 | if (phone_group_ == AutofillType::PHONE_HOME) |
| 205 | return PHONE_HOME_CITY_AND_NUMBER; |
| 206 | else if (phone_group_ == AutofillType::PHONE_FAX) |
| 207 | return PHONE_FAX_CITY_AND_NUMBER; |
| 208 | else |
| 209 | NOTREACHED(); |
| 210 | return UNKNOWN_TYPE; |
| 211 | } |
[email protected] | 9b435be9 | 2010-03-04 21:20:15 | [diff] [blame] | 212 | |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 213 | AutofillFieldType PhoneNumber::GetWholeNumberType() const { |
| 214 | if (phone_group_ == AutofillType::PHONE_HOME) |
| 215 | return PHONE_HOME_WHOLE_NUMBER; |
| 216 | else if (phone_group_ == AutofillType::PHONE_FAX) |
| 217 | return PHONE_FAX_WHOLE_NUMBER; |
| 218 | else |
| 219 | NOTREACHED(); |
| 220 | return UNKNOWN_TYPE; |
| 221 | } |
[email protected] | 9b435be9 | 2010-03-04 21:20:15 | [diff] [blame] | 222 | |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 223 | bool PhoneNumber::PhoneCombineHelper::SetInfo(AutofillFieldType field_type, |
| 224 | const string16& value) { |
| 225 | PhoneNumber temp(phone_group_); |
| 226 | |
| 227 | if (field_type == temp.GetCountryCodeType()) { |
| 228 | country_ = value; |
| 229 | return true; |
| 230 | } else if (field_type == temp.GetCityCodeType()) { |
| 231 | city_ = value; |
| 232 | return true; |
| 233 | } else if (field_type == temp.GetCityAndNumberType()) { |
| 234 | phone_ = value; |
| 235 | return true; |
| 236 | } else if (field_type == temp.GetNumberType()) { |
| 237 | phone_.append(value); |
| 238 | return true; |
| 239 | } else { |
[email protected] | f8e7b62d | 2010-06-03 18:12:54 | [diff] [blame] | 240 | return false; |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 241 | } |
[email protected] | 9b435be9 | 2010-03-04 21:20:15 | [diff] [blame] | 242 | } |
| 243 | |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 244 | bool PhoneNumber::PhoneCombineHelper::ParseNumber(const std::string& locale, |
| 245 | string16* value) { |
| 246 | DCHECK(value); |
| 247 | return autofill_i18n::ConstructPhoneNumber( |
| 248 | country_, city_, phone_, |
| 249 | locale, |
| 250 | (country_.empty() ? |
| 251 | autofill_i18n::NATIONAL : autofill_i18n::INTERNATIONAL), |
| 252 | value); |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 253 | } |
| 254 | |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 255 | bool PhoneNumber::IsNumber(const string16& text, const string16& number) const { |
| 256 | // TODO(georgey): This will need to be updated once we add support for |
[email protected] | c13014b | 2011-04-18 20:04:00 | [diff] [blame] | 257 | // international phone numbers. |
[email protected] | 4605a13 | 2011-04-29 00:42:40 | [diff] [blame] | 258 | const size_t kPrefixLength = 3; |
| 259 | const size_t kSuffixLength = 4; |
| 260 | |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 261 | if (text == number) |
[email protected] | 4605a13 | 2011-04-29 00:42:40 | [diff] [blame] | 262 | return true; |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 263 | if (text.length() == kPrefixLength && StartsWith(number, text, true)) |
[email protected] | 4605a13 | 2011-04-29 00:42:40 | [diff] [blame] | 264 | return true; |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 265 | if (text.length() == kSuffixLength && EndsWith(number, text, true)) |
[email protected] | 4605a13 | 2011-04-29 00:42:40 | [diff] [blame] | 266 | return true; |
| 267 | |
| 268 | return false; |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 269 | } |
| 270 | |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 271 | bool PhoneNumber::IsWholeNumber(const string16& text) const { |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 272 | return autofill_i18n::ComparePhones(text, number_, locale_) == |
| 273 | autofill_i18n::PHONES_EQUAL; |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 274 | } |
| 275 | |
[email protected] | 9b435be9 | 2010-03-04 21:20:15 | [diff] [blame] | 276 | // Static. |
| 277 | void PhoneNumber::StripPunctuation(string16* number) { |
| 278 | RemoveChars(*number, kPhoneNumberSeparators, number); |
[email protected] | 3db3ff6 | 2010-01-07 00:35:39 | [diff] [blame] | 279 | } |
[email protected] | 11c2bdd1 | 2011-05-23 18:24:32 | [diff] [blame] | 280 | |
[email protected] | 6f113af | 2011-06-03 05:10:43 | [diff] [blame^] | 281 | void PhoneNumber::ClearCachedNumbers() const { |
| 282 | cached_country_code_.clear(); |
| 283 | cached_city_code_.clear(); |
| 284 | cached_local_number_.clear(); |
| 285 | } |
| 286 | |
| 287 | bool PhoneNumber::UpdateCacheIfNeeded() const { |
| 288 | if (cached_local_number_.empty() && !number_.empty()) { |
| 289 | return autofill_i18n::ParsePhoneNumber( |
| 290 | number_, locale_, &cached_country_code_, &cached_city_code_, |
| 291 | &cached_local_number_); |
| 292 | } else { |
| 293 | return true; |
| 294 | } |
| 295 | } |