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

Side by Side Diff: components/payments/core/address_normalizer.h

Issue 2829503002: [Payments] Normalize Shipping Address sent to merchant on Desktop. (Closed)
Patch Set: Be more strict on country code 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 unified diff | Download patch
OLDNEW
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_CORE_ADDRESS_NORMALIZER_H_ 5 #ifndef COMPONENTS_PAYMENTS_CORE_ADDRESS_NORMALIZER_H_
6 #define COMPONENTS_PAYMENTS_CORE_ADDRESS_NORMALIZER_H_ 6 #define COMPONENTS_PAYMENTS_CORE_ADDRESS_NORMALIZER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 AddressNormalizer(std::unique_ptr<::i18n::addressinput::Source> source, 52 AddressNormalizer(std::unique_ptr<::i18n::addressinput::Source> source,
53 std::unique_ptr<::i18n::addressinput::Storage> storage); 53 std::unique_ptr<::i18n::addressinput::Storage> storage);
54 ~AddressNormalizer() override; 54 ~AddressNormalizer() override;
55 55
56 // Start loading the validation rules for the specified |region_code|. 56 // Start loading the validation rules for the specified |region_code|.
57 virtual void LoadRulesForRegion(const std::string& region_code); 57 virtual void LoadRulesForRegion(const std::string& region_code);
58 58
59 // Returns whether the rules for the specified |region_code| have finished 59 // Returns whether the rules for the specified |region_code| have finished
60 // loading. 60 // loading.
61 bool AreRulesLoadedForRegion(const std::string& region_code); 61 virtual bool AreRulesLoadedForRegion(const std::string& region_code);
62 62
63 // Starts the normalization of the |profile| based on the |region_code|. The 63 // Starts the normalization of the |profile| based on the |region_code|. The
64 // normalized profile will be returned to the |requester| possibly 64 // normalized profile will be returned to the |requester| possibly
65 // asynchronously. If the normalization is not completed in |timeout_seconds| 65 // asynchronously. If the normalization is not completed in |timeout_seconds|
66 // the requester will be informed and the request cancelled. This value should 66 // the requester will be informed and the request cancelled. This value should
67 // be greater or equal to 0, for which it means that the normalization should 67 // be greater or equal to 0, for which it means that the normalization should
68 // happen synchronously, or not at all if the rules are not already loaded. 68 // happen synchronously, or not at all if the rules are not already loaded.
69 // Will start loading the rules for the |region_code| if they had not started 69 // Will start loading the rules for the |region_code| if they had not started
70 // loading. 70 // loading.
71 void StartAddressNormalization(const autofill::AutofillProfile& profile, 71 virtual void StartAddressNormalization(
72 const std::string& region_code, 72 const autofill::AutofillProfile& profile,
73 int timeout_seconds, 73 const std::string& region_code,
74 Delegate* requester); 74 int timeout_seconds,
75 Delegate* requester);
75 76
76 private: 77 private:
77 // Called when the validation rules for the |region_code| have finished 78 // Called when the validation rules for the |region_code| have finished
78 // loading. Implementation of the LoadRulesListener interface. 79 // loading. Implementation of the LoadRulesListener interface.
79 void OnAddressValidationRulesLoaded(const std::string& region_code, 80 void OnAddressValidationRulesLoaded(const std::string& region_code,
80 bool success) override; 81 bool success) override;
81 82
82 // Map associating a region code to pending normalizations. 83 // Map associating a region code to pending normalizations.
83 std::map<std::string, std::vector<std::unique_ptr<Request>>> 84 std::map<std::string, std::vector<std::unique_ptr<Request>>>
84 pending_normalization_; 85 pending_normalization_;
85 86
86 // The address validator used to normalize addresses. 87 // The address validator used to normalize addresses.
87 autofill::AddressValidator address_validator_; 88 autofill::AddressValidator address_validator_;
88 89
89 DISALLOW_COPY_AND_ASSIGN(AddressNormalizer); 90 DISALLOW_COPY_AND_ASSIGN(AddressNormalizer);
90 }; 91 };
91 92
92 } // namespace payments 93 } // namespace payments
93 94
94 #endif // COMPONENTS_PAYMENTS_CORE_ADDRESS_NORMALIZER_H_ 95 #endif // COMPONENTS_PAYMENTS_CORE_ADDRESS_NORMALIZER_H_
OLDNEW
« no previous file with comments | « components/payments/content/payment_response_helper_unittest.cc ('k') | components/payments/core/payment_request_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698