Commit 8c5dbbac authored by Justin Donnelly's avatar Justin Donnelly Committed by Commit Bot

[omnibox] Include additional_query_params when deduping in AcMatch.

This is basically a re-land of https://crrev.com/c/1273620 which
restores the old approach to entity suggestions, which is to never
dedupe them with a plain suggestion containing the same query text. By
including additional_query_params, entity suggestions will always be
considered distinct, even if they have the same query text as another
search suggestion.

Bug: 806995
Change-Id: If9b5b5f876259a1289e3eb093bd24935a74dba51
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1658510Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Commit-Queue: Justin Donnelly <jdonnelly@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681917}
parent c5935392
......@@ -592,7 +592,8 @@ GURL AutocompleteMatch::GURLToStrippedGURL(
const GURL& url,
const AutocompleteInput& input,
const TemplateURLService* template_url_service,
const base::string16& keyword) {
const base::string16& keyword,
const std::string& additional_query_params) {
if (!url.is_valid())
return url;
......@@ -619,10 +620,12 @@ GURL AutocompleteMatch::GURLToStrippedGURL(
stripped_destination_url,
template_url_service->search_terms_data(),
&search_terms)) {
TemplateURLRef::SearchTermsArgs search_terms_args(search_terms);
if (!additional_query_params.empty())
search_terms_args.additional_query_params = additional_query_params;
stripped_destination_url =
GURL(template_url->url_ref().ReplaceSearchTerms(
TemplateURLRef::SearchTermsArgs(search_terms),
template_url_service->search_terms_data()));
search_terms_args, template_url_service->search_terms_data()));
}
}
......
......@@ -259,10 +259,16 @@ struct AutocompleteMatch {
// - If the match's keyword is known, it can be provided in |keyword|.
// Otherwise, it can be left empty and the template URL (if any) is
// determined from the destination's hostname.
static GURL GURLToStrippedGURL(const GURL& url,
// - If |additional_query_params| is provided, these will be added to the
// resulting URL in the cases where a template URL is used. This is used to
// distinguish cases such as entity suggestions where the response contains
// additional meaningful parameters beyond the search terms themselves.
static GURL GURLToStrippedGURL(
const GURL& url,
const AutocompleteInput& input,
const TemplateURLService* template_url_service,
const base::string16& keyword);
const base::string16& keyword,
const std::string& additional_query_params = "");
// Sets the |match_in_scheme| and |match_in_subdomain| flags based on the
// provided |url| and list of substring |match_positions|. |match_positions|
......
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