Chromium Code Reviews| Index: components/autofill/core/browser/autofill_external_delegate.cc |
| diff --git a/components/autofill/core/browser/autofill_external_delegate.cc b/components/autofill/core/browser/autofill_external_delegate.cc |
| index f06b2d51d7e82e732f1212098ff50369dae5c0e3..74e8a7f218af4a45fc47c7c4134d1293175e006d 100644 |
| --- a/components/autofill/core/browser/autofill_external_delegate.cc |
| +++ b/components/autofill/core/browser/autofill_external_delegate.cc |
| @@ -309,9 +309,22 @@ void AutofillExternalDelegate::InsertDataListValues( |
| if (data_list_values_.empty()) |
| return; |
| + // Go through the list of autocomplete values and remove them if they are in |
| + // the list of datalist values. |
| + std::set<base::string16> datalist_set(data_list_values_.begin(), |
|
Evan Stade
2015/11/19 03:13:03
please keep datalist/data_list consistent
Mathieu
2015/11/19 13:22:17
Done.
|
| + data_list_values_.end()); |
| + for (auto iter = suggestions->begin(); iter != suggestions->end();) { |
|
Evan Stade
2015/11/19 03:13:03
std::remove_if(suggestions->begin(),
Evan Stade
2015/11/19 03:19:51
note that you might have to put a & or something i
vabr (Chromium)
2015/11/19 08:26:04
Please use [&datalist_set], not just [&], because
Mathieu
2015/11/19 13:22:16
Done.
Mathieu
2015/11/19 13:22:17
Done.
Mathieu
2015/11/19 13:22:17
Done.
|
| + if (datalist_set.count(iter->value) && |
|
vabr (Chromium)
2015/11/19 08:26:04
optional: While using .count() results in succinct
Mathieu
2015/11/19 13:22:17
Ah thanks! Done.
|
| + iter->frontend_id == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) { |
| + iter = suggestions->erase(iter); |
| + continue; |
| + } |
| + ++iter; |
| + } |
| + |
| #if !defined(OS_ANDROID) |
| - // Insert the separator between the datalist and Autofill values (if there |
| - // are any). |
| + // Insert the separator between the datalist and Autofill/Autocomplete values |
| + // (if there are any). |
| if (!suggestions->empty()) { |
| suggestions->insert(suggestions->begin(), Suggestion()); |
| (*suggestions)[0].frontend_id = POPUP_ITEM_ID_SEPARATOR; |