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

Unified Diff: components/autofill/core/browser/validation.cc

Issue 2773383002: [Payments] In shipping address editor, enable required + phone validation. (Closed)
Patch Set: addressed comment Created 3 years, 9 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/autofill/core/browser/validation.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/validation.cc
diff --git a/components/autofill/core/browser/validation.cc b/components/autofill/core/browser/validation.cc
index d18ccbab5cfd28477a394617fa1acf7c92210ab4..71a98fdfd958a27be72999e0043329e845f76d2a 100644
--- a/components/autofill/core/browser/validation.cc
+++ b/components/autofill/core/browser/validation.cc
@@ -14,6 +14,7 @@
#include "base/time/time.h"
#include "components/autofill/core/browser/autofill_data_util.h"
#include "components/autofill/core/browser/credit_card.h"
+#include "components/autofill/core/browser/phone_number_i18n.h"
#include "components/autofill/core/browser/state_names.h"
#include "components/autofill/core/common/autofill_clock.h"
#include "components/autofill/core/common/autofill_regexes.h"
@@ -137,6 +138,12 @@ bool IsValidState(const base::string16& text) {
!state_names::GetNameForAbbreviation(text).empty();
}
+bool IsValidPhoneNumber(const base::string16& text,
+ const std::string& country_code) {
+ i18n::PhoneObject phone_number(text, country_code);
+ return phone_number.IsValidNumber();
+}
+
bool IsValidZip(const base::string16& text) {
const base::string16 kZipPattern = base::ASCIIToUTF16("^\\d{5}(-\\d{4})?$");
return MatchesPattern(text, kZipPattern);
« no previous file with comments | « components/autofill/core/browser/validation.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698