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 30 matching lines...) Expand all Loading... | |
41 | 41 |
42 // Called when the validation rules for the |region_code| have been loaded. | 42 // Called when the validation rules for the |region_code| have been loaded. |
43 // The validation rules include the generic rules for the |region_code| and | 43 // The validation rules include the generic rules for the |region_code| and |
44 // specific rules for the country's administrative areas, localities, and | 44 // specific rules for the country's administrative areas, localities, and |
45 // dependent localities. If a country has language-specific validation rules, | 45 // dependent localities. If a country has language-specific validation rules, |
46 // then these are also loaded. | 46 // then these are also loaded. |
47 // | 47 // |
48 // The |success| parameter is true when the rules were loaded successfully. | 48 // The |success| parameter is true when the rules were loaded successfully. |
49 virtual void OnAddressValidationRulesLoaded(const std::string& region_code, | 49 virtual void OnAddressValidationRulesLoaded(const std::string& region_code, |
50 bool success) = 0; | 50 bool success) = 0; |
51 virtual void OnGettingSubKeysRulesLoaded(const std::string& region_code, | |
sebsg
2017/02/10 16:00:32
As mentionned in the other comments, this can prob
Parastoo
2017/02/13 21:57:23
Acknowledged.
| |
52 bool success) = 0; | |
51 }; | 53 }; |
52 | 54 |
53 // Interface to the libaddressinput AddressValidator for Chromium Autofill. The | 55 // Interface to the libaddressinput AddressValidator for Chromium Autofill. The |
54 // class is named AddressValidator to simplify switching between libaddressinput | 56 // class is named AddressValidator to simplify switching between libaddressinput |
55 // and this version. | 57 // and this version. |
56 // | 58 // |
57 // It's not possible to name this file address_validator.h because some | 59 // It's not possible to name this file address_validator.h because some |
58 // compilers do not handle multiple files with the same name (although in | 60 // compilers do not handle multiple files with the same name (although in |
59 // different directories) gracefully. This class is a shim between upstream | 61 // different directories) gracefully. This class is a shim between upstream |
60 // libaddressinput API and the API that Chrome expects, hence the file name | 62 // libaddressinput API and the API that Chrome expects, hence the file name |
(...skipping 26 matching lines...) Expand all Loading... | |
87 // localities. A typical data size is 10KB. The largest is 250KB. If a region | 89 // 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. | 90 // has language-specific validation rules, then these are also loaded. |
89 // | 91 // |
90 // Example rule: | 92 // Example rule: |
91 // https://i18napis.appspot.com/ssl-aggregate-address/data/US | 93 // https://i18napis.appspot.com/ssl-aggregate-address/data/US |
92 // | 94 // |
93 // If the rules are already in progress of being loaded, it does nothing. | 95 // If the rules are already in progress of being loaded, it does nothing. |
94 // Invokes |load_rules_listener| when the loading has finished. | 96 // Invokes |load_rules_listener| when the loading has finished. |
95 virtual void LoadRules(const std::string& region_code); | 97 virtual void LoadRules(const std::string& region_code); |
96 | 98 |
99 virtual std::vector<std::string> GetRegionSubKeys( | |
sebsg
2017/02/10 16:00:32
Please add a comment describing this function.
Parastoo
2017/02/13 21:57:23
Done.
| |
100 const std::string& region_code) const; | |
101 | |
97 // Validates the |address| and populates |problems| with the validation | 102 // Validates the |address| and populates |problems| with the validation |
98 // problems, filtered according to the |filter| parameter. | 103 // problems, filtered according to the |filter| parameter. |
99 // | 104 // |
100 // If the |filter| is empty, then all discovered validation problems are | 105 // If the |filter| is empty, then all discovered validation problems are |
101 // returned. If the |filter| contains problem elements, then only the problems | 106 // returned. If the |filter| contains problem elements, then only the problems |
102 // in the |filter| may be returned. | 107 // in the |filter| may be returned. |
103 virtual Status ValidateAddress( | 108 virtual Status ValidateAddress( |
104 const ::i18n::addressinput::AddressData& address, | 109 const ::i18n::addressinput::AddressData& address, |
105 const ::i18n::addressinput::FieldProblemMap* filter, | 110 const ::i18n::addressinput::FieldProblemMap* filter, |
106 ::i18n::addressinput::FieldProblemMap* problems) const; | 111 ::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 | 203 // any WeakPtrs to AddressValidator are invalidated before its members |
199 // variable's destructors are executed, rendering them invalid. | 204 // variable's destructors are executed, rendering them invalid. |
200 base::WeakPtrFactory<AddressValidator> weak_factory_; | 205 base::WeakPtrFactory<AddressValidator> weak_factory_; |
201 | 206 |
202 DISALLOW_COPY_AND_ASSIGN(AddressValidator); | 207 DISALLOW_COPY_AND_ASSIGN(AddressValidator); |
203 }; | 208 }; |
204 | 209 |
205 } // namespace autofill | 210 } // namespace autofill |
206 | 211 |
207 #endif // THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_ADDRESS_VALIDATOR_H_ | 212 #endif // THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_ADDRESS_VALIDATOR_H_ |
OLD | NEW |