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"
19 class SearchResultContainerView
;
21 // A TileItemView that displays a search result.
22 class APP_LIST_EXPORT SearchResultTileItemView
23 : public TileItemView
,
24 public views::ContextMenuController
,
25 public SearchResultObserver
{
27 explicit SearchResultTileItemView(
28 SearchResultContainerView
* result_container
);
29 ~SearchResultTileItemView() override
;
31 void SetSearchResult(SearchResult
* item
);
33 // Overridden from TileItemView:
34 void ButtonPressed(views::Button
* sender
, const ui::Event
& event
) override
;
35 bool OnKeyPressed(const ui::KeyEvent
& event
) override
;
37 // Overridden from SearchResultObserver:
38 void OnIconChanged() override
;
39 void OnResultDestroying() override
;
41 // views::ContextMenuController overrides:
42 void ShowContextMenuForView(views::View
* source
,
43 const gfx::Point
& point
,
44 ui::MenuSourceType source_type
) override
;
47 SearchResultContainerView
* result_container_
; // Parent view
49 // Owned by the model provided by the AppListViewDelegate.
52 scoped_ptr
<views::MenuRunner
> context_menu_runner_
;
54 DISALLOW_COPY_AND_ASSIGN(SearchResultTileItemView
);
57 } // namespace app_list
59 #endif // UI_APP_LIST_VIEWS_SEARCH_RESULT_TILE_ITEM_VIEW_H_