Chromium Code Reviews| Index: components/payments/core/address_normalizer_impl.h |
| diff --git a/components/payments/core/address_normalizer_impl.h b/components/payments/core/address_normalizer_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3762281e9db7fe38c8d1c3fcef30a1791d684abb |
| --- /dev/null |
| +++ b/components/payments/core/address_normalizer_impl.h |
| @@ -0,0 +1,61 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_PAYMENTS_CORE_ADDRESS_NORMALIZER_IMPL_H_ |
| +#define COMPONENTS_PAYMENTS_CORE_ADDRESS_NORMALIZER_IMPL_H_ |
| + |
| +#include <map> |
| +#include <memory> |
| +#include <vector> |
|
please use gerrit instead
2017/04/21 15:09:31
#include <string>
sebsg
2017/04/21 15:17:48
Done.
|
| + |
| +#include "base/macros.h" |
| +#include "components/payments/core/address_normalizer.h" |
| + |
| +namespace autofill { |
| +class AutofillProfile; |
| +} |
| + |
| +namespace i18n { |
| +namespace libadderssinput { |
|
please use gerrit instead
2017/04/21 15:07:34
Still misspelled here.
sebsg
2017/04/21 15:17:48
Done.
|
| +class Source; |
| +class Storage; |
| +} |
| +} |
| + |
| +namespace payments { |
| + |
| +// A class used to normalize addresses. |
| +class AddressNormalizerImpl : public AddressNormalizer { |
| + public: |
| + AddressNormalizerImpl(std::unique_ptr<::i18n::addressinput::Source> source, |
| + std::unique_ptr<::i18n::addressinput::Storage> storage); |
| + ~AddressNormalizerImpl() override; |
| + |
| + // AddressNormalizer implementation. |
| + void LoadRulesForRegion(const std::string& region_code) override; |
| + bool AreRulesLoadedForRegion(const std::string& region_code) override; |
| + void StartAddressNormalization(const autofill::AutofillProfile& profile, |
| + const std::string& region_code, |
| + int timeout_seconds, |
| + Delegate* requester) override; |
| + |
| + private: |
| + // Called when the validation rules for the |region_code| have finished |
| + // loading. Implementation of the LoadRulesListener interface. |
| + void OnAddressValidationRulesLoaded(const std::string& region_code, |
| + bool success) override; |
| + |
| + // Map associating a region code to pending normalizations. |
| + std::map<std::string, std::vector<std::unique_ptr<Request>>> |
| + pending_normalization_; |
| + |
| + // The address validator used to normalize addresses. |
| + autofill::AddressValidator address_validator_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AddressNormalizerImpl); |
| +}; |
| + |
| +} // namespace payments |
| + |
| +#endif // COMPONENTS_PAYMENTS_CORE_ADDRESS_NORMALIZER_IMPL_H_ |