1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_APP_LIST_VIEWS_SEARCH_RESULT_TILE_ITEM_VIEW_H_
6 #define UI_APP_LIST_VIEWS_SEARCH_RESULT_TILE_ITEM_VIEW_H_
8 #include "ui/app_list/search_result_observer.h"
9 #include "ui/app_list/views/tile_item_view.h"
10 #include "ui/views/context_menu_controller.h"
18 class AppListViewDelegate
;
20 class SearchResultContainerView
;
22 // A TileItemView that displays a search result.
23 class APP_LIST_EXPORT SearchResultTileItemView
24 : public TileItemView
,
25 public views::ContextMenuController
,
26 public SearchResultObserver
{
28 explicit SearchResultTileItemView(SearchResultContainerView
* result_container
,
29 AppListViewDelegate
* view_delegate
);
30 ~SearchResultTileItemView() override
;
32 SearchResult
* result() { return item_
; }
33 void SetSearchResult(SearchResult
* item
);
35 // Overridden from TileItemView:
36 void ButtonPressed(views::Button
* sender
, const ui::Event
& event
) override
;
37 bool OnKeyPressed(const ui::KeyEvent
& event
) override
;
39 // Overridden from SearchResultObserver:
40 void OnIconChanged() override
;
41 void OnResultDestroying() override
;
43 // views::ContextMenuController overrides:
44 void ShowContextMenuForView(views::View
* source
,
45 const gfx::Point
& point
,
46 ui::MenuSourceType source_type
) override
;
49 SearchResultContainerView
* result_container_
; // Parent view
51 // Owned by the model provided by the AppListViewDelegate.
54 AppListViewDelegate
* view_delegate_
;
56 scoped_ptr
<views::MenuRunner
> context_menu_runner_
;
58 DISALLOW_COPY_AND_ASSIGN(SearchResultTileItemView
);
61 } // namespace app_list
63 #endif // UI_APP_LIST_VIEWS_SEARCH_RESULT_TILE_ITEM_VIEW_H_