| 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/suggestions_container_view.h" | 5 #include "ui/app_list/views/suggestions_container_view.h" |
| 6 | 6 |
| 7 #include "ui/app_list/app_list_constants.h" | 7 #include "ui/app_list/app_list_constants.h" |
| 8 #include "ui/app_list/app_list_features.h" | 8 #include "ui/app_list/app_list_features.h" |
| 9 #include "ui/app_list/views/all_apps_tile_item_view.h" | 9 #include "ui/app_list/views/all_apps_tile_item_view.h" |
| 10 #include "ui/app_list/views/app_list_main_view.h" | 10 #include "ui/app_list/views/app_list_main_view.h" |
| 11 #include "ui/app_list/views/contents_view.h" | 11 #include "ui/app_list/views/contents_view.h" |
| 12 #include "ui/app_list/views/search_result_tile_item_view.h" | 12 #include "ui/app_list/views/search_result_tile_item_view.h" |
| 13 #include "ui/views/background.h" | 13 #include "ui/views/background.h" |
| 14 #include "ui/views/layout/grid_layout.h" | 14 #include "ui/views/layout/grid_layout.h" |
| 15 | 15 |
| 16 namespace app_list { | 16 namespace app_list { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 constexpr int kTileSpacing = 7; | 20 constexpr int kTileSpacing = 7; |
| 21 constexpr int kNumTilesCols = 5; | 21 constexpr int kNumTilesCols = 5; |
| 22 constexpr int kTilesHorizontalMarginLeft = 145; | 22 constexpr int kTilesHorizontalMarginLeft = 145; |
| 23 constexpr int kCenterColumnOfStartPageAppGrid = 3; |
| 23 | 24 |
| 24 } // namespace | 25 } // namespace |
| 25 | 26 |
| 26 SuggestionsContainerView::SuggestionsContainerView( | 27 SuggestionsContainerView::SuggestionsContainerView( |
| 27 ContentsView* contents_view, | 28 ContentsView* contents_view, |
| 28 AllAppsTileItemView* all_apps_button) | 29 AllAppsTileItemView* all_apps_button) |
| 29 : contents_view_(contents_view), | 30 : contents_view_(contents_view), |
| 30 all_apps_button_(all_apps_button), | 31 all_apps_button_(all_apps_button), |
| 31 is_fullscreen_app_list_enabled_(features::IsFullscreenAppListEnabled()) { | 32 is_fullscreen_app_list_enabled_(features::IsFullscreenAppListEnabled()) { |
| 32 DCHECK(contents_view); | 33 DCHECK(contents_view); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 new SearchResultTileItemView(this, view_delegate_); | 141 new SearchResultTileItemView(this, view_delegate_); |
| 141 if (i % kNumTilesCols == 0) | 142 if (i % kNumTilesCols == 0) |
| 142 tiles_layout_manager->StartRow(0, 0); | 143 tiles_layout_manager->StartRow(0, 0); |
| 143 tiles_layout_manager->AddView(tile_item); | 144 tiles_layout_manager->AddView(tile_item); |
| 144 AddChildView(tile_item); | 145 AddChildView(tile_item); |
| 145 tile_item->SetParentBackgroundColor(kLabelBackgroundColor); | 146 tile_item->SetParentBackgroundColor(kLabelBackgroundColor); |
| 146 tile_item->SetHoverStyle(TileItemView::HOVER_STYLE_ANIMATE_SHADOW); | 147 tile_item->SetHoverStyle(TileItemView::HOVER_STYLE_ANIMATE_SHADOW); |
| 147 search_result_tile_views_.emplace_back(tile_item); | 148 search_result_tile_views_.emplace_back(tile_item); |
| 148 } | 149 } |
| 149 | 150 |
| 150 if (all_apps_button_ && !is_fullscreen_app_list_enabled_) { | 151 if (all_apps_button_) |
| 151 all_apps_button_->UpdateIcon(); | 152 all_apps_button_->UpdateIcon(); |
| 152 | 153 if (is_fullscreen_app_list_enabled_) { |
| 154 // Also add a special "all apps" button to the middle of the next row of the |
| 155 // container. |
| 156 tiles_layout_manager->StartRow(0, 0); |
| 157 tiles_layout_manager->SkipColumns(kCenterColumnOfStartPageAppGrid); |
| 158 } else { |
| 153 // Also add a special "all apps" button to the end of the next row of the | 159 // Also add a special "all apps" button to the end of the next row of the |
| 154 // container. | 160 // container. |
| 155 if (i % kNumTilesCols == 0) | 161 if (i % kNumTilesCols == 0) |
| 156 tiles_layout_manager->StartRow(0, 0); | 162 tiles_layout_manager->StartRow(0, 0); |
| 163 } |
| 157 | 164 |
| 165 if (all_apps_button_) { |
| 158 tiles_layout_manager->AddView(all_apps_button_); | 166 tiles_layout_manager->AddView(all_apps_button_); |
| 159 AddChildView(all_apps_button_); | 167 AddChildView(all_apps_button_); |
| 160 } | 168 } |
| 161 } | 169 } |
| 162 | 170 |
| 163 } // namespace app_list | 171 } // namespace app_list |
| OLD | NEW |