Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(598)

Unified Diff: components/payments/core/address_normalizer_impl.h

Issue 2829903004: Reland: Normalize shipping address for merchant on Desktop. (Closed)
Patch Set: Make android code use the new impl Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/payments/core/address_normalizer.cc ('k') | components/payments/core/address_normalizer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..1444e8ad43f245bd9732cf1e505636f1c4f7f79e
--- /dev/null
+++ b/components/payments/core/address_normalizer_impl.h
@@ -0,0 +1,62 @@
+// 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 <string>
+#include <vector>
+
+#include "base/macros.h"
+#include "components/payments/core/address_normalizer.h"
+
+namespace autofill {
+class AutofillProfile;
+}
+
+namespace i18n {
+namespace addressinput {
+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_
« no previous file with comments | « components/payments/core/address_normalizer.cc ('k') | components/payments/core/address_normalizer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698