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 COMPONENTS_AUTOFILL_BROWSER_PHONE_NUMBER_I18N_H_ | 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_PHONE_NUMBER_I18N_H_ |
6 #define COMPONENTS_AUTOFILL_BROWSER_PHONE_NUMBER_I18N_H_ | 6 #define COMPONENTS_AUTOFILL_BROWSER_PHONE_NUMBER_I18N_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 bool ConstructPhoneNumber(const string16& country_code, | 52 bool ConstructPhoneNumber(const string16& country_code, |
53 const string16& city_code, | 53 const string16& city_code, |
54 const string16& number, | 54 const string16& number, |
55 const std::string& region, | 55 const std::string& region, |
56 string16* whole_number) WARN_UNUSED_RESULT; | 56 string16* whole_number) WARN_UNUSED_RESULT; |
57 | 57 |
58 // Returns true if |number_a| and |number_b| parse to the same phone number in | 58 // Returns true if |number_a| and |number_b| parse to the same phone number in |
59 // the given |region|. | 59 // the given |region|. |
60 bool PhoneNumbersMatch(const string16& number_a, | 60 bool PhoneNumbersMatch(const string16& number_a, |
61 const string16& number_b, | 61 const string16& number_b, |
62 const std::string& region); | 62 const std::string& region, |
| 63 const std::string& app_locale); |
63 | 64 |
64 // The cached phone number, does parsing only once, improves performance. | 65 // The cached phone number, does parsing only once, improves performance. |
65 class PhoneObject { | 66 class PhoneObject { |
66 public: | 67 public: |
67 PhoneObject(const string16& number, const std::string& region); | 68 PhoneObject(const string16& number, |
| 69 const std::string& region); |
68 PhoneObject(const PhoneObject&); | 70 PhoneObject(const PhoneObject&); |
69 PhoneObject(); | 71 PhoneObject(); |
70 ~PhoneObject(); | 72 ~PhoneObject(); |
71 | 73 |
72 std::string region() const { return region_; } | 74 std::string region() const { return region_; } |
73 | 75 |
74 string16 country_code() const { return country_code_; } | 76 string16 country_code() const { return country_code_; } |
75 string16 city_code() const { return city_code_; } | 77 string16 city_code() const { return city_code_; } |
76 string16 number() const { return number_; } | 78 string16 number() const { return number_; } |
77 | 79 |
(...skipping 19 matching lines...) Expand all Loading... |
97 mutable string16 formatted_number_; | 99 mutable string16 formatted_number_; |
98 | 100 |
99 // The whole number, normalized to contain only digits if possible. | 101 // The whole number, normalized to contain only digits if possible. |
100 // Set on first request. | 102 // Set on first request. |
101 mutable string16 whole_number_; | 103 mutable string16 whole_number_; |
102 }; | 104 }; |
103 | 105 |
104 } // namespace autofill_i18n | 106 } // namespace autofill_i18n |
105 | 107 |
106 #endif // COMPONENTS_AUTOFILL_BROWSER_PHONE_NUMBER_I18N_H_ | 108 #endif // COMPONENTS_AUTOFILL_BROWSER_PHONE_NUMBER_I18N_H_ |
OLD | NEW |