Commit 64e2a6e7 authored by Travis Skare's avatar Travis Skare Committed by Commit Bot

[omnibox] Rich calculator suggestions: use answer for fill_into_edit.

Putting the result of the calculation into fill_into_edit places it in the
omnibox when the user focuses the suggestion, allowing them to copy the
result or use it as the basis of another calculation. Whereas leaving the
query as the operands allows the user to still use the suggestion to
get to a SRP with a calculator on it, which is more useful than searching
for the result.

Bug: 896407
Change-Id: Ie42ad7d21824af6d518414b6d2bb5212bba7580c
Reviewed-on: https://chromium-review.googlesource.com/c/1287181
Commit-Queue: Travis Skare <skare@chromium.org>
Reviewed-by: default avatarKevin Bailey <krb@chromium.org>
Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601712}
parent 99de170b
......@@ -314,11 +314,13 @@ AutocompleteMatch BaseSearchProvider::CreateSearchSuggestion(
DCHECK(search_url.SupportsReplacement(search_terms_data));
base::string16 query(suggestion.suggestion());
base::string16 original_query(input.text());
base::string16 fill_into_edit(suggestion.suggestion());
if (suggestion.type() == AutocompleteMatchType::CALCULATOR) {
// Use query text, rather than the calculator answer suggestion, to search.
query = original_query;
original_query.clear();
}
match.fill_into_edit.append(query);
match.fill_into_edit.append(fill_into_edit);
match.search_terms_args.reset(new TemplateURLRef::SearchTermsArgs(query));
match.search_terms_args->original_query = original_query;
match.search_terms_args->accepted_suggestion = accepted_suggestion;
......
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