Commit fbbfaf0a authored by Orin Jaworski's avatar Orin Jaworski Committed by Commit Bot

[omnibox] Fix match upgrade creating duplicate Pedal attachments

This CL prevents duplicate Pedal attachments from appearing in
omnibox suggestions as a result of match upgrades. It was
previously expected that duplicate matches, once buried, would
not be used or shown again, but that is not the case when entity
suggestions are involved.

Bug: 1122183
Change-Id: I4539d51304cf3a1acad87ecbf80c7c51749a2398
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2376722Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Commit-Queue: Orin Jaworski <orinj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802026}
parent 5e803e36
...@@ -1104,7 +1104,7 @@ size_t AutocompleteMatch::EstimateMemoryUsage() const { ...@@ -1104,7 +1104,7 @@ size_t AutocompleteMatch::EstimateMemoryUsage() const {
} }
void AutocompleteMatch::UpgradeMatchWithPropertiesFrom( void AutocompleteMatch::UpgradeMatchWithPropertiesFrom(
const AutocompleteMatch& duplicate_match) { AutocompleteMatch& duplicate_match) {
// For Entity Matches, absorb the duplicate match's |allowed_to_be_default| // For Entity Matches, absorb the duplicate match's |allowed_to_be_default|
// and |inline_autocomplete| properties. // and |inline_autocomplete| properties.
if (type == AutocompleteMatchType::SEARCH_SUGGEST_ENTITY && if (type == AutocompleteMatchType::SEARCH_SUGGEST_ENTITY &&
...@@ -1136,6 +1136,7 @@ void AutocompleteMatch::UpgradeMatchWithPropertiesFrom( ...@@ -1136,6 +1136,7 @@ void AutocompleteMatch::UpgradeMatchWithPropertiesFrom(
// Take the |pedal|, if any, so that it will be presented instead of buried. // Take the |pedal|, if any, so that it will be presented instead of buried.
if (!pedal && duplicate_match.pedal) { if (!pedal && duplicate_match.pedal) {
pedal = duplicate_match.pedal; pedal = duplicate_match.pedal;
duplicate_match.pedal = nullptr;
} }
} }
......
...@@ -423,7 +423,7 @@ struct AutocompleteMatch { ...@@ -423,7 +423,7 @@ struct AutocompleteMatch {
// Upgrades this match by absorbing the best properties from // Upgrades this match by absorbing the best properties from
// |duplicate_match|. For instance: if |duplicate_match| has a higher // |duplicate_match|. For instance: if |duplicate_match| has a higher
// relevance score, this match's own relevance score will be upgraded. // relevance score, this match's own relevance score will be upgraded.
void UpgradeMatchWithPropertiesFrom(const AutocompleteMatch& duplicate_match); void UpgradeMatchWithPropertiesFrom(AutocompleteMatch& duplicate_match);
// Called for navigation suggestions whose URLs cannot be inline autocompleted // Called for navigation suggestions whose URLs cannot be inline autocompleted
// (e.g. because the input is not a prefix of the URL), to check if |title| // (e.g. because the input is not a prefix of the URL), to check if |title|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment