Commit f0ae3352 authored by manukh's avatar manukh Committed by Commit Bot

[omnibox] Add ACMatch::RecordAdditionalInfo overload for base::string16.

Previously, there were overloads accepting values of std::string, int,
and base::Time. This CL adds 1 more overload accepting values of

base: :string16 in order to not require callees to convert with
base: :UTF16ToUTF8().
Change-Id: I376faf110770c3db142ddefb55995858a37d8ef0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2417306Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Commit-Queue: manuk hovanesian <manukh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808489}
parent 5f450a37
......@@ -825,7 +825,7 @@ void AutocompleteController::UpdateHeaderInfoFromZeroSuggestProvider(
const base::string16 header = result->GetHeaderForGroupId(group_id);
if (!header.empty()) {
match.RecordAdditionalInfo("header string", base::UTF16ToUTF8(header));
match.RecordAdditionalInfo("header string", header);
} else {
// Strip all match group IDs that don't have a header string. Otherwise,
// these matches will be shown at the bottom with an empty header row.
......
......@@ -899,6 +899,11 @@ void AutocompleteMatch::RecordAdditionalInfo(const std::string& property,
additional_info[property] = value;
}
void AutocompleteMatch::RecordAdditionalInfo(const std::string& property,
const base::string16& value) {
RecordAdditionalInfo(property, base::UTF16ToUTF8(value));
}
void AutocompleteMatch::RecordAdditionalInfo(const std::string& property,
int value) {
RecordAdditionalInfo(property, base::NumberToString(value));
......
......@@ -352,6 +352,8 @@ struct AutocompleteMatch {
// Adds optional information to the |additional_info| dictionary.
void RecordAdditionalInfo(const std::string& property,
const std::string& value);
void RecordAdditionalInfo(const std::string& property,
const base::string16& value);
void RecordAdditionalInfo(const std::string& property, int value);
void RecordAdditionalInfo(const std::string& property, base::Time value);
......
......@@ -312,10 +312,9 @@ AutocompleteMatch BaseSearchProvider::CreateSearchSuggestion(
match.subtypes = suggestion.subtypes();
if (suggestion.type() == AutocompleteMatchType::SEARCH_SUGGEST_TAIL) {
match.RecordAdditionalInfo(kACMatchPropertySuggestionText,
base::UTF16ToUTF8(suggestion.suggestion()));
match.RecordAdditionalInfo(
kACMatchPropertyContentsPrefix,
base::UTF16ToUTF8(suggestion.match_contents_prefix()));
suggestion.suggestion());
match.RecordAdditionalInfo(kACMatchPropertyContentsPrefix,
suggestion.match_contents_prefix());
match.RecordAdditionalInfo(
kACMatchPropertyContentsStartIndex,
static_cast<int>(
......
......@@ -852,9 +852,8 @@ ACMatches DocumentProvider::ParseDocumentSearchResults(
AutocompleteMatch::AddLastClassificationIfNecessary(
&match.description_class_for_shortcuts, 0,
ACMatchClassification::DIM);
match.RecordAdditionalInfo(
"description_for_shortcuts",
base::UTF16ToUTF8(match.description_for_shortcuts));
match.RecordAdditionalInfo("description_for_shortcuts",
match.description_for_shortcuts);
}
if (!match.TryRichAutocompletion(
......
......@@ -266,8 +266,7 @@ AutocompleteMatch ShortcutsProvider::ShortcutToACMatch(
match.keyword = shortcut.match_core.keyword;
match.RecordAdditionalInfo("number of hits", shortcut.number_of_hits);
match.RecordAdditionalInfo("last access time", shortcut.last_access_time);
match.RecordAdditionalInfo("original input text",
base::UTF16ToUTF8(shortcut.text));
match.RecordAdditionalInfo("original input text", shortcut.text);
// Set |inline_autocompletion| and |allowed_to_be_default_match| if possible.
// If the input is in keyword mode, navigation matches cannot be the default
......
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