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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 void AppsGridView::SetDragViewVisible(bool visible) { | 839 void AppsGridView::SetDragViewVisible(bool visible) { |
840 DCHECK(drag_view_); | 840 DCHECK(drag_view_); |
841 SetViewHidden(drag_view_, !visible, true); | 841 SetViewHidden(drag_view_, !visible, true); |
842 } | 842 } |
843 | 843 |
844 void AppsGridView::SetDragAndDropHostOfCurrentAppList( | 844 void AppsGridView::SetDragAndDropHostOfCurrentAppList( |
845 ApplicationDragAndDropHost* drag_and_drop_host) { | 845 ApplicationDragAndDropHost* drag_and_drop_host) { |
846 drag_and_drop_host_ = drag_and_drop_host; | 846 drag_and_drop_host_ = drag_and_drop_host; |
847 } | 847 } |
848 | 848 |
849 void AppsGridView::Prerender(int page_index) { | 849 void AppsGridView::Prerender() { |
850 Layout(); | 850 Layout(); |
851 int start = std::max(0, (page_index - kPrerenderPages) * tiles_per_page()); | 851 int selected_page = std::max(0, pagination_model_.selected_page()); |
| 852 int start = std::max(0, (selected_page - kPrerenderPages) * tiles_per_page()); |
852 int end = std::min(view_model_.view_size(), | 853 int end = std::min(view_model_.view_size(), |
853 (page_index + 1 + kPrerenderPages) * tiles_per_page()); | 854 (selected_page + 1 + kPrerenderPages) * tiles_per_page()); |
854 for (int i = start; i < end; i++) { | 855 for (int i = start; i < end; i++) { |
855 AppListItemView* v = static_cast<AppListItemView*>(view_model_.view_at(i)); | 856 AppListItemView* v = static_cast<AppListItemView*>(view_model_.view_at(i)); |
856 v->Prerender(); | 857 v->Prerender(); |
857 } | 858 } |
858 } | 859 } |
859 | 860 |
860 bool AppsGridView::IsAnimatingView(views::View* view) { | 861 bool AppsGridView::IsAnimatingView(views::View* view) { |
861 return bounds_animator_.IsAnimating(view); | 862 return bounds_animator_.IsAnimating(view); |
862 } | 863 } |
863 | 864 |
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2171 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, | 2172 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, |
2172 bool is_target_folder) { | 2173 bool is_target_folder) { |
2173 AppListItemView* target_view = | 2174 AppListItemView* target_view = |
2174 static_cast<AppListItemView*>( | 2175 static_cast<AppListItemView*>( |
2175 GetViewAtSlotOnCurrentPage(target_index.slot)); | 2176 GetViewAtSlotOnCurrentPage(target_index.slot)); |
2176 if (target_view) | 2177 if (target_view) |
2177 target_view->SetAsAttemptedFolderTarget(is_target_folder); | 2178 target_view->SetAsAttemptedFolderTarget(is_target_folder); |
2178 } | 2179 } |
2179 | 2180 |
2180 } // namespace app_list | 2181 } // namespace app_list |
OLD | NEW |