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

Unified Diff: chrome/browser/ui/autofill/data_model_wrapper.cc

Issue 212873003: Store the language code for the address in autofill profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixups Created 6 years, 8 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 9baf8310de01be0de7acacd9d36e31bb245eb314..4c0930e34e30c807d759dbc3ca014c72248fb5ff 100644
--- a/chrome/browser/ui/autofill/data_model_wrapper.cc
+++ b/chrome/browser/ui/autofill/data_model_wrapper.cc
@@ -59,6 +59,7 @@ bool DataModelWrapper::GetDisplayText(
i18ninput::CreateAddressData(
base::Bind(&DataModelWrapper::GetInfo, base::Unretained(this)),
&address_data);
+ address_data.language_code = GetLanguageCode();
std::vector<std::string> lines;
address_data.FormatForDisplay(&lines);
@@ -72,8 +73,7 @@ bool DataModelWrapper::GetDisplayText(
// The separator is locale-specific.
std::string compact_separator =
- ::i18n::addressinput::GetCompactAddressLinesSeparator(
- g_browser_process->GetApplicationLocale());
+ ::i18n::addressinput::GetCompactAddressLinesSeparator(GetLanguageCode());
*vertically_compact =
base::UTF8ToUTF16(JoinString(lines, compact_separator)) +
non_address_info;
@@ -83,6 +83,10 @@ bool DataModelWrapper::GetDisplayText(
return true;
}
+const std::string& DataModelWrapper::GetLanguageCode() const {
+ return g_browser_process->GetApplicationLocale();
+}
+
bool DataModelWrapper::FillFormStructure(
const std::vector<ServerFieldType>& types,
const FormStructure::InputFieldComparator& compare,
@@ -150,6 +154,10 @@ base::string16 AutofillProfileWrapper::GetInfoForDisplay(
return DataModelWrapper::GetInfoForDisplay(type);
}
+const std::string& AutofillProfileWrapper::GetLanguageCode() const {
+ return profile_->language_code();
+}
+
size_t AutofillProfileWrapper::GetVariantForType(const AutofillType& type)
const {
if (type.group() == variant_group_)
@@ -363,4 +371,8 @@ base::string16 I18nAddressDataWrapper::GetInfo(const AutofillType& type) const {
return base::UTF8ToUTF16(address_->GetFieldValue(field));
}
+const std::string& I18nAddressDataWrapper::GetLanguageCode() const {
+ return address_->language_code;
+}
+
} // namespace autofill
« no previous file with comments | « chrome/browser/ui/autofill/data_model_wrapper.h ('k') | components/autofill/core/browser/autofill_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698