| 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 | 395 |
| 396 void AppsGridView::CalculateIdealBounds() { | 396 void AppsGridView::CalculateIdealBounds() { |
| 397 gfx::Rect rect(GetContentsBounds()); | 397 gfx::Rect rect(GetContentsBounds()); |
| 398 if (rect.IsEmpty()) | 398 if (rect.IsEmpty()) |
| 399 return; | 399 return; |
| 400 | 400 |
| 401 gfx::Size tile_size(kPreferredTileWidth, kPreferredTileHeight); | 401 gfx::Size tile_size(kPreferredTileWidth, kPreferredTileHeight); |
| 402 | 402 |
| 403 gfx::Rect grid_rect(gfx::Size(tile_size.width() * cols_, | 403 gfx::Rect grid_rect(gfx::Size(tile_size.width() * cols_, |
| 404 tile_size.height() * rows_per_page_)); | 404 tile_size.height() * rows_per_page_)); |
| 405 grid_rect = grid_rect.Intersect(rect); | 405 grid_rect.Intersect(rect); |
| 406 | 406 |
| 407 // Page width including padding pixels. A tile.x + page_width means the same | 407 // Page width including padding pixels. A tile.x + page_width means the same |
| 408 // tile slot in the next page. | 408 // tile slot in the next page. |
| 409 const int page_width = grid_rect.width() + kPagePadding; | 409 const int page_width = grid_rect.width() + kPagePadding; |
| 410 | 410 |
| 411 // If there is a transition, calculates offset for current and target page. | 411 // If there is a transition, calculates offset for current and target page. |
| 412 const int current_page = pagination_model_->selected_page(); | 412 const int current_page = pagination_model_->selected_page(); |
| 413 const PaginationModel::Transition& transition = | 413 const PaginationModel::Transition& transition = |
| 414 pagination_model_->transition(); | 414 pagination_model_->transition(); |
| 415 const bool is_valid = | 415 const bool is_valid = |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 void AppsGridView::TransitionChanged() { | 681 void AppsGridView::TransitionChanged() { |
| 682 // Update layout for valid page transition only since over-scroll no longer | 682 // Update layout for valid page transition only since over-scroll no longer |
| 683 // animates app icons. | 683 // animates app icons. |
| 684 const PaginationModel::Transition& transition = | 684 const PaginationModel::Transition& transition = |
| 685 pagination_model_->transition(); | 685 pagination_model_->transition(); |
| 686 if (pagination_model_->is_valid_page(transition.target_page)) | 686 if (pagination_model_->is_valid_page(transition.target_page)) |
| 687 Layout(); | 687 Layout(); |
| 688 } | 688 } |
| 689 | 689 |
| 690 } // namespace app_list | 690 } // namespace app_list |
| OLD | NEW |