Commit 473729ed authored by Qiang Xu's avatar Qiang Xu Committed by Commit Bot

cros: remove some unneeded code in SearchResultTileItemView

changes:
We don't need to explicitly clear focus on search result tile item
view's container. This belongs to "pseudo-focus" but we can remove
it now, since it should be handled by focus manager. As a result,
this CL also avoids passing parent container view to it.

Bug: 795994
Test: manual and test coverage
Change-Id: I97e54ca53e0fce7db72dc8856f1a3c9e3e2c875e
Reviewed-on: https://chromium-review.googlesource.com/1116798Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Qiang Xu <warx@google.com>
Cr-Commit-Position: refs/heads/master@{#570897}
parent 4738086f
......@@ -67,7 +67,7 @@ SearchResultTileItemListView::SearchResultTileItemListView(
}
SearchResultTileItemView* tile_item = new SearchResultTileItemView(
this, view_delegate, nullptr /* pagination model */);
view_delegate, nullptr /* pagination model */);
tile_item->SetParentBackgroundColor(kCardBackgroundColor);
tile_views_.push_back(tile_item);
AddChildView(tile_item);
......
......@@ -8,11 +8,11 @@
#include "ash/app_list/app_list_metrics.h"
#include "ash/app_list/app_list_view_delegate.h"
#include "ash/app_list/model/app_list_model.h"
#include "ash/app_list/model/app_list_view_state.h"
#include "ash/app_list/model/search/search_result.h"
#include "ash/app_list/pagination_model.h"
#include "ash/app_list/views/app_list_item_view.h"
#include "ash/app_list/views/search_result_container_view.h"
#include "ash/public/cpp/app_list/app_list_config.h"
#include "ash/public/cpp/app_list/app_list_constants.h"
#include "ash/public/cpp/app_list/app_list_features.h"
......@@ -87,11 +87,9 @@ class BadgeBackgroundImageSource : public gfx::CanvasImageSource {
} // namespace
SearchResultTileItemView::SearchResultTileItemView(
SearchResultContainerView* result_container,
AppListViewDelegate* view_delegate,
PaginationModel* pagination_model)
: result_container_(result_container),
view_delegate_(view_delegate),
: view_delegate_(view_delegate),
pagination_model_(pagination_model),
is_play_store_app_search_enabled_(
features::IsPlayStoreAppSearchEnabled()),
......@@ -364,10 +362,6 @@ void SearchResultTileItemView::OnGetContextMenuModel(
if (menu.empty() || (context_menu_ && context_menu_->IsShowingMenu()))
return;
// TODO(warx): This is broken (https://crbug.com/795994).
if (!HasFocus())
result_container_->ClearSelectedIndex();
int run_types = views::MenuRunner::HAS_MNEMONICS;
views::MenuAnchorPosition anchor_position = views::MENU_ANCHOR_TOPLEFT;
gfx::Rect anchor_rect = gfx::Rect(point, gfx::Size());
......
......@@ -24,7 +24,6 @@ namespace app_list {
class AppListViewDelegate;
class SearchResult;
class SearchResultContainerView;
class PaginationModel;
// A tile view that displays a search result. It hosts view for search result
......@@ -34,8 +33,7 @@ class APP_LIST_EXPORT SearchResultTileItemView
public views::ContextMenuController,
public AppListMenuModelAdapter::Delegate {
public:
SearchResultTileItemView(SearchResultContainerView* result_container,
AppListViewDelegate* view_delegate,
SearchResultTileItemView(AppListViewDelegate* view_delegate,
PaginationModel* pagination_model);
~SearchResultTileItemView() override;
......@@ -103,7 +101,6 @@ class APP_LIST_EXPORT SearchResultTileItemView
bool GetTooltipText(const gfx::Point& p,
base::string16* tooltip) const override;
SearchResultContainerView* const result_container_; // Parent view
AppListViewDelegate* const view_delegate_; // Owned by AppListView.
PaginationModel* const pagination_model_; // Owned by AppsGridView.
......
......@@ -126,7 +126,7 @@ void SuggestionsContainerView::CreateAppsGrid(int apps_num) {
DCHECK_LE(apps_num, kNumStartPageTiles);
for (; i < apps_num; ++i) {
SearchResultTileItemView* tile_item =
new SearchResultTileItemView(this, view_delegate_, pagination_model_);
new SearchResultTileItemView(view_delegate_, pagination_model_);
tiles_layout_manager->AddView(tile_item);
AddChildView(tile_item);
tile_item->SetParentBackgroundColor(kLabelBackgroundColor);
......
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