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_SEARCH_RESULT_TILE_ITEM_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_SEARCH_RESULT_TILE_ITEM_VIEW_H_ |
6 #define UI_APP_LIST_VIEWS_SEARCH_RESULT_TILE_ITEM_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_SEARCH_RESULT_TILE_ITEM_VIEW_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "ui/app_list/search_result_observer.h" | 9 #include "ui/app_list/search_result_observer.h" |
10 #include "ui/app_list/views/tile_item_view.h" | 10 #include "ui/app_list/views/tile_item_view.h" |
(...skipping 22 matching lines...) Expand all Loading... | |
33 SearchResult* result() { return item_; } | 33 SearchResult* result() { return item_; } |
34 void SetSearchResult(SearchResult* item); | 34 void SetSearchResult(SearchResult* item); |
35 | 35 |
36 // Overridden from TileItemView: | 36 // Overridden from TileItemView: |
37 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 37 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
38 bool OnKeyPressed(const ui::KeyEvent& event) override; | 38 bool OnKeyPressed(const ui::KeyEvent& event) override; |
39 | 39 |
40 // Overridden from SearchResultObserver: | 40 // Overridden from SearchResultObserver: |
41 void OnIconChanged() override; | 41 void OnIconChanged() override; |
42 void OnBadgeIconChanged() override; | 42 void OnBadgeIconChanged() override; |
43 void OnRatingChanged() override; | |
44 void OnPriceChanged() override; | |
43 void OnResultDestroying() override; | 45 void OnResultDestroying() override; |
44 | 46 |
45 // views::ContextMenuController overrides: | 47 // views::ContextMenuController overrides: |
46 void ShowContextMenuForView(views::View* source, | 48 void ShowContextMenuForView(views::View* source, |
47 const gfx::Point& point, | 49 const gfx::Point& point, |
48 ui::MenuSourceType source_type) override; | 50 ui::MenuSourceType source_type) override; |
49 | 51 |
50 private: | 52 private: |
53 // Shows rating in proper format if |rating| is not negative. Otherwise, hides | |
54 // the rating label. | |
55 void SetRating(float rating); | |
56 | |
57 // Shows price if |price| is not empty. Otherwise, hides the price label. | |
58 void SetPrice(const base::string16& price); | |
59 | |
51 // Overridden from views::View: | 60 // Overridden from views::View: |
52 void Layout() override; | 61 void Layout() override; |
53 gfx::Size CalculatePreferredSize() const override; | 62 gfx::Size CalculatePreferredSize() const override; |
54 | 63 |
55 SearchResultContainerView* result_container_; // Parent view | 64 SearchResultContainerView* result_container_; // Parent view |
56 | 65 |
57 // Owned by the model provided by the AppListViewDelegate. | 66 // Owned by the model provided by the AppListViewDelegate. |
58 SearchResult* item_; | 67 SearchResult* item_; |
59 | 68 |
69 views::Label* rating_; // Owned by views hierarchy. | |
70 views::Label* price_; // Owned by views hierarchy. | |
xiyuan
2017/06/22 17:07:34
nit: forward declare views::Label.
Slightly prefe
weidongg
2017/06/22 17:58:30
Done.
| |
71 | |
60 AppListViewDelegate* view_delegate_; | 72 AppListViewDelegate* view_delegate_; |
61 | 73 |
62 const bool is_fullscreen_app_list_enabled_; | 74 const bool is_fullscreen_app_list_enabled_; |
63 | 75 |
64 std::unique_ptr<views::MenuRunner> context_menu_runner_; | 76 std::unique_ptr<views::MenuRunner> context_menu_runner_; |
65 | 77 |
66 DISALLOW_COPY_AND_ASSIGN(SearchResultTileItemView); | 78 DISALLOW_COPY_AND_ASSIGN(SearchResultTileItemView); |
67 }; | 79 }; |
68 | 80 |
69 } // namespace app_list | 81 } // namespace app_list |
70 | 82 |
71 #endif // UI_APP_LIST_VIEWS_SEARCH_RESULT_TILE_ITEM_VIEW_H_ | 83 #endif // UI_APP_LIST_VIEWS_SEARCH_RESULT_TILE_ITEM_VIEW_H_ |
OLD | NEW |