| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/apps_grid_view.h" | 5 #include "ui/app_list/views/apps_grid_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 target_slot = last_item_slot; | 1176 target_slot = last_item_slot; |
| 1177 } | 1177 } |
| 1178 } | 1178 } |
| 1179 | 1179 |
| 1180 int target_page = std::min(pagination_model_.total_pages() - 1, | 1180 int target_page = std::min(pagination_model_.total_pages() - 1, |
| 1181 std::max(selected.page + page_delta, 0)); | 1181 std::max(selected.page + page_delta, 0)); |
| 1182 SetSelectedItemByIndex(Index(target_page, target_slot)); | 1182 SetSelectedItemByIndex(Index(target_page, target_slot)); |
| 1183 } | 1183 } |
| 1184 | 1184 |
| 1185 void AppsGridView::CalculateIdealBounds() { | 1185 void AppsGridView::CalculateIdealBounds() { |
| 1186 // TODO(calamity): This fixes http://crbug.com/422604 on ChromeOS but it's |
| 1187 // unclear why. This should be investigated to fix the issue on Linux Ash. |
| 1188 if (GetContentsBounds().IsEmpty()) |
| 1189 return; |
| 1190 |
| 1186 gfx::Size grid_size = GetTileGridSize(); | 1191 gfx::Size grid_size = GetTileGridSize(); |
| 1187 | 1192 |
| 1188 // Page size including padding pixels. A tile.x + page_width means the same | 1193 // Page size including padding pixels. A tile.x + page_width means the same |
| 1189 // tile slot in the next page; similarly for tile.y + page_height. | 1194 // tile slot in the next page; similarly for tile.y + page_height. |
| 1190 const int page_width = grid_size.width() + kPagePadding; | 1195 const int page_width = grid_size.width() + kPagePadding; |
| 1191 const int page_height = grid_size.height() + kPagePadding; | 1196 const int page_height = grid_size.height() + kPagePadding; |
| 1192 | 1197 |
| 1193 // If there is a transition, calculates offset for current and target page. | 1198 // If there is a transition, calculates offset for current and target page. |
| 1194 const int current_page = pagination_model_.selected_page(); | 1199 const int current_page = pagination_model_.selected_page(); |
| 1195 const PaginationModel::Transition& transition = | 1200 const PaginationModel::Transition& transition = |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2151 | 2156 |
| 2152 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, | 2157 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, |
| 2153 bool is_target_folder) { | 2158 bool is_target_folder) { |
| 2154 AppListItemView* target_view = | 2159 AppListItemView* target_view = |
| 2155 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); | 2160 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); |
| 2156 if (target_view) | 2161 if (target_view) |
| 2157 target_view->SetAsAttemptedFolderTarget(is_target_folder); | 2162 target_view->SetAsAttemptedFolderTarget(is_target_folder); |
| 2158 } | 2163 } |
| 2159 | 2164 |
| 2160 } // namespace app_list | 2165 } // namespace app_list |
| OLD | NEW |