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 #include "components/payments/core/address_normalizer.h" | 5 #include "components/payments/core/address_normalizer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 146 } |
147 | 147 |
148 it->second.push_back(std::move(request)); | 148 it->second.push_back(std::move(request)); |
149 | 149 |
150 // Start loading the rules for that region. If the rules were already in the | 150 // Start loading the rules for that region. If the rules were already in the |
151 // process of being loaded, this call will do nothing. | 151 // process of being loaded, this call will do nothing. |
152 LoadRulesForRegion(region_code); | 152 LoadRulesForRegion(region_code); |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
156 void AddressNormalizer::OnAddressValidationRulesLoaded( | 156 void AddressNormalizer::OnAddressRulesLoaded(const std::string& region_code, |
157 const std::string& region_code, | 157 bool success) { |
158 bool success) { | |
159 // Check if an address normalization is pending. | 158 // Check if an address normalization is pending. |
160 auto it = pending_normalization_.find(region_code); | 159 auto it = pending_normalization_.find(region_code); |
161 if (it != pending_normalization_.end()) { | 160 if (it != pending_normalization_.end()) { |
162 for (size_t i = 0; i < it->second.size(); ++i) { | 161 for (size_t i = 0; i < it->second.size(); ++i) { |
163 it->second[i]->OnRulesLoaded(success); | 162 it->second[i]->OnRulesLoaded(success); |
164 } | 163 } |
165 pending_normalization_.erase(it); | 164 pending_normalization_.erase(it); |
166 } | 165 } |
167 } | 166 } |
168 | 167 |
169 } // namespace payments | 168 } // namespace payments |
OLD | NEW |