| 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 "base/strings/string16.h" |
| 8 #include "ui/app_list/app_list_export.h" | 9 #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" | 10 #include "ui/views/controls/button/button.h" |
| 11 #include "ui/views/controls/button/custom_button.h" | 11 #include "ui/views/controls/button/custom_button.h" |
| 12 | 12 |
| 13 namespace gfx { |
| 14 class ImageSkia; |
| 15 } |
| 16 |
| 13 namespace views { | 17 namespace views { |
| 14 class ImageView; | 18 class ImageView; |
| 15 class Label; | 19 class Label; |
| 16 } | 20 } |
| 17 | 21 |
| 18 namespace app_list { | 22 namespace app_list { |
| 19 | 23 |
| 20 class SearchResult; | |
| 21 | |
| 22 // The view for a tile in the app list on the start/search page. | 24 // The view for a tile in the app list on the start/search page. |
| 23 class APP_LIST_EXPORT TileItemView : public views::CustomButton, | 25 class APP_LIST_EXPORT TileItemView : public views::CustomButton, |
| 24 public views::ButtonListener, | 26 public views::ButtonListener { |
| 25 public SearchResultObserver { | |
| 26 public: | 27 public: |
| 27 TileItemView(); | 28 TileItemView(); |
| 28 ~TileItemView() override; | 29 ~TileItemView() override; |
| 29 | 30 |
| 30 void SetSearchResult(SearchResult* item); | 31 protected: |
| 32 void SetIcon(const gfx::ImageSkia& icon); |
| 33 |
| 34 void SetTitle(const base::string16& title); |
| 31 | 35 |
| 32 private: | 36 private: |
| 33 // Overridden from views::View: | 37 // Overridden from views::View: |
| 34 gfx::Size GetPreferredSize() const override; | 38 gfx::Size GetPreferredSize() const override; |
| 35 | 39 |
| 36 // Overridden from views::ButtonListener: | |
| 37 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | |
| 38 | |
| 39 // Overridden from SearchResultObserver: | |
| 40 void OnIconChanged() override; | |
| 41 void OnResultDestroying() override; | |
| 42 | |
| 43 // Owned by the model provided by the AppListViewDelegate. | |
| 44 SearchResult* item_; | |
| 45 | |
| 46 views::ImageView* icon_; // Owned by views hierarchy. | 40 views::ImageView* icon_; // Owned by views hierarchy. |
| 47 views::Label* title_; // Owned by views hierarchy. | 41 views::Label* title_; // Owned by views hierarchy. |
| 48 | 42 |
| 49 DISALLOW_COPY_AND_ASSIGN(TileItemView); | 43 DISALLOW_COPY_AND_ASSIGN(TileItemView); |
| 50 }; | 44 }; |
| 51 | 45 |
| 52 } // namespace app_list | 46 } // namespace app_list |
| 53 | 47 |
| 54 #endif // UI_APP_LIST_VIEWS_TILE_ITEM_VIEW_H_ | 48 #endif // UI_APP_LIST_VIEWS_TILE_ITEM_VIEW_H_ |
| OLD | NEW |