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