| 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..c51fd614ed0acf0cb3019522e01b4c506ad6afcc 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"
|
| @@ -83,17 +84,12 @@ class AppListMainView::IconLoader : public AppListItemObserver {
|
| // AppListMainView:
|
|
|
| AppListMainView::AppListMainView(AppListViewDelegate* delegate,
|
| - PaginationModel* pagination_model,
|
| gfx::NativeView parent)
|
| : delegate_(delegate),
|
| - pagination_model_(pagination_model),
|
| model_(delegate->GetModel()),
|
| 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,11 +100,13 @@ AppListMainView::AppListMainView(AppListViewDelegate* delegate,
|
| AddContentsView();
|
| if (app_list::switches::IsExperimentalAppListEnabled())
|
| AddChildView(new ContentsSwitcherView(contents_view_));
|
| +
|
| + // Starts icon loading early.
|
| + PreloadIcons(parent);
|
| }
|
|
|
| void AppListMainView::AddContentsView() {
|
| - contents_view_ = new ContentsView(
|
| - this, pagination_model_, model_, delegate_);
|
| + contents_view_ = new ContentsView(this, model_, delegate_);
|
| AddChildViewAt(contents_view_, kContentsViewIndex);
|
|
|
| search_box_view_->set_contents_view(contents_view_);
|
| @@ -162,7 +160,6 @@ void AppListMainView::ModelChanged() {
|
| search_box_view_->ModelChanged();
|
| delete contents_view_;
|
| contents_view_ = NULL;
|
| - pagination_model_->SelectPage(0, false /* animate */);
|
| AddContentsView();
|
| Layout();
|
| }
|
| @@ -187,14 +184,21 @@ bool AppListMainView::ShouldCenterWindow() const {
|
| return delegate_->ShouldCenterWindow();
|
| }
|
|
|
| +PaginationModel* AppListMainView::GetAppsPaginationModel() {
|
| + return contents_view_->apps_container_view()
|
| + ->apps_grid_view()
|
| + ->pagination_model();
|
| +}
|
| +
|
| void AppListMainView::PreloadIcons(gfx::NativeView parent) {
|
| float scale_factor = 1.0f;
|
| if (parent)
|
| scale_factor = ui::GetScaleFactorForNativeView(parent);
|
|
|
| - // |pagination_model| could have -1 as the initial selected page and
|
| + // The PaginationModel could have -1 as the initial selected page and
|
| // 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 selected_page =
|
| + std::max(0, GetAppsPaginationModel()->selected_page());
|
|
|
| const int tiles_per_page = kPreferredCols * kPreferredRows;
|
| const int start_model_index = selected_page * tiles_per_page;
|
|
|