OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_ADDRESS_VALIDATOR_H_ | 5 #ifndef THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_ADDRESS_VALIDATOR_H_ |
6 #define THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_ADDRESS_VALIDATOR_H_ | 6 #define THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_ADDRESS_VALIDATOR_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // Suggestion: | 128 // Suggestion: |
129 // [{dependent_locality: "Zongyang Xian", | 129 // [{dependent_locality: "Zongyang Xian", |
130 // locality: "Anqing Shi", | 130 // locality: "Anqing Shi", |
131 // administrative_area: "Anhui Sheng"}] | 131 // administrative_area: "Anhui Sheng"}] |
132 virtual Status GetSuggestions( | 132 virtual Status GetSuggestions( |
133 const ::i18n::addressinput::AddressData& user_input, | 133 const ::i18n::addressinput::AddressData& user_input, |
134 ::i18n::addressinput::AddressField focused_field, | 134 ::i18n::addressinput::AddressField focused_field, |
135 size_t suggestion_limit, | 135 size_t suggestion_limit, |
136 std::vector< ::i18n::addressinput::AddressData>* suggestions) const; | 136 std::vector< ::i18n::addressinput::AddressData>* suggestions) const; |
137 | 137 |
138 // Canonicalizes the administrative area in |address_data|. For example, | 138 // Normalizes the |address_data|. For example, "texas" changes to "TX". |
139 // "texas" changes to "TX". Returns true on success, otherwise leaves | 139 // Returns true on success, otherwise leaves |address_data| alone and returns |
140 // |address_data| alone and returns false. | 140 // false. |
141 virtual bool CanonicalizeAdministrativeArea( | 141 virtual bool NormalizeAddress( |
142 ::i18n::addressinput::AddressData* address) const; | 142 ::i18n::addressinput::AddressData* address) const; |
143 | 143 |
| 144 // Returns whether the rules associated with the |region_code| are loaded. |
| 145 virtual bool AreRulesLoadedForRegion(const std::string& region_code); |
| 146 |
144 protected: | 147 protected: |
145 // Constructor used only for MockAddressValidator. | 148 // Constructor used only for MockAddressValidator. |
146 AddressValidator(); | 149 AddressValidator(); |
147 | 150 |
148 // Returns the period of time to wait between the first attempt's failure and | 151 // Returns the period of time to wait between the first attempt's failure and |
149 // the second attempt's initiation to load rules. Exposed for testing. | 152 // the second attempt's initiation to load rules. Exposed for testing. |
150 virtual base::TimeDelta GetBaseRetryPeriod() const; | 153 virtual base::TimeDelta GetBaseRetryPeriod() const; |
151 | 154 |
152 private: | 155 private: |
153 // Verifies that |validator_| succeeded. Invoked by |validated_| callback. | 156 // Verifies that |validator_| succeeded. Invoked by |validated_| callback. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // any WeakPtrs to AddressValidator are invalidated before its members | 198 // any WeakPtrs to AddressValidator are invalidated before its members |
196 // variable's destructors are executed, rendering them invalid. | 199 // variable's destructors are executed, rendering them invalid. |
197 base::WeakPtrFactory<AddressValidator> weak_factory_; | 200 base::WeakPtrFactory<AddressValidator> weak_factory_; |
198 | 201 |
199 DISALLOW_COPY_AND_ASSIGN(AddressValidator); | 202 DISALLOW_COPY_AND_ASSIGN(AddressValidator); |
200 }; | 203 }; |
201 | 204 |
202 } // namespace autofill | 205 } // namespace autofill |
203 | 206 |
204 #endif // THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_ADDRESS_VALIDATOR_H_ | 207 #endif // THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_ADDRESS_VALIDATOR_H_ |
OLD | NEW |