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

Unified Diff: components/autofill/core/browser/autofill_profile.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, 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: components/autofill/core/browser/autofill_profile.cc
diff --git a/components/autofill/core/browser/autofill_profile.cc b/components/autofill/core/browser/autofill_profile.cc
index 3e7e7aa14c5a5195f8b7fa5bca780f49c3c042a7..77be3fc7642fa50035622d2d0eb98771e1cee571 100644
--- a/components/autofill/core/browser/autofill_profile.cc
+++ b/components/autofill/core/browser/autofill_profile.cc
@@ -262,6 +262,7 @@ AutofillProfile& AutofillProfile::operator=(const AutofillProfile& profile) {
phone_number_[i].set_profile(this);
address_ = profile.address_;
+ set_language_code(profile.language_code());
return *this;
}
@@ -401,7 +402,6 @@ bool AutofillProfile::IsPresentButInvalid(ServerFieldType type) const {
}
}
-
int AutofillProfile::Compare(const AutofillProfile& profile) const {
const ServerFieldType single_value_types[] = {
COMPANY_NAME,
@@ -447,9 +447,28 @@ int AutofillProfile::Compare(const AutofillProfile& profile) const {
return 0;
}
+bool AutofillProfile::EqualsSansOrigin(const AutofillProfile& profile) const {
+ return guid() == profile.guid() &&
+ language_code() == profile.language_code() &&
+ Compare(profile) == 0;
+}
+
+bool AutofillProfile::EqualsSansGuid(const AutofillProfile& profile) const {
+ return origin() == profile.origin() &&
+ language_code() == profile.language_code() &&
+ Compare(profile) == 0;
Ilya Sherman 2014/04/09 23:17:49 nit: Perhaps call EqualsSansGuidAndOrigin() from b
please use gerrit instead 2014/04/09 23:43:58 EqualsSansGuidAndOrigin() is removed, as it's no l
+}
+
+bool AutofillProfile::EqualsSansGuidAndOrigin(
+ const AutofillProfile& profile) const {
+ return language_code() == profile.language_code() &&
+ Compare(profile) == 0;
+}
+
bool AutofillProfile::operator==(const AutofillProfile& profile) const {
return guid() == profile.guid() &&
origin() == profile.origin() &&
+ language_code() == profile.language_code() &&
Compare(profile) == 0;
Ilya Sherman 2014/04/09 23:17:49 nit: Perhaps call one of EqualsSans...() methods h
please use gerrit instead 2014/04/09 23:43:58 Calling EqualsSansGuid().
}
@@ -500,6 +519,7 @@ void AutofillProfile::OverwriteWithOrAddTo(const AutofillProfile& profile,
// Verified profiles should never be overwritten with unverified data.
DCHECK(!IsVerified() || profile.IsVerified());
set_origin(profile.origin());
+ set_language_code(profile.language_code());
ServerFieldTypeSet field_types;
profile.GetNonEmptyTypes(app_locale, &field_types);
@@ -845,6 +865,8 @@ std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile) {
<< " "
<< UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY))
<< " "
+ << profile.language_code()
+ << " "
<< UTF16ToUTF8(MultiString(profile, PHONE_HOME_WHOLE_NUMBER));
}

Powered by Google App Engine
This is Rietveld 408576698