| 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/apps_grid_view.h" | 5 #include "ui/app_list/apps_grid_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ui/app_list/app_list_item_model.h" | 9 #include "ui/app_list/app_list_item_model.h" |
| 10 #include "ui/app_list/app_list_item_view.h" | 10 #include "ui/app_list/app_list_item_view.h" |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 | 346 |
| 347 void AppsGridView::CalculateIdealBounds() { | 347 void AppsGridView::CalculateIdealBounds() { |
| 348 gfx::Rect rect(GetContentsBounds()); | 348 gfx::Rect rect(GetContentsBounds()); |
| 349 if (rect.IsEmpty()) | 349 if (rect.IsEmpty()) |
| 350 return; | 350 return; |
| 351 | 351 |
| 352 gfx::Size tile_size(kPreferredTileWidth, kPreferredTileHeight); | 352 gfx::Size tile_size(kPreferredTileWidth, kPreferredTileHeight); |
| 353 | 353 |
| 354 gfx::Rect grid_rect(gfx::Size(tile_size.width() * cols_, | 354 gfx::Rect grid_rect(gfx::Size(tile_size.width() * cols_, |
| 355 tile_size.height() * rows_per_page_)); | 355 tile_size.height() * rows_per_page_)); |
| 356 grid_rect = grid_rect.Intersect(rect); | 356 grid_rect.Intersect(rect); |
| 357 | 357 |
| 358 // Page width including padding pixels. A tile.x + page_width means the same | 358 // Page width including padding pixels. A tile.x + page_width means the same |
| 359 // tile slot in the next page. | 359 // tile slot in the next page. |
| 360 const int page_width = grid_rect.width() + kPagePadding; | 360 const int page_width = grid_rect.width() + kPagePadding; |
| 361 | 361 |
| 362 // If there is a transition, calculates offset for current and target page. | 362 // If there is a transition, calculates offset for current and target page. |
| 363 const int current_page = pagination_model_->selected_page(); | 363 const int current_page = pagination_model_->selected_page(); |
| 364 const PaginationModel::Transition& transition = | 364 const PaginationModel::Transition& transition = |
| 365 pagination_model_->transition(); | 365 pagination_model_->transition(); |
| 366 const bool is_valid = | 366 const bool is_valid = |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 void AppsGridView::TransitionChanged() { | 583 void AppsGridView::TransitionChanged() { |
| 584 // Update layout for valid page transition only since over-scroll no longer | 584 // Update layout for valid page transition only since over-scroll no longer |
| 585 // animates app icons. | 585 // animates app icons. |
| 586 const PaginationModel::Transition& transition = | 586 const PaginationModel::Transition& transition = |
| 587 pagination_model_->transition(); | 587 pagination_model_->transition(); |
| 588 if (pagination_model_->is_valid_page(transition.target_page)) | 588 if (pagination_model_->is_valid_page(transition.target_page)) |
| 589 Layout(); | 589 Layout(); |
| 590 } | 590 } |
| 591 | 591 |
| 592 } // namespace app_list | 592 } // namespace app_list |
| OLD | NEW |