OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/autofill/phone_number.h" | 5 #include "chrome/browser/autofill/phone_number.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/autofill/autofill_profile.h" | 9 #include "chrome/browser/autofill/autofill_profile.h" |
10 #include "chrome/browser/autofill/autofill_type.h" | 10 #include "chrome/browser/autofill/autofill_type.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 AutoFillType::PHONE_CITY_CODE, | 25 AutoFillType::PHONE_CITY_CODE, |
26 AutoFillType::PHONE_COUNTRY_CODE, | 26 AutoFillType::PHONE_COUNTRY_CODE, |
27 AutoFillType::PHONE_CITY_AND_NUMBER, | 27 AutoFillType::PHONE_CITY_AND_NUMBER, |
28 AutoFillType::PHONE_WHOLE_NUMBER, | 28 AutoFillType::PHONE_WHOLE_NUMBER, |
29 }; | 29 }; |
30 | 30 |
31 const int kAutoFillPhoneLength = arraysize(kAutoFillPhoneTypes); | 31 const int kAutoFillPhoneLength = arraysize(kAutoFillPhoneTypes); |
32 | 32 |
33 } // namespace | 33 } // namespace |
34 | 34 |
| 35 PhoneNumber::PhoneNumber() {} |
| 36 |
| 37 PhoneNumber::~PhoneNumber() {} |
| 38 |
35 void PhoneNumber::GetPossibleFieldTypes(const string16& text, | 39 void PhoneNumber::GetPossibleFieldTypes(const string16& text, |
36 FieldTypeSet* possible_types) const { | 40 FieldTypeSet* possible_types) const { |
37 string16 stripped_text(text); | 41 string16 stripped_text(text); |
38 StripPunctuation(&stripped_text); | 42 StripPunctuation(&stripped_text); |
39 if (!Validate(stripped_text)) | 43 if (!Validate(stripped_text)) |
40 return; | 44 return; |
41 | 45 |
42 if (IsNumber(stripped_text)) | 46 if (IsNumber(stripped_text)) |
43 possible_types->insert(GetNumberType()); | 47 possible_types->insert(GetNumberType()); |
44 | 48 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 return false; | 292 return false; |
289 } | 293 } |
290 | 294 |
291 return true; | 295 return true; |
292 } | 296 } |
293 | 297 |
294 // Static. | 298 // Static. |
295 void PhoneNumber::StripPunctuation(string16* number) { | 299 void PhoneNumber::StripPunctuation(string16* number) { |
296 RemoveChars(*number, kPhoneNumberSeparators, number); | 300 RemoveChars(*number, kPhoneNumberSeparators, number); |
297 } | 301 } |
OLD | NEW |