Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / ui / app_list / views / tile_item_view.h
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.
4
5 #ifndef UI_APP_LIST_VIEWS_TILE_ITEM_VIEW_H_
6 #define UI_APP_LIST_VIEWS_TILE_ITEM_VIEW_H_
7
8 #include "ui/app_list/app_list_export.h"
9 #include "ui/app_list/search_result_observer.h"
10 #include "ui/views/controls/button/button.h"
11 #include "ui/views/controls/button/custom_button.h"
12
13 namespace views {
14 class ImageView;
15 class Label;
16 }
17
18 namespace app_list {
19
20 class SearchResult;
21
22 // The view for a tile in the app list on the start/search page.
23 class APP_LIST_EXPORT TileItemView : public views::CustomButton,
24                                      public views::ButtonListener,
25                                      public SearchResultObserver {
26  public:
27   TileItemView();
28   virtual ~TileItemView();
29
30   void SetSearchResult(SearchResult* item);
31
32  private:
33   class TileItemBackground;
34
35   // Overridden from views::View:
36   virtual gfx::Size GetPreferredSize() const OVERRIDE;
37
38   // Overridden from views::ButtonListener:
39   virtual void ButtonPressed(views::Button* sender,
40                              const ui::Event& event) OVERRIDE;
41
42   // Overridden from SearchResultObserver:
43   virtual void OnIconChanged() OVERRIDE;
44   virtual void OnResultDestroying() OVERRIDE;
45
46   // Owned by the model provided by the AppListViewDelegate.
47   SearchResult* item_;
48
49   views::ImageView* icon_;  // Owned by views hierarchy.
50   views::Label* title_;     // Owned by views hierarchy.
51
52   TileItemBackground* background_;
53
54   DISALLOW_COPY_AND_ASSIGN(TileItemView);
55 };
56
57 }  // namespace app_list
58
59 #endif  // UI_APP_LIST_VIEWS_TILE_ITEM_VIEW_H_