Commit 0f8982ef authored by hejq's avatar hejq Committed by Commit Bot

Use EnablePlayStoreAppSearch feature flag.

We apply EnablePlayStoreAppSearch to decide whether to:

- search for uninstalled apps from Play Store;
- show a proper badge in the Play Store app result;
- show the review score and price of every searched app.

Currently using the IsFullscreenAppListEnabled flag is incorrect.

BUG=736552

Review-Url: https://codereview.chromium.org/2961923002
Cr-Commit-Position: refs/heads/master@{#485454}
parent efac3d1c
......@@ -121,11 +121,14 @@ std::unique_ptr<SearchController> CreateSearchController(
}
#if defined(OS_CHROMEOS)
if (features::IsPlayStoreAppSearchEnabled()) {
size_t playstore_api_group_id =
controller->AddGroup(kMaxPlayStoreResults, 1.0);
controller->AddProvider(playstore_api_group_id,
base::MakeUnique<ArcPlayStoreSearchProvider>(
kMaxPlayStoreResults, profile, list_controller));
controller->AddProvider(
playstore_api_group_id,
base::MakeUnique<ArcPlayStoreSearchProvider>(kMaxPlayStoreResults,
profile, list_controller));
}
#endif
return controller;
}
......
......@@ -17,8 +17,8 @@ const base::Feature kEnableAnswerCardDarkRun{"EnableAnswerCardDarkRun",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kEnableFullscreenAppList{"EnableFullscreenAppList",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kEnablePlaystoreAppSearch{
"EnablePlaystoreAppSearch", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kEnablePlayStoreAppSearch{
"EnablePlayStoreAppSearch", base::FEATURE_DISABLED_BY_DEFAULT};
bool IsAnswerCardEnabled() {
static const bool enabled = base::FeatureList::IsEnabled(kEnableAnswerCard);
......@@ -42,9 +42,9 @@ bool IsSearchResultsNewDesignEnabled() {
(IsAnswerCardEnabled() && !IsAnswerCardDarkRunEnabled());
}
bool IsPlaystoreAppSearchEnabled() {
bool IsPlayStoreAppSearchEnabled() {
static const bool enabled =
base::FeatureList::IsEnabled(kEnablePlaystoreAppSearch);
base::FeatureList::IsEnabled(kEnablePlayStoreAppSearch);
return enabled;
}
......
......@@ -32,7 +32,7 @@ bool APP_LIST_EXPORT IsAnswerCardEnabled();
bool APP_LIST_EXPORT IsAnswerCardDarkRunEnabled();
bool APP_LIST_EXPORT IsFullscreenAppListEnabled();
bool APP_LIST_EXPORT IsSearchResultsNewDesignEnabled();
bool APP_LIST_EXPORT IsPlaystoreAppSearchEnabled();
bool APP_LIST_EXPORT IsPlayStoreAppSearchEnabled();
int APP_LIST_EXPORT AnswerCardMaxWidth();
int APP_LIST_EXPORT AnswerCardMaxHeight();
std::string APP_LIST_EXPORT AnswerServerUrl();
......
......@@ -45,8 +45,9 @@ SearchResultTileItemListView::SearchResultTileItemListView(
views::Textfield* search_box,
AppListViewDelegate* view_delegate)
: search_box_(search_box),
is_fullscreen_app_list_enabled_(features::IsFullscreenAppListEnabled()) {
if (is_fullscreen_app_list_enabled_) {
is_play_store_app_search_enabled_(
features::IsPlayStoreAppSearchEnabled()) {
if (is_play_store_app_search_enabled_) {
SetLayoutManager(new views::BoxLayout(
views::BoxLayout::kHorizontal,
gfx::Insets(kItemListVerticalSpacing, kItemListHorizontalSpacing),
......@@ -113,10 +114,10 @@ int SearchResultTileItemListView::DoUpdate() {
std::vector<SearchResult*> display_results =
AppListModel::FilterSearchResultsByDisplayType(
results(), SearchResult::DISPLAY_TILE,
is_fullscreen_app_list_enabled_ ? kMaxNumSearchResultTiles
is_play_store_app_search_enabled_ ? kMaxNumSearchResultTiles
: kNumSearchResultTiles);
if (is_fullscreen_app_list_enabled_) {
if (is_play_store_app_search_enabled_) {
SearchResult::ResultType previous_type = SearchResult::RESULT_UNKNOWN;
for (size_t i = 0; i < kMaxNumSearchResultTiles; ++i) {
......
......@@ -48,8 +48,8 @@ class APP_LIST_EXPORT SearchResultTileItemListView
views::Textfield* search_box_; // Owned by the views hierarchy.
// Whether the fullscreen app list feature is enabled.
const bool is_fullscreen_app_list_enabled_;
// Whether the Play Store app search feature is enabled.
const bool is_play_store_app_search_enabled_;
DISALLOW_COPY_AND_ASSIGN(SearchResultTileItemListView);
};
......
......@@ -43,12 +43,13 @@ SearchResultTileItemView::SearchResultTileItemView(
AppListViewDelegate* view_delegate)
: result_container_(result_container),
view_delegate_(view_delegate),
is_fullscreen_app_list_enabled_(features::IsFullscreenAppListEnabled()) {
is_play_store_app_search_enabled_(
features::IsPlayStoreAppSearchEnabled()) {
// When |item_| is null, the tile is invisible. Calling SetSearchResult with a
// non-null item makes the tile visible.
SetVisible(false);
if (is_fullscreen_app_list_enabled_) {
if (is_play_store_app_search_enabled_) {
const gfx::FontList& base_font =
ui::ResourceBundle::GetSharedInstance().GetFontList(
ui::ResourceBundle::BaseFont);
......@@ -106,7 +107,7 @@ void SearchResultTileItemView::SetSearchResult(SearchResult* item) {
SetRating(item_->rating());
SetPrice(item_->formatted_price());
if (is_fullscreen_app_list_enabled_) {
if (is_play_store_app_search_enabled_) {
const gfx::FontList& base_font =
ui::ResourceBundle::GetSharedInstance().GetFontList(
ui::ResourceBundle::BaseFont);
......@@ -230,7 +231,7 @@ void SearchResultTileItemView::Layout() {
if (rect.IsEmpty())
return;
if (!is_fullscreen_app_list_enabled_ || !item_) {
if (!is_play_store_app_search_enabled_ || !item_) {
TileItemView::Layout();
return;
}
......@@ -292,7 +293,7 @@ void SearchResultTileItemView::Layout() {
}
gfx::Size SearchResultTileItemView::CalculatePreferredSize() const {
if (is_fullscreen_app_list_enabled_ && item_) {
if (is_play_store_app_search_enabled_ && item_) {
if (item_->display_type() == SearchResult::DISPLAY_RECOMMENDATION)
return gfx::Size(kGridTileWidth, kGridTileHeight);
if (item_->display_type() == SearchResult::DISPLAY_TILE)
......
......@@ -5,6 +5,8 @@
#ifndef UI_APP_LIST_VIEWS_SEARCH_RESULT_TILE_ITEM_VIEW_H_
#define UI_APP_LIST_VIEWS_SEARCH_RESULT_TILE_ITEM_VIEW_H_
#include <memory>
#include "base/macros.h"
#include "ui/app_list/search_result_observer.h"
#include "ui/app_list/views/tile_item_view.h"
......@@ -73,7 +75,8 @@ class APP_LIST_EXPORT SearchResultTileItemView
AppListViewDelegate* view_delegate_;
const bool is_fullscreen_app_list_enabled_;
// Whether the Play Store app search feature is enabled.
const bool is_play_store_app_search_enabled_;
std::unique_ptr<views::MenuRunner> context_menu_runner_;
......
......@@ -4,6 +4,8 @@
#include "ui/app_list/views/tile_item_view.h"
#include <utility>
#include "ui/app_list/app_list_constants.h"
#include "ui/app_list/app_list_features.h"
#include "ui/app_list/views/app_list_main_view.h"
......@@ -66,7 +68,7 @@ TileItemView::TileItemView()
title_->SetHandlesTooltips(false);
AddChildView(icon_);
if (features::IsFullscreenAppListEnabled()) {
if (features::IsPlayStoreAppSearchEnabled()) {
badge_ = new views::ImageView();
badge_->set_can_process_events_within_subtree(false);
badge_->SetVerticalAlignment(views::ImageView::LEADING);
......
......@@ -5,6 +5,8 @@
#ifndef UI_APP_LIST_VIEWS_TILE_ITEM_VIEW_H_
#define UI_APP_LIST_VIEWS_TILE_ITEM_VIEW_H_
#include <memory>
#include "base/macros.h"
#include "base/strings/string16.h"
#include "third_party/skia/include/core/SkColor.h"
......
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