OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_APP_LIST_VIEWS_TILE_ITEM_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_TILE_ITEM_VIEW_H_ |
6 #define UI_APP_LIST_VIEWS_TILE_ITEM_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_TILE_ITEM_VIEW_H_ |
7 | 7 |
8 #include "ui/app_list/app_list_export.h" | 8 #include "ui/app_list/app_list_export.h" |
| 9 #include "ui/app_list/search_result_observer.h" |
9 #include "ui/views/controls/button/button.h" | 10 #include "ui/views/controls/button/button.h" |
10 #include "ui/views/controls/button/custom_button.h" | 11 #include "ui/views/controls/button/custom_button.h" |
11 | 12 |
12 namespace views { | 13 namespace views { |
13 class ImageView; | 14 class ImageView; |
14 class Label; | 15 class Label; |
15 } | 16 } |
16 | 17 |
17 namespace app_list { | 18 namespace app_list { |
18 | 19 |
19 class AppListItem; | 20 class SearchResult; |
20 | 21 |
21 // The view for a tile in the app list on the start/search page. | 22 // The view for a tile in the app list on the start/search page. |
22 class APP_LIST_EXPORT TileItemView : public views::CustomButton, | 23 class APP_LIST_EXPORT TileItemView : public views::CustomButton, |
23 public views::ButtonListener { | 24 public views::ButtonListener, |
| 25 public SearchResultObserver { |
24 public: | 26 public: |
25 TileItemView(); | 27 TileItemView(); |
26 virtual ~TileItemView(); | 28 virtual ~TileItemView(); |
27 | 29 |
28 void SetAppListItem(AppListItem* item); | 30 void SetSearchResult(SearchResult* item); |
29 | 31 |
30 private: | 32 private: |
31 class TileItemBackground; | 33 class TileItemBackground; |
32 | 34 |
33 // Overridden from views::View: | 35 // Overridden from views::View: |
34 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 36 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
35 | 37 |
36 // Overridden from views::ButtonListener: | 38 // Overridden from views::ButtonListener: |
37 virtual void ButtonPressed(views::Button* sender, | 39 virtual void ButtonPressed(views::Button* sender, |
38 const ui::Event& event) OVERRIDE; | 40 const ui::Event& event) OVERRIDE; |
39 | 41 |
| 42 // Overridden from SearchResultObserver: |
| 43 virtual void OnIconChanged() OVERRIDE; |
| 44 virtual void OnResultDestroying() OVERRIDE; |
| 45 |
40 // Owned by the model provided by the AppListViewDelegate. | 46 // Owned by the model provided by the AppListViewDelegate. |
41 AppListItem* item_; | 47 SearchResult* item_; |
42 | 48 |
43 views::ImageView* icon_; // Owned by views hierarchy. | 49 views::ImageView* icon_; // Owned by views hierarchy. |
44 views::Label* title_; // Owned by views hierarchy. | 50 views::Label* title_; // Owned by views hierarchy. |
45 | 51 |
46 TileItemBackground* background_; | 52 TileItemBackground* background_; |
47 | 53 |
48 DISALLOW_COPY_AND_ASSIGN(TileItemView); | 54 DISALLOW_COPY_AND_ASSIGN(TileItemView); |
49 }; | 55 }; |
50 | 56 |
51 } // namespace app_list | 57 } // namespace app_list |
52 | 58 |
53 #endif // UI_APP_LIST_VIEWS_TILE_ITEM_VIEW_H_ | 59 #endif // UI_APP_LIST_VIEWS_TILE_ITEM_VIEW_H_ |
OLD | NEW |