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

Unified Diff: third_party/libaddressinput/chromium/cpp/src/address_validator.cc

Issue 145553009: rAc: use libaddressinput to validate international addresses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 11 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
Index: third_party/libaddressinput/chromium/cpp/src/address_validator.cc
diff --git a/third_party/libaddressinput/chromium/cpp/src/address_validator.cc b/third_party/libaddressinput/chromium/cpp/src/address_validator.cc
index b08dc83028b94de848acfde425b931ab02799033..ba56a1d8d5d2c6087c6d30e78ac0f3392607cbf7 100644
--- a/third_party/libaddressinput/chromium/cpp/src/address_validator.cc
+++ b/third_party/libaddressinput/chromium/cpp/src/address_validator.cc
@@ -79,12 +79,10 @@ class AddressValidatorImpl : public AddressValidator {
// Takes ownership of |downloader| and |storage|. Does not take ownership of
// |load_rules_delegate|.
AddressValidatorImpl(scoped_ptr<Downloader> downloader,
- scoped_ptr<Storage> storage,
+ Storage* storage,
LoadRulesDelegate* load_rules_delegate)
- : aggregator_(scoped_ptr<Retriever>(new Retriever(
- VALIDATION_DATA_URL,
- downloader.Pass(),
- storage.Pass()))),
+ : aggregator_(scoped_ptr<Retriever>(
+ new Retriever(VALIDATION_DATA_URL, downloader.Pass(), storage))),
load_rules_delegate_(load_rules_delegate),
loading_rules_(),
rules_() {}
@@ -183,10 +181,8 @@ class AddressValidatorImpl : public AddressValidator {
FilterAllows(filter,
POSTAL_CODE,
AddressProblem::MISMATCHING_VALUE) &&
- (!RE2::PartialMatch(address.postal_code,
- rule.GetPostalCodeFormat(),
- &match_position) ||
- match_position != 0)) {
+ !RE2::FullMatch(address.postal_code,
+ "^(" + rule.GetPostalCodeFormat() + ").*")) {
Evan Stade 2014/01/27 23:11:15 this should be a separate cl
Dan Beam 2014/01/28 02:22:36 Done.
problems->push_back(AddressProblem(
POSTAL_CODE,
AddressProblem::MISMATCHING_VALUE,
@@ -240,10 +236,10 @@ AddressValidator::~AddressValidator() {}
// static
scoped_ptr<AddressValidator> AddressValidator::Build(
scoped_ptr<Downloader> downloader,
- scoped_ptr<Storage> storage,
+ Storage* storage,
LoadRulesDelegate* load_rules_delegate) {
return scoped_ptr<AddressValidator>(new AddressValidatorImpl(
- downloader.Pass(), storage.Pass(), load_rules_delegate));
+ downloader.Pass(), storage, load_rules_delegate));
}
} // namespace addressinput

Powered by Google App Engine
This is Rietveld 408576698