| 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 20db203df05ade2f6f685f0772f1edd93cd49a88..ba4f8d22930247fadb8bdbf8e75d80f987676bf2 100644
|
| --- a/ui/app_list/views/app_list_main_view.cc
|
| +++ b/ui/app_list/views/app_list_main_view.cc
|
| @@ -84,10 +84,9 @@ class AppListMainView::IconLoader : public AppListItemObserver {
|
| // AppListMainView:
|
|
|
| AppListMainView::AppListMainView(AppListViewDelegate* delegate,
|
| - PaginationModel* pagination_model,
|
| + int initial_apps_page,
|
| gfx::NativeView parent)
|
| : delegate_(delegate),
|
| - pagination_model_(pagination_model),
|
| model_(delegate->GetModel()),
|
| search_box_view_(NULL),
|
| contents_view_(NULL),
|
| @@ -103,13 +102,17 @@ AppListMainView::AppListMainView(AppListViewDelegate* delegate,
|
| if (app_list::switches::IsExperimentalAppListEnabled())
|
| AddChildView(new ContentsSwitcherView(contents_view_));
|
|
|
| + // Switch the apps grid view to the specified page.
|
| + app_list::PaginationModel* pagination_model = GetAppsPaginationModel();
|
| + if (pagination_model->is_valid_page(initial_apps_page))
|
| + pagination_model->SelectPage(initial_apps_page, false);
|
| +
|
| // 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_);
|
| @@ -163,7 +166,6 @@ void AppListMainView::ModelChanged() {
|
| search_box_view_->ModelChanged();
|
| delete contents_view_;
|
| contents_view_ = NULL;
|
| - pagination_model_->SelectPage(0, false /* animate */);
|
| AddContentsView();
|
| Layout();
|
| }
|
| @@ -188,14 +190,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 AppsGridView* const apps_grid_view =
|
| contents_view_->apps_container_view()->apps_grid_view();
|
|
|