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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 virtual ~PhoneNumber(); | 25 virtual ~PhoneNumber(); |
26 | 26 |
27 PhoneNumber& operator=(const PhoneNumber& number); | 27 PhoneNumber& operator=(const PhoneNumber& number); |
28 | 28 |
29 void set_profile(AutofillProfile* profile) { profile_ = profile; } | 29 void set_profile(AutofillProfile* profile) { profile_ = profile; } |
30 | 30 |
31 // FormGroup implementation: | 31 // FormGroup implementation: |
32 virtual void GetMatchingTypes( | 32 virtual void GetMatchingTypes( |
33 const base::string16& text, | 33 const base::string16& text, |
34 const std::string& app_locale, | 34 const std::string& app_locale, |
35 ServerFieldTypeSet* matching_types) const OVERRIDE; | 35 ServerFieldTypeSet* matching_types) const override; |
36 virtual base::string16 GetRawInfo(ServerFieldType type) const OVERRIDE; | 36 virtual base::string16 GetRawInfo(ServerFieldType type) const override; |
37 virtual void SetRawInfo(ServerFieldType type, | 37 virtual void SetRawInfo(ServerFieldType type, |
38 const base::string16& value) OVERRIDE; | 38 const base::string16& value) override; |
39 virtual base::string16 GetInfo(const AutofillType& type, | 39 virtual base::string16 GetInfo(const AutofillType& type, |
40 const std::string& app_locale) const OVERRIDE; | 40 const std::string& app_locale) const override; |
41 virtual bool SetInfo(const AutofillType& type, | 41 virtual bool SetInfo(const AutofillType& type, |
42 const base::string16& value, | 42 const base::string16& value, |
43 const std::string& app_locale) OVERRIDE; | 43 const std::string& app_locale) override; |
44 | 44 |
45 // Size and offset of the prefix and suffix portions of phone numbers. | 45 // Size and offset of the prefix and suffix portions of phone numbers. |
46 static const size_t kPrefixOffset = 0; | 46 static const size_t kPrefixOffset = 0; |
47 static const size_t kPrefixLength = 3; | 47 static const size_t kPrefixLength = 3; |
48 static const size_t kSuffixOffset = 3; | 48 static const size_t kSuffixOffset = 3; |
49 static const size_t kSuffixLength = 4; | 49 static const size_t kSuffixLength = 4; |
50 | 50 |
51 // The class used to combine home phone parts into a whole number. | 51 // The class used to combine home phone parts into a whole number. |
52 class PhoneCombineHelper { | 52 class PhoneCombineHelper { |
53 public: | 53 public: |
(...skipping 18 matching lines...) Expand all Loading... |
72 private: | 72 private: |
73 base::string16 country_; | 73 base::string16 country_; |
74 base::string16 city_; | 74 base::string16 city_; |
75 base::string16 phone_; | 75 base::string16 phone_; |
76 base::string16 whole_number_; | 76 base::string16 whole_number_; |
77 }; | 77 }; |
78 | 78 |
79 private: | 79 private: |
80 // FormGroup: | 80 // FormGroup: |
81 virtual void GetSupportedTypes( | 81 virtual void GetSupportedTypes( |
82 ServerFieldTypeSet* supported_types) const OVERRIDE; | 82 ServerFieldTypeSet* supported_types) const override; |
83 | 83 |
84 // Updates the cached parsed number if the profile's region has changed | 84 // Updates the cached parsed number if the profile's region has changed |
85 // since the last time the cache was updated. | 85 // since the last time the cache was updated. |
86 void UpdateCacheIfNeeded(const std::string& app_locale) const; | 86 void UpdateCacheIfNeeded(const std::string& app_locale) const; |
87 | 87 |
88 // The phone number. | 88 // The phone number. |
89 base::string16 number_; | 89 base::string16 number_; |
90 // Profile which stores the region used as hint when normalizing the number. | 90 // Profile which stores the region used as hint when normalizing the number. |
91 const AutofillProfile* profile_; // WEAK | 91 const AutofillProfile* profile_; // WEAK |
92 | 92 |
93 // Cached number. | 93 // Cached number. |
94 mutable i18n::PhoneObject cached_parsed_phone_; | 94 mutable i18n::PhoneObject cached_parsed_phone_; |
95 }; | 95 }; |
96 | 96 |
97 } // namespace autofill | 97 } // namespace autofill |
98 | 98 |
99 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_H_ | 99 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_H_ |
OLD | NEW |