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.

(cherry picked from commit 888da62)

Bug: 1130372, 1184507
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-Original-Commit-Position: refs/heads/master@{#858454}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2738734
Auto-Submit: Rachel Wong <wrong@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/4430@{#147}
Cr-Branched-From: e5ce7dc-refs/heads/master@{#857950}
  • Loading branch information
Rachel Wong authored and Chromium LUCI CQ committed Mar 5, 2021
1 parent decd3bb commit a6f6fda
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 a6f6fda

Please sign in to comment.