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

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: Remove duplicate documentation. 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 214963dc23d91130d0c6b67e4c69232b2c2d299e..9c7233f953d4470364c0edc98a207f8e4f07751c 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -459,8 +459,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());
@@ -1064,7 +1069,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,
@@ -1076,10 +1081,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]));
« no previous file with comments | « components/autofill/core/browser/autofill_manager.h ('k') | components/autofill/core/browser/autofill_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698