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 #include "ui/app_list/views/search_result_tile_item_list_view.h" | 5 #include "ui/app_list/views/search_result_tile_item_list_view.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "ui/app_list/app_list_constants.h" | 10 #include "ui/app_list/app_list_constants.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 constexpr SkColor kSeparatorColor = SkColorSetARGBMacro(0x1F, 0x00, 0x00, 0x00); | 38 constexpr SkColor kSeparatorColor = SkColorSetARGBMacro(0x1F, 0x00, 0x00, 0x00); |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 namespace app_list { | 42 namespace app_list { |
43 | 43 |
44 SearchResultTileItemListView::SearchResultTileItemListView( | 44 SearchResultTileItemListView::SearchResultTileItemListView( |
45 views::Textfield* search_box, | 45 views::Textfield* search_box, |
46 AppListViewDelegate* view_delegate) | 46 AppListViewDelegate* view_delegate) |
47 : search_box_(search_box), | 47 : search_box_(search_box), |
48 is_fullscreen_app_list_enabled_(features::IsFullscreenAppListEnabled()) { | 48 is_play_store_app_search_enabled_( |
49 if (is_fullscreen_app_list_enabled_) { | 49 features::IsPlayStoreAppSearchEnabled()) { |
| 50 if (is_play_store_app_search_enabled_) { |
50 SetLayoutManager(new views::BoxLayout( | 51 SetLayoutManager(new views::BoxLayout( |
51 views::BoxLayout::kHorizontal, | 52 views::BoxLayout::kHorizontal, |
52 gfx::Insets(kItemListVerticalSpacing, kItemListHorizontalSpacing), | 53 gfx::Insets(kItemListVerticalSpacing, kItemListHorizontalSpacing), |
53 kBetweenItemSpacing)); | 54 kBetweenItemSpacing)); |
54 for (size_t i = 0; i < kMaxNumSearchResultTiles; ++i) { | 55 for (size_t i = 0; i < kMaxNumSearchResultTiles; ++i) { |
55 views::Separator* separator = new views::Separator; | 56 views::Separator* separator = new views::Separator; |
56 separator->SetVisible(false); | 57 separator->SetVisible(false); |
57 separator->SetBorder(views::CreateEmptyBorder( | 58 separator->SetBorder(views::CreateEmptyBorder( |
58 0, kSeparatorLeftRightPadding, kSearchTileHeight - kSeparatorHeight, | 59 0, kSeparatorLeftRightPadding, kSearchTileHeight - kSeparatorHeight, |
59 kSeparatorLeftRightPadding)); | 60 kSeparatorLeftRightPadding)); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 107 } |
107 | 108 |
108 int SearchResultTileItemListView::GetYSize() { | 109 int SearchResultTileItemListView::GetYSize() { |
109 return num_results() ? 1 : 0; | 110 return num_results() ? 1 : 0; |
110 } | 111 } |
111 | 112 |
112 int SearchResultTileItemListView::DoUpdate() { | 113 int SearchResultTileItemListView::DoUpdate() { |
113 std::vector<SearchResult*> display_results = | 114 std::vector<SearchResult*> display_results = |
114 AppListModel::FilterSearchResultsByDisplayType( | 115 AppListModel::FilterSearchResultsByDisplayType( |
115 results(), SearchResult::DISPLAY_TILE, | 116 results(), SearchResult::DISPLAY_TILE, |
116 is_fullscreen_app_list_enabled_ ? kMaxNumSearchResultTiles | 117 is_play_store_app_search_enabled_ ? kMaxNumSearchResultTiles |
117 : kNumSearchResultTiles); | 118 : kNumSearchResultTiles); |
118 | 119 |
119 if (is_fullscreen_app_list_enabled_) { | 120 if (is_play_store_app_search_enabled_) { |
120 SearchResult::ResultType previous_type = SearchResult::RESULT_UNKNOWN; | 121 SearchResult::ResultType previous_type = SearchResult::RESULT_UNKNOWN; |
121 | 122 |
122 for (size_t i = 0; i < kMaxNumSearchResultTiles; ++i) { | 123 for (size_t i = 0; i < kMaxNumSearchResultTiles; ++i) { |
123 if (i >= display_results.size()) { | 124 if (i >= display_results.size()) { |
124 separator_views_[i]->SetVisible(false); | 125 separator_views_[i]->SetVisible(false); |
125 tile_views_[i]->SetSearchResult(nullptr); | 126 tile_views_[i]->SetSearchResult(nullptr); |
126 continue; | 127 continue; |
127 } | 128 } |
128 | 129 |
129 SearchResult* item = display_results[i]; | 130 SearchResult* item = display_results[i]; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 int selection_index = selected_index() + dir; | 207 int selection_index = selected_index() + dir; |
207 if (IsValidSelectionIndex(selection_index)) { | 208 if (IsValidSelectionIndex(selection_index)) { |
208 SetSelectedIndex(selection_index); | 209 SetSelectedIndex(selection_index); |
209 return true; | 210 return true; |
210 } | 211 } |
211 | 212 |
212 return false; | 213 return false; |
213 } | 214 } |
214 | 215 |
215 } // namespace app_list | 216 } // namespace app_list |
OLD | NEW |