| 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 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "components/autofill/common/autofill_export.h" |
| 14 | 15 |
| 15 namespace i18n { | 16 namespace i18n { |
| 16 namespace phonenumbers { | 17 namespace phonenumbers { |
| 17 class PhoneNumber; | 18 class PhoneNumber; |
| 18 } | 19 } |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace autofill { | 22 namespace autofill { |
| 22 | 23 |
| 23 // Utilities to process, normalize and compare international phone numbers. | 24 // Utilities to process, normalize and compare international phone numbers. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 52 // Separator characters are stripped before parsing the digits. | 53 // Separator characters are stripped before parsing the digits. |
| 53 // Returns true if parsing was successful, false otherwise. | 54 // Returns true if parsing was successful, false otherwise. |
| 54 bool ConstructPhoneNumber(const base::string16& country_code, | 55 bool ConstructPhoneNumber(const base::string16& country_code, |
| 55 const base::string16& city_code, | 56 const base::string16& city_code, |
| 56 const base::string16& number, | 57 const base::string16& number, |
| 57 const std::string& region, | 58 const std::string& region, |
| 58 base::string16* whole_number) WARN_UNUSED_RESULT; | 59 base::string16* whole_number) WARN_UNUSED_RESULT; |
| 59 | 60 |
| 60 // Returns true if |number_a| and |number_b| parse to the same phone number in | 61 // Returns true if |number_a| and |number_b| parse to the same phone number in |
| 61 // the given |region|. | 62 // the given |region|. |
| 62 bool PhoneNumbersMatch(const base::string16& number_a, | 63 bool AUTOFILL_EXPORT PhoneNumbersMatch(const base::string16& number_a, |
| 63 const base::string16& number_b, | 64 const base::string16& number_b, |
| 64 const std::string& region, | 65 const std::string& region, |
| 65 const std::string& app_locale); | 66 const std::string& app_locale); |
| 66 | 67 |
| 67 // The cached phone number, does parsing only once, improves performance. | 68 // The cached phone number, does parsing only once, improves performance. |
| 68 class PhoneObject { | 69 class PhoneObject { |
| 69 public: | 70 public: |
| 70 PhoneObject(const base::string16& number, | 71 PhoneObject(const base::string16& number, |
| 71 const std::string& region); | 72 const std::string& region); |
| 72 PhoneObject(const PhoneObject&); | 73 PhoneObject(const PhoneObject&); |
| 73 PhoneObject(); | 74 PhoneObject(); |
| 74 ~PhoneObject(); | 75 ~PhoneObject(); |
| 75 | 76 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 103 | 104 |
| 104 // The whole number, normalized to contain only digits if possible. | 105 // The whole number, normalized to contain only digits if possible. |
| 105 // Set on first request. | 106 // Set on first request. |
| 106 mutable base::string16 whole_number_; | 107 mutable base::string16 whole_number_; |
| 107 }; | 108 }; |
| 108 | 109 |
| 109 } // namespace i18n | 110 } // namespace i18n |
| 110 } // namespace autofill | 111 } // namespace autofill |
| 111 | 112 |
| 112 #endif // COMPONENTS_AUTOFILL_BROWSER_PHONE_NUMBER_I18N_H_ | 113 #endif // COMPONENTS_AUTOFILL_BROWSER_PHONE_NUMBER_I18N_H_ |
| OLD | NEW |