| Index: components/autofill/core/browser/address.cc
|
| diff --git a/components/autofill/core/browser/address.cc b/components/autofill/core/browser/address.cc
|
| index 813d61556914a761913f715715e3ee06bed498b5..3a44121606db624caf2320cff7e3a38693ea1e75 100644
|
| --- a/components/autofill/core/browser/address.cc
|
| +++ b/components/autofill/core/browser/address.cc
|
| @@ -7,11 +7,13 @@
|
| #include <stddef.h>
|
| #include <algorithm>
|
|
|
| +#include "base/i18n/case_conversion.h"
|
| #include "base/logging.h"
|
| #include "base/strings/string_split.h"
|
| #include "base/strings/string_util.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "components/autofill/core/browser/autofill_country.h"
|
| +#include "components/autofill/core/browser/autofill_data_util.h"
|
| #include "components/autofill/core/browser/autofill_field.h"
|
| #include "components/autofill/core/browser/autofill_profile.h"
|
| #include "components/autofill/core/browser/autofill_profile_comparator.h"
|
| @@ -134,8 +136,8 @@ void Address::SetRawInfo(ServerFieldType type, const base::string16& value) {
|
|
|
| case ADDRESS_HOME_COUNTRY:
|
| DCHECK(value.empty() ||
|
| - (value.length() == 2u && base::IsStringASCII(value)));
|
| - country_code_ = base::UTF16ToASCII(value);
|
| + data_util::IsValidCountryCode(base::i18n::ToUpper(value)));
|
| + country_code_ = base::ToUpperASCII(base::UTF16ToASCII(value));
|
| break;
|
|
|
| case ADDRESS_HOME_ZIP:
|
| @@ -173,7 +175,7 @@ bool Address::SetInfo(const AutofillType& type,
|
| const base::string16& value,
|
| const std::string& app_locale) {
|
| if (type.html_type() == HTML_TYPE_COUNTRY_CODE) {
|
| - if (!value.empty() && (value.size() != 2u || !base::IsStringASCII(value))) {
|
| + if (!data_util::IsValidCountryCode(base::i18n::ToUpper(value))) {
|
| country_code_ = std::string();
|
| return false;
|
| }
|
|
|