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

Unified Diff: chrome/browser/ui/autofill/data_model_wrapper.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: chrome/browser/ui/autofill/data_model_wrapper.cc
diff --git a/chrome/browser/ui/autofill/data_model_wrapper.cc b/chrome/browser/ui/autofill/data_model_wrapper.cc
index c9bf70fb88cf1cc741b1835fa176cb4d03af5b68..781c614ca4dc214c46778e2783d885cef14e9128 100644
--- a/chrome/browser/ui/autofill/data_model_wrapper.cc
+++ b/chrome/browser/ui/autofill/data_model_wrapper.cc
@@ -10,6 +10,7 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/ui/autofill/autofill_dialog_common.h"
+#include "chrome/browser/ui/autofill/autofill_dialog_i18n_input.h"
#include "chrome/browser/ui/autofill/autofill_dialog_models.h"
#include "components/autofill/content/browser/wallet/full_wallet.h"
#include "components/autofill/content/browser/wallet/wallet_address.h"
@@ -60,28 +61,9 @@ bool DataModelWrapper::GetDisplayText(
// Format the address.
::i18n::addressinput::AddressData address_data;
- address_data.recipient = UTF16ToUTF8(
- GetInfoForDisplay(AutofillType(NAME_FULL)));
- address_data.country_code = UTF16ToASCII(
- GetInfoForDisplay(AutofillType(HTML_TYPE_COUNTRY_CODE,
- HTML_MODE_SHIPPING)));
- address_data.administrative_area = UTF16ToUTF8(
- GetInfoForDisplay(AutofillType(ADDRESS_HOME_STATE)));
- address_data.locality = UTF16ToUTF8(
- GetInfoForDisplay(AutofillType(ADDRESS_HOME_CITY)));
- address_data.dependent_locality = UTF16ToUTF8(
- GetInfoForDisplay(AutofillType(ADDRESS_HOME_DEPENDENT_LOCALITY)));
- address_data.sorting_code = UTF16ToUTF8(
- GetInfoForDisplay(AutofillType(ADDRESS_HOME_SORTING_CODE)));
- address_data.postal_code = UTF16ToUTF8(
- GetInfoForDisplay(AutofillType(ADDRESS_HOME_ZIP)));
-
- address_data.address_lines.push_back(UTF16ToUTF8(
- GetInfoForDisplay(AutofillType(ADDRESS_HOME_LINE1))));
- base::string16 address2 = GetInfoForDisplay(AutofillType(ADDRESS_HOME_LINE2));
- if (!address2.empty())
- address_data.address_lines.push_back(UTF16ToUTF8(address2));
-
+ i18ninput::CreateAddressData(
+ base::Bind(&DataModelWrapper::GetInfo, base::Unretained(this)),
+ &address_data);
std::vector<std::string> lines;
address_data.FormatForDisplay(&lines);
@@ -362,14 +344,4 @@ base::string16 FullWalletShippingWrapper::GetInfo(
type, g_browser_process->GetApplicationLocale());
}
-FieldMapWrapper::FieldMapWrapper(const FieldValueMap& field_map)
- : field_map_(field_map) {}
-
-FieldMapWrapper::~FieldMapWrapper() {}
-
-base::string16 FieldMapWrapper::GetInfo(const AutofillType& type) const {
- FieldValueMap::const_iterator it = field_map_.find(type.server_type());
- return it != field_map_.end() ? it->second : base::string16();
-}
-
} // namespace autofill
« no previous file with comments | « chrome/browser/ui/autofill/data_model_wrapper.h ('k') | chrome/browser/ui/autofill/data_model_wrapper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698