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> |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 #include <utility> | |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
17 #include "base/time/time.h" | 18 #include "base/time/time.h" |
18 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_fi eld.h" | 19 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_fi eld.h" |
19 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_va lidator.h" | 20 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_va lidator.h" |
20 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/callback.h " | 21 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/callback.h " |
21 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/preload_su pplier.h" | 22 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/preload_su pplier.h" |
22 | 23 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 // Example rule: | 91 // Example rule: |
91 // https://i18napis.appspot.com/ssl-aggregate-address/data/US | 92 // https://i18napis.appspot.com/ssl-aggregate-address/data/US |
92 // | 93 // |
93 // If the rules are already in progress of being loaded, it does nothing. | 94 // If the rules are already in progress of being loaded, it does nothing. |
94 // Invokes |load_rules_listener| when the loading has finished. | 95 // Invokes |load_rules_listener| when the loading has finished. |
95 virtual void LoadRules(const std::string& region_code); | 96 virtual void LoadRules(const std::string& region_code); |
96 | 97 |
97 // Returns the list of sub-regions (recorded as sub-keys) of the region | 98 // 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 // (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 // a country code, sub-region means the country's admin area. |
100 // This function should be called when the rules are loaded. | 101 // This function should be called when the rules are loaded. |
Mathieu
2017/07/07 13:10:02
mention |language|
Parastoo
2017/07/07 15:53:24
Done.
| |
101 virtual std::vector<std::string> GetRegionSubKeys( | 102 virtual std::vector<std::pair<std::string, std::string>> GetRegionSubKeys( |
102 const std::string& region_code); | 103 const std::string& region_code, |
104 const std::string& language); | |
103 | 105 |
104 // Validates the |address| and populates |problems| with the validation | 106 // Validates the |address| and populates |problems| with the validation |
105 // problems, filtered according to the |filter| parameter. | 107 // problems, filtered according to the |filter| parameter. |
106 // | 108 // |
107 // If the |filter| is empty, then all discovered validation problems are | 109 // If the |filter| is empty, then all discovered validation problems are |
108 // returned. If the |filter| contains problem elements, then only the problems | 110 // returned. If the |filter| contains problem elements, then only the problems |
109 // in the |filter| may be returned. | 111 // in the |filter| may be returned. |
110 virtual Status ValidateAddress( | 112 virtual Status ValidateAddress( |
111 const ::i18n::addressinput::AddressData& address, | 113 const ::i18n::addressinput::AddressData& address, |
112 const ::i18n::addressinput::FieldProblemMap* filter, | 114 const ::i18n::addressinput::FieldProblemMap* filter, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 // any WeakPtrs to AddressValidator are invalidated before its members | 207 // any WeakPtrs to AddressValidator are invalidated before its members |
206 // variable's destructors are executed, rendering them invalid. | 208 // variable's destructors are executed, rendering them invalid. |
207 base::WeakPtrFactory<AddressValidator> weak_factory_; | 209 base::WeakPtrFactory<AddressValidator> weak_factory_; |
208 | 210 |
209 DISALLOW_COPY_AND_ASSIGN(AddressValidator); | 211 DISALLOW_COPY_AND_ASSIGN(AddressValidator); |
210 }; | 212 }; |
211 | 213 |
212 } // namespace autofill | 214 } // namespace autofill |
213 | 215 |
214 #endif // THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_ADDRESS_VALIDATOR_H_ | 216 #endif // THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_CHROME_ADDRESS_VALIDATOR_H_ |
OLD | NEW |