[game search] Add game search category and result type
This adds: - games as a category - games as a result type - the "Games" UI string For the purposes of metrics added in crrev.com/c/3316241 it assumes games are apps. Bug: 1305880 Change-Id: I275a6cac09c640af7674d0ecd74cc8c4ba7397d6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3521110 Reviewed-by: Rachel Wong <wrong@chromium.org> Reviewed-by: Toni Barzic <tbarzic@chromium.org> Commit-Queue: Tony Yeoman <tby@chromium.org> Cr-Commit-Position: refs/heads/main@{#981491}
This commit is contained in:
@ -112,6 +112,8 @@ SearchResultListView::SearchResultListType CategoryToListType(
|
||||
return SearchResultListView::SearchResultListType::kPlayStore;
|
||||
case ash::AppListSearchResultCategory::kSearchAndAssistant:
|
||||
return SearchResultListView::SearchResultListType::kSearchAndAssistant;
|
||||
case ash::AppListSearchResultCategory::kGames:
|
||||
return SearchResultListView::SearchResultListType::kGames;
|
||||
case ash::AppListSearchResultCategory::kUnknown:
|
||||
NOTREACHED();
|
||||
return SearchResultListView::SearchResultListType::kUnified;
|
||||
@ -215,6 +217,10 @@ void SearchResultListView::SetListType(SearchResultListType list_type) {
|
||||
title_label_->SetText(l10n_util::GetStringUTF16(
|
||||
IDS_ASH_SEARCH_RESULT_CATEGORY_LABEL_SEARCH_AND_ASSISTANT));
|
||||
break;
|
||||
case SearchResultListType::kGames:
|
||||
title_label_->SetText(l10n_util::GetStringUTF16(
|
||||
IDS_ASH_SEARCH_RESULT_CATEGORY_LABEL_GAMES));
|
||||
break;
|
||||
}
|
||||
|
||||
switch (list_type_.value()) {
|
||||
@ -233,6 +239,7 @@ void SearchResultListView::SetListType(SearchResultListType list_type) {
|
||||
case SearchResultListType::kHelp:
|
||||
case SearchResultListType::kPlayStore:
|
||||
case SearchResultListType::kSearchAndAssistant:
|
||||
case SearchResultListType::kGames:
|
||||
title_label_->SetVisible(true);
|
||||
break;
|
||||
}
|
||||
@ -258,6 +265,7 @@ void SearchResultListView::SetListType(SearchResultListType list_type) {
|
||||
case SearchResultListType::kHelp:
|
||||
case SearchResultListType::kPlayStore:
|
||||
case SearchResultListType::kSearchAndAssistant:
|
||||
case SearchResultListType::kGames:
|
||||
DCHECK(search_result_view_type_ ==
|
||||
SearchResultView::SearchResultViewType::kDefault);
|
||||
break;
|
||||
@ -281,7 +289,8 @@ SearchResultListView::GetAllListTypesForCategoricalSearch() {
|
||||
SearchResultListType::kSettings,
|
||||
SearchResultListType::kHelp,
|
||||
SearchResultListType::kPlayStore,
|
||||
SearchResultListType::kSearchAndAssistant};
|
||||
SearchResultListType::kSearchAndAssistant,
|
||||
SearchResultListType::kGames};
|
||||
return categorical_search_types;
|
||||
}
|
||||
|
||||
@ -609,6 +618,8 @@ SearchResult::Category SearchResultListView::GetSearchCategory() {
|
||||
return SearchResult::Category::kPlayStore;
|
||||
case SearchResultListType::kSearchAndAssistant:
|
||||
return SearchResult::Category::kSearchAndAssistant;
|
||||
case SearchResultListType::kGames:
|
||||
return SearchResult::Category::kGames;
|
||||
}
|
||||
}
|
||||
|
||||
@ -640,6 +651,7 @@ std::vector<SearchResult*> SearchResultListView::GetCategorizedSearchResults() {
|
||||
case SearchResultListType::kHelp:
|
||||
case SearchResultListType::kPlayStore:
|
||||
case SearchResultListType::kSearchAndAssistant:
|
||||
case SearchResultListType::kGames:
|
||||
SearchResult::Category search_category = GetSearchCategory();
|
||||
return SearchModel::FilterSearchResultsByFunction(
|
||||
results(),
|
||||
|
@ -67,9 +67,12 @@ class ASH_EXPORT SearchResultListView : public SearchResultContainerView {
|
||||
// kPlayStore contains suggested apps from the playstore that are not
|
||||
// currently installed.
|
||||
kPlayStore,
|
||||
// kSearchAndAssistant contain suggestions from Search and Google Assistant.
|
||||
// kSearchAndAssistant contains suggestions from Search and Google
|
||||
// Assistant.
|
||||
kSearchAndAssistant,
|
||||
kMaxValue = kSearchAndAssistant,
|
||||
// kGames contains cloud game search results.
|
||||
kGames,
|
||||
kMaxValue = kGames,
|
||||
};
|
||||
|
||||
SearchResultListView(
|
||||
|
@ -1801,6 +1801,9 @@ This file contains the strings for ash.
|
||||
<message name="IDS_ASH_SEARCH_RESULT_CATEGORY_LABEL_SEARCH_AND_ASSISTANT" desc="Category title for the list of suggestions from the search provider and Google Assistant shown in launcher search that are relevant to but not the best match for the query in the search box.">
|
||||
Search and Assistant
|
||||
</message>
|
||||
<message name="IDS_ASH_SEARCH_RESULT_CATEGORY_LABEL_GAMES" desc="Category title for the list of video game search results shown in launcher search that are relevant to but not the best match for the query in the search box.">
|
||||
Games
|
||||
</message>
|
||||
<message name="IDS_ASH_SEARCH_RESULT_SEPARATOR" desc="Separator between the title and details text in ash search result view.">
|
||||
''' - '''
|
||||
</message>
|
||||
|
@ -0,0 +1 @@
|
||||
5bcf7e8548558871c5ec7175d3209fe3d671c3a8
|
@ -131,6 +131,8 @@ enum SearchResultType {
|
||||
// Null result type that indicates that user did not interact with any results
|
||||
// in some metrics.
|
||||
NO_RESULT,
|
||||
// A game search result.
|
||||
GAME_SEARCH,
|
||||
// Boundary is always last.
|
||||
SEARCH_RESULT_TYPE_BOUNDARY
|
||||
};
|
||||
|
@ -22,6 +22,7 @@ bool IsAppListSearchResultAnApp(AppListSearchResultType result_type) {
|
||||
case AppListSearchResultType::kPlayStoreReinstallApp:
|
||||
case AppListSearchResultType::kArcAppShortcut:
|
||||
case AppListSearchResultType::kInstantApp:
|
||||
case AppListSearchResultType::kGames:
|
||||
return true;
|
||||
case AppListSearchResultType::kUnknown:
|
||||
case AppListSearchResultType::kOmnibox:
|
||||
|
@ -343,8 +343,9 @@ enum class AppListSearchResultType {
|
||||
kDriveSearch, // Drive file search results.
|
||||
kKeyboardShortcut, // Keyboard shortcut search results.
|
||||
kOpenTab, // Open tab search results.
|
||||
kGames, // Game sarch results.
|
||||
// Add new values here.
|
||||
kMaxValue = kOpenTab,
|
||||
kMaxValue = kGames,
|
||||
};
|
||||
|
||||
ASH_PUBLIC_EXPORT bool IsAppListSearchResultAnApp(
|
||||
@ -368,7 +369,8 @@ enum class AppListSearchResultCategory {
|
||||
kHelp = 6,
|
||||
kPlayStore = 7,
|
||||
kSearchAndAssistant = 8,
|
||||
kMaxValue = kSearchAndAssistant,
|
||||
kGames = 9,
|
||||
kMaxValue = kGames,
|
||||
};
|
||||
|
||||
// Which UI container(s) the result should be displayed in.
|
||||
|
@ -54,6 +54,8 @@ std::string ResultTypeToString(const ash::AppListSearchResultType result_type) {
|
||||
return "Keyboard shortcut";
|
||||
case ash::AppListSearchResultType::kOpenTab:
|
||||
return "Open tab";
|
||||
case ash::AppListSearchResultType::kGames:
|
||||
return "Games";
|
||||
}
|
||||
NOTREACHED();
|
||||
}
|
||||
@ -158,6 +160,8 @@ std::string MetricsTypeToString(const ash::SearchResultType metrics_type) {
|
||||
return "OPEN_TAB";
|
||||
case ash::SearchResultType::NO_RESULT:
|
||||
return "NO_RESULT";
|
||||
case ash::SearchResultType::GAME_SEARCH:
|
||||
return "GAME_SEARCH";
|
||||
case ash::SearchResultType::SEARCH_RESULT_TYPE_BOUNDARY:
|
||||
return "SEARCH_RESULT_TYPE_BOUNDARY";
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ Category ResultTypeToCategory(ResultType result_type) {
|
||||
case ResultType::kInstalledApp:
|
||||
case ResultType::kInstantApp:
|
||||
case ResultType::kInternalApp:
|
||||
case ResultType::kGames:
|
||||
return Category::kApps;
|
||||
case ResultType::kArcAppShortcut:
|
||||
return Category::kAppShortcuts;
|
||||
|
@ -38,7 +38,8 @@ CategoriesList CreateAllCategories() {
|
||||
{.category = Category::kSettings},
|
||||
{.category = Category::kHelp},
|
||||
{.category = Category::kPlayStore},
|
||||
{.category = Category::kSearchAndAssistant}});
|
||||
{.category = Category::kSearchAndAssistant},
|
||||
{.category = Category::kGames}});
|
||||
DCHECK_EQ(res.size(), static_cast<size_t>(Category::kMaxValue));
|
||||
return res;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ RankingItemType RankingItemTypeFromSearchResult(
|
||||
switch (result.result_type()) {
|
||||
case ash::AppListSearchResultType::kInstalledApp:
|
||||
case ash::AppListSearchResultType::kInternalApp:
|
||||
case ash::AppListSearchResultType::kGames:
|
||||
return RankingItemType::kApp;
|
||||
case ash::AppListSearchResultType::kOmnibox:
|
||||
return RankingItemType::kOmniboxGeneric;
|
||||
|
Reference in New Issue
Block a user