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

Unified Diff: chrome/browser/autofill/autofill_profile.cc

Issue 5913004: Clean up AutoFillProfile::CreateInferredLabels() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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
« no previous file with comments | « chrome/browser/autofill/autofill_profile.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/autofill_profile.cc
diff --git a/chrome/browser/autofill/autofill_profile.cc b/chrome/browser/autofill/autofill_profile.cc
index c6b78904adfc5d300a9e1e08d6468e25767f07ba..b36c52b1e5f306aeb96bcfc987246aeac9d0ae64 100644
--- a/chrome/browser/autofill/autofill_profile.cc
+++ b/chrome/browser/autofill/autofill_profile.cc
@@ -367,10 +367,10 @@ void AutoFillProfile::CreateInferredLabels(
unique_fields.resize(std::max(field_it + 1, minimal_fields_shown));
new_label =
profiles->at(*similar_profiles)->ConstructInferredLabel(
- &unique_fields);
+ unique_fields);
} else {
new_label =
- profiles->at(*similar_profiles)->ConstructInferredLabel(&fields);
+ profiles->at(*similar_profiles)->ConstructInferredLabel(fields);
}
(*created_labels)[*similar_profiles] = new_label;
}
@@ -389,7 +389,7 @@ void AutoFillProfile::CreateInferredLabels(
(*created_labels)[label_iterator->second.front()] =
profiles->at(label_iterator->second.front())->ConstructInferredLabel(
- &non_empty_fields);
+ non_empty_fields);
}
}
}
@@ -469,25 +469,27 @@ Address* AutoFillProfile::GetHomeAddress() {
}
string16 AutoFillProfile::ConstructInferredLabel(
- const std::vector<AutoFillFieldType>* included_fields) const {
- DCHECK(included_fields);
+ const std::vector<AutoFillFieldType>& included_fields) const {
+ const string16 separator =
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADDRESS_SUMMARY_SEPARATOR);
+
string16 label;
- string16 separator = l10n_util::GetStringUTF16(
- IDS_AUTOFILL_DIALOG_ADDRESS_SUMMARY_SEPARATOR);
for (std::vector<AutoFillFieldType>::const_iterator it =
- included_fields->begin(); it != included_fields->end(); ++it) {
+ included_fields.begin();
+ it != included_fields.end(); ++it) {
string16 field = GetFieldText(AutoFillType(*it));
- if (!field.empty()) {
- if (!label.empty()) {
- label.append(separator);
- }
- // Fax number has special format, to indicate that this is a fax number.
- if (*it == PHONE_FAX_WHOLE_NUMBER) {
- field = l10n_util::GetStringFUTF16(
- IDS_AUTOFILL_DIALOG_ADDRESS_SUMMARY_FAX_FORMAT, field);
- }
- label.append(field);
+ if (field.empty())
+ continue;
+
+ if (!label.empty())
+ label.append(separator);
+
+ // Fax number has special format, to indicate that this is a fax number.
+ if (*it == PHONE_FAX_WHOLE_NUMBER) {
+ field = l10n_util::GetStringFUTF16(
+ IDS_AUTOFILL_DIALOG_ADDRESS_SUMMARY_FAX_FORMAT, field);
}
+ label.append(field);
}
return label;
}
« no previous file with comments | « chrome/browser/autofill/autofill_profile.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698