Index: components/autofill/browser/validation.cc |
diff --git a/components/autofill/browser/validation.cc b/components/autofill/browser/validation.cc |
index c5779fb2596e75eb2b08477158bfcdd4bf8a35b1..c9a09f8140d7d7f05ea7d1b42162831eb3407c94 100644 |
--- a/components/autofill/browser/validation.cc |
+++ b/components/autofill/browser/validation.cc |
@@ -10,6 +10,7 @@ |
#include "base/utf_string_conversions.h" |
#include "components/autofill/browser/autofill_regexes.h" |
#include "components/autofill/browser/credit_card.h" |
+#include "components/autofill/browser/state_names.h" |
namespace autofill { |
@@ -110,9 +111,14 @@ bool IsValidEmailAddress(const base::string16& text) { |
return MatchesPattern(text, kEmailPattern); |
} |
-bool IsValidZip(const base::string16& value) { |
+bool IsValidState(const base::string16& text) { |
+ return !state_names::GetAbbreviationForName(text).empty() || |
+ !state_names::GetNameForAbbreviation(text).empty(); |
+} |
+ |
+bool IsValidZip(const base::string16& text) { |
const base::string16 kZipPattern = ASCIIToUTF16("^\\d{5}(-\\d{4})?$"); |
- return MatchesPattern(value, kZipPattern); |
+ return MatchesPattern(text, kZipPattern); |
} |
} // namespace autofill |