OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_PAYMENTS_ADDRESS_NORMALIZER_H_ | 5 #ifndef COMPONENTS_PAYMENTS_ADDRESS_NORMALIZER_H_ |
6 #define COMPONENTS_PAYMENTS_ADDRESS_NORMALIZER_H_ | 6 #define COMPONENTS_PAYMENTS_ADDRESS_NORMALIZER_H_ |
7 | 7 |
8 #include <map> | |
sebsg
2017/02/28 16:14:00
needed?
Parastoo
2017/03/21 14:30:44
=> git cl lint error. [build/include_what_you_see]
| |
9 #include <memory> | |
10 #include <string> | |
11 #include <vector> | |
12 | |
8 #include "base/macros.h" | 13 #include "base/macros.h" |
9 #include "components/autofill/core/browser/autofill_profile.h" | 14 #include "components/autofill/core/browser/autofill_profile.h" |
10 #include "third_party/libaddressinput/chromium/chrome_address_validator.h" | 15 #include "third_party/libaddressinput/chromium/chrome_address_validator.h" |
11 | 16 |
12 using autofill::AutofillProfile; | 17 using autofill::AutofillProfile; |
13 | 18 |
14 namespace payments { | 19 namespace payments { |
15 | 20 |
16 // A class used to normalize addresses. | 21 // A class used to normalize addresses. |
17 class AddressNormalizer : public autofill::LoadRulesListener { | 22 class AddressNormalizer : public autofill::LoadRulesListener { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 // Will start loading the rules for the |region_code| if they had not started | 61 // Will start loading the rules for the |region_code| if they had not started |
57 // loading. | 62 // loading. |
58 void StartAddressNormalization(const autofill::AutofillProfile& profile, | 63 void StartAddressNormalization(const autofill::AutofillProfile& profile, |
59 const std::string& region_code, | 64 const std::string& region_code, |
60 int timeout_seconds, | 65 int timeout_seconds, |
61 Delegate* requester); | 66 Delegate* requester); |
62 | 67 |
63 private: | 68 private: |
64 // Called when the validation rules for the |region_code| have finished | 69 // Called when the validation rules for the |region_code| have finished |
65 // loading. Implementation of the LoadRulesListener interface. | 70 // loading. Implementation of the LoadRulesListener interface. |
66 void OnAddressValidationRulesLoaded(const std::string& region_code, | 71 void OnAddressRulesLoaded(const std::string& region_code, |
67 bool success) override; | 72 bool success) override; |
68 | 73 |
69 // Map associating a region code to pending normalizations. | 74 // Map associating a region code to pending normalizations. |
70 std::map<std::string, std::vector<std::unique_ptr<Request>>> | 75 std::map<std::string, std::vector<std::unique_ptr<Request>>> |
71 pending_normalization_; | 76 pending_normalization_; |
72 | 77 |
73 // The address validator used to normalize addresses. | 78 // The address validator used to normalize addresses. |
74 autofill::AddressValidator address_validator_; | 79 autofill::AddressValidator address_validator_; |
75 | 80 |
76 DISALLOW_COPY_AND_ASSIGN(AddressNormalizer); | 81 DISALLOW_COPY_AND_ASSIGN(AddressNormalizer); |
77 }; | 82 }; |
78 | 83 |
79 } // namespace payments | 84 } // namespace payments |
80 | 85 |
81 #endif // COMPONENTS_PAYMENTS_ADDRESS_NORMALIZER_H_ | 86 #endif // COMPONENTS_PAYMENTS_ADDRESS_NORMALIZER_H_ |
OLD | NEW |