OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CORE_BROWSER_PHONE_NUMBER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 29 matching lines...) Expand all Loading... |
40 bool SetInfo(const AutofillType& type, | 40 bool SetInfo(const AutofillType& type, |
41 const base::string16& value, | 41 const base::string16& value, |
42 const std::string& app_locale) override; | 42 const std::string& app_locale) override; |
43 | 43 |
44 // Size and offset of the prefix and suffix portions of phone numbers. | 44 // Size and offset of the prefix and suffix portions of phone numbers. |
45 static const size_t kPrefixOffset = 0; | 45 static const size_t kPrefixOffset = 0; |
46 static const size_t kPrefixLength = 3; | 46 static const size_t kPrefixLength = 3; |
47 static const size_t kSuffixOffset = 3; | 47 static const size_t kSuffixOffset = 3; |
48 static const size_t kSuffixLength = 4; | 48 static const size_t kSuffixLength = 4; |
49 | 49 |
| 50 // The size of a phone number consisting of the city code followed by the |
| 51 // prefix and suffix portions of the phone number. |
| 52 static const size_t kCityAndNumberLength = 10; |
| 53 |
50 // The class used to combine home phone parts into a whole number. | 54 // The class used to combine home phone parts into a whole number. |
51 class PhoneCombineHelper { | 55 class PhoneCombineHelper { |
52 public: | 56 public: |
53 PhoneCombineHelper(); | 57 PhoneCombineHelper(); |
54 ~PhoneCombineHelper(); | 58 ~PhoneCombineHelper(); |
55 | 59 |
56 // If |type| is a phone field type, saves the |value| accordingly and | 60 // If |type| is a phone field type, saves the |value| accordingly and |
57 // returns true. For all other field types returs false. | 61 // returns true. For all other field types returs false. |
58 bool SetInfo(const AutofillType& type, const base::string16& value); | 62 bool SetInfo(const AutofillType& type, const base::string16& value); |
59 | 63 |
(...skipping 28 matching lines...) Expand all Loading... |
88 // Profile which stores the region used as hint when normalizing the number. | 92 // Profile which stores the region used as hint when normalizing the number. |
89 const AutofillProfile* profile_; // WEAK | 93 const AutofillProfile* profile_; // WEAK |
90 | 94 |
91 // Cached number. | 95 // Cached number. |
92 mutable i18n::PhoneObject cached_parsed_phone_; | 96 mutable i18n::PhoneObject cached_parsed_phone_; |
93 }; | 97 }; |
94 | 98 |
95 } // namespace autofill | 99 } // namespace autofill |
96 | 100 |
97 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_H_ | 101 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_H_ |
OLD | NEW |