| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_ | 6 #define CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 bool IsEmpty() const; | 60 bool IsEmpty() const; |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 string16 country_; | 63 string16 country_; |
| 64 string16 city_; | 64 string16 city_; |
| 65 string16 phone_; | 65 string16 phone_; |
| 66 string16 whole_number_; | 66 string16 whole_number_; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 FRIEND_TEST_ALL_PREFIXES(PhoneNumberTest, Matcher); | |
| 71 | |
| 72 // FormGroup: | 70 // FormGroup: |
| 73 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE; | 71 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE; |
| 74 | 72 |
| 75 // Validates |number_| and translates it into digits-only format. | 73 // Validates |number_| and translates it into digits-only format. |
| 76 bool NormalizePhone(); | 74 bool NormalizePhone(); |
| 77 | 75 |
| 78 // Returns the locale for this phone number, based on the |profile_|. | 76 // Returns the locale for this phone number, based on the |profile_|. |
| 79 std::string locale() const; | 77 std::string GetLocale() const; |
| 80 | 78 |
| 81 // Updates the cached parsed number if the profile's locale has changed | 79 // Updates the cached parsed number if the profile's locale has changed |
| 82 // since the last time the cache was updated. | 80 // since the last time the cache was updated. |
| 83 void UpdateCacheIfNeeded() const; | 81 void UpdateCacheIfNeeded() const; |
| 84 | 82 |
| 85 // The phone number. | 83 // The phone number. |
| 86 string16 number_; | 84 string16 number_; |
| 87 // Profile which stores the locale used as hint when normalizing the number. | 85 // Profile which stores the locale used as hint when normalizing the number. |
| 88 AutofillProfile* profile_; // WEAK | 86 AutofillProfile* profile_; // WEAK |
| 89 | 87 |
| 90 // Cached number. | 88 // Cached number. |
| 91 mutable autofill_i18n::PhoneObject cached_parsed_phone_; | 89 mutable autofill_i18n::PhoneObject cached_parsed_phone_; |
| 92 }; | 90 }; |
| 93 | 91 |
| 94 #endif // CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_ | 92 #endif // CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_ |
| OLD | NEW |