Skip to content

Commit

Permalink
[Omnibox] Add rich entity types to the metrics enum.
Browse files Browse the repository at this point in the history
This will allow us to calculate CTR metrics for the Omnibox rich entity
subtypes.

Bug: 1130372
Change-Id: I2476d65c404296ffe47065b57a65fc4e5c463c84
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2719747
Reviewed-by: Thanh Nguyen <thanhdng@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Rachel Wong <wrong@chromium.org>
Cr-Commit-Position: refs/heads/master@{#858454}
  • Loading branch information
Rachel Wong authored and Chromium LUCI CQ committed Mar 1, 2021
1 parent 90f3508 commit 888da62
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ash/public/cpp/app_list/app_list_metrics.h
Expand Up @@ -98,6 +98,10 @@ enum SearchResultType {
OMNIBOX_SEARCH_SUGGEST_ENTITY,
// A result from omnibox for suggested navigation.
OMNIBOX_NAVSUGGEST,
// An answer rich entity result from omnibox.
OMNIBOX_RICH_ENTITY_ANSWER,
// A rich entity result from omnibox with image icon.
OMNIBOX_RICH_ENTITY_IMAGE_ENTITY,
// Boundary is always last.
SEARCH_RESULT_TYPE_BOUNDARY
};
Expand Down
9 changes: 9 additions & 0 deletions chrome/browser/ui/app_list/search/omnibox_result.cc
Expand Up @@ -238,6 +238,9 @@ OmniboxResult::OmniboxResult(Profile* profile,
SetOmniboxType(OmniboxType::kAnswer);
// The answer subtype overrides the match subtype.
set_result_subtype(static_cast<int>(match_.answer->type()));
} else if (match_.type == AutocompleteMatchType::CALCULATOR) {
// Calculator results are treated as answers.
SetOmniboxType(OmniboxType::kAnswer);
} else if (!match_.image_url.is_empty()) {
SetOmniboxType(OmniboxType::kRichImage);
}
Expand Down Expand Up @@ -297,6 +300,12 @@ void OmniboxResult::OnFetchComplete(const GURL& url, const SkBitmap* bitmap) {
}

ash::SearchResultType OmniboxResult::GetSearchResultType() const {
// Rich entity types take precedence.
if (omnibox_type() == OmniboxType::kAnswer)
return ash::OMNIBOX_RICH_ENTITY_ANSWER;
if (omnibox_type() == OmniboxType::kRichImage)
return ash::OMNIBOX_RICH_ENTITY_IMAGE_ENTITY;

switch (match_.type) {
case AutocompleteMatchType::URL_WHAT_YOU_TYPED:
return ash::OMNIBOX_URL_WHAT_YOU_TYPED;
Expand Down
2 changes: 2 additions & 0 deletions tools/metrics/histograms/enums.xml
Expand Up @@ -3126,6 +3126,8 @@ Unknown properties are collapsed to zero. -->
<int value="37" label="Help App"/>
<int value="38" label="Omnibox, Search Suggest Entity"/>
<int value="39" label="Omnibox, Navsuggest"/>
<int value="40" label="Omnibox Rich Entity, Answer"/>
<int value="41" label="Omnibox Rich Entity, Image Entity"/>
</enum>

<enum name="AppListSearchResultDisplayType">
Expand Down

0 comments on commit 888da62

Please sign in to comment.