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

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: Address comments. Created 6 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
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 7c0b9dfc279d4adf20c1fd3614c06e8d794426c2..9a74793f993348675fed0be204c0f9a8bad97b66 100644
--- a/chrome/browser/ui/autofill/data_model_wrapper.cc
+++ b/chrome/browser/ui/autofill/data_model_wrapper.cc
@@ -58,6 +58,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);
@@ -71,8 +72,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;
@@ -82,6 +82,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,
@@ -149,6 +153,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_)
@@ -362,4 +370,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

Powered by Google App Engine
This is Rietveld 408576698