Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Unified Diff: ui/app_list/views/app_list_main_view.cc

Issue 311753002: App Launcher: Preload the correct number of icons (don't assume 4x4). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/app_list/views/apps_grid_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/app_list_main_view.cc
diff --git a/ui/app_list/views/app_list_main_view.cc b/ui/app_list/views/app_list_main_view.cc
index dcb57803c4acf6d55539b8c7838c12b0baa27f7b..20db203df05ade2f6f685f0772f1edd93cd49a88 100644
--- a/ui/app_list/views/app_list_main_view.cc
+++ b/ui/app_list/views/app_list_main_view.cc
@@ -21,6 +21,7 @@
#include "ui/app_list/search_box_model.h"
#include "ui/app_list/views/app_list_item_view.h"
#include "ui/app_list/views/apps_container_view.h"
+#include "ui/app_list/views/apps_grid_view.h"
#include "ui/app_list/views/contents_switcher_view.h"
#include "ui/app_list/views/contents_view.h"
#include "ui/app_list/views/search_box_view.h"
@@ -91,9 +92,6 @@ AppListMainView::AppListMainView(AppListViewDelegate* delegate,
search_box_view_(NULL),
contents_view_(NULL),
weak_ptr_factory_(this) {
- // Starts icon loading early.
- PreloadIcons(parent);
-
SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical,
kInnerPadding,
kInnerPadding,
@@ -104,6 +102,9 @@ AppListMainView::AppListMainView(AppListViewDelegate* delegate,
AddContentsView();
if (app_list::switches::IsExperimentalAppListEnabled())
AddChildView(new ContentsSwitcherView(contents_view_));
+
+ // Starts icon loading early.
+ PreloadIcons(parent);
}
void AppListMainView::AddContentsView() {
@@ -196,7 +197,11 @@ void AppListMainView::PreloadIcons(gfx::NativeView parent) {
// assumes first page (i.e. index 0) will be used in this case.
const int selected_page = std::max(0, pagination_model_->selected_page());
- const int tiles_per_page = kPreferredCols * kPreferredRows;
+ const AppsGridView* const apps_grid_view =
+ contents_view_->apps_container_view()->apps_grid_view();
+ const int tiles_per_page =
+ apps_grid_view->cols() * apps_grid_view->rows_per_page();
+
const int start_model_index = selected_page * tiles_per_page;
const int end_model_index =
std::min(static_cast<int>(model_->top_level_item_list()->item_count()),
« no previous file with comments | « no previous file | ui/app_list/views/apps_grid_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698