| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // localities. A typical data size is 10KB. The largest is 250KB. If a region | 87 // localities. A typical data size is 10KB. The largest is 250KB. If a region |
| 88 // has language-specific validation rules, then these are also loaded. | 88 // has language-specific validation rules, then these are also loaded. |
| 89 // | 89 // |
| 90 // Example rule: | 90 // Example rule: |
| 91 // https://i18napis.appspot.com/ssl-aggregate-address/data/US | 91 // https://i18napis.appspot.com/ssl-aggregate-address/data/US |
| 92 // | 92 // |
| 93 // If the rules are already in progress of being loaded, it does nothing. | 93 // If the rules are already in progress of being loaded, it does nothing. |
| 94 // Invokes |load_rules_listener| when the loading has finished. | 94 // Invokes |load_rules_listener| when the loading has finished. |
| 95 virtual void LoadRules(const std::string& region_code); | 95 virtual void LoadRules(const std::string& region_code); |
| 96 | 96 |
| 97 // Returns the list of sub-regions (recorded as sub-keys) of the region |
| 98 // (recorded as rule) indicated by |region_code|. So, if the |region_code| is |
| 99 // a country code, sub-region means the country's admin area. |
| 100 // This function should be called when the rules are loaded. |
| 101 virtual std::vector<std::string> GetRegionSubKeys( |
| 102 const std::string& region_code); |
| 103 |
| 97 // Validates the |address| and populates |problems| with the validation | 104 // Validates the |address| and populates |problems| with the validation |
| 98 // problems, filtered according to the |filter| parameter. | 105 // problems, filtered according to the |filter| parameter. |
| 99 // | 106 // |
| 100 // If the |filter| is empty, then all discovered validation problems are | 107 // If the |filter| is empty, then all discovered validation problems are |
| 101 // returned. If the |filter| contains problem elements, then only the problems | 108 // returned. If the |filter| contains problem elements, then only the problems |
| 102 // in the |filter| may be returned. | 109 // in the |filter| may be returned. |
| 103 virtual Status ValidateAddress( | 110 virtual Status ValidateAddress( |
| 104 const ::i18n::addressinput::AddressData& address, | 111 const ::i18n::addressinput::AddressData& address, |
| 105 const ::i18n::addressinput::FieldProblemMap* filter, | 112 const ::i18n::addressinput::FieldProblemMap* filter, |
| 106 ::i18n::addressinput::FieldProblemMap* problems) const; | 113 ::i18n::addressinput::FieldProblemMap* problems) const; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // any WeakPtrs to AddressValidator are invalidated before its members | 205 // any WeakPtrs to AddressValidator are invalidated before its members |
| 199 // variable's destructors are executed, rendering them invalid. | 206 // variable's destructors are executed, rendering them invalid. |
| 200 base::WeakPtrFactory<AddressValidator> weak_factory_; | 207 base::WeakPtrFactory<AddressValidator> weak_factory_; |
| 201 | 208 |
| 202 DISALLOW_COPY_AND_ASSIGN(AddressValidator); | 209 DISALLOW_COPY_AND_ASSIGN(AddressValidator); |
| 203 }; | 210 }; |
| 204 | 211 |
| 205 } // namespace autofill | 212 } // namespace autofill |
| 206 | 213 |
| 207 #endif // THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_ADDRESS_VALIDATOR_H_ | 214 #endif // THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_ADDRESS_VALIDATOR_H_ |
| OLD | NEW |