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

Unified Diff: components/autofill/core/browser/autofill_manager.cc

Issue 442403002: Adjust displayed phone number for prefix/suffix case. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update code as per review comments. Created 6 years, 3 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_manager.cc
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc
index 76215f39b38046eb842c258c13560f40b08cc853..3c3bbab280b0527be3011e8c7660fc04bf91a7a8 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -464,8 +464,13 @@ void AutofillManager::OnQueryFormFieldAutofill(int query_id,
GetCreditCardSuggestions(
field, type, &values, &labels, &icons, &unique_ids);
} else {
- GetProfileSuggestions(
- *form_structure, field, type, &values, &labels, &icons, &unique_ids);
+ GetProfileSuggestions(*form_structure,
+ field,
+ *autofill_field,
+ &values,
+ &labels,
+ &icons,
+ &unique_ids);
}
DCHECK_EQ(values.size(), labels.size());
@@ -1074,7 +1079,7 @@ bool AutofillManager::UpdateCachedForm(const FormData& live_form,
void AutofillManager::GetProfileSuggestions(
const FormStructure& form,
const FormFieldData& field,
- const AutofillType& type,
+ const AutofillField& autofill_field,
std::vector<base::string16>* values,
std::vector<base::string16>* labels,
std::vector<base::string16>* icons,
@@ -1086,10 +1091,18 @@ void AutofillManager::GetProfileSuggestions(
std::vector<GUIDPair> guid_pairs;
personal_data_->GetProfileSuggestions(
- type, field.value, field.is_autofilled, field_types,
+ autofill_field.Type(), field.value, field.is_autofilled, field_types,
base::Callback<bool(const AutofillProfile&)>(),
values, labels, icons, &guid_pairs);
+ // Adjust phone number to display in prefix/suffix case.
+ if (autofill_field.Type().GetStorableType() == PHONE_HOME_NUMBER) {
+ for (size_t i = 0; i < values->size(); ++i) {
+ (*values)[i] = AutofillField::GetPhoneNumberValue(
+ autofill_field, (*values)[i], field);
+ }
+ }
+
for (size_t i = 0; i < guid_pairs.size(); ++i) {
unique_ids->push_back(PackGUIDs(GUIDPair(std::string(), 0),
guid_pairs[i]));

Powered by Google App Engine
This is Rietveld 408576698