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..f8a9c3b333d311ed0ecdcd1d65169779ef128a96 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,13 @@ class AppListMainView::IconLoader : public AppListItemObserver { |
// AppListMainView: |
AppListMainView::AppListMainView(AppListViewDelegate* delegate, |
- PaginationModel* pagination_model, |
gfx::NativeView parent) |
: delegate_(delegate), |
- pagination_model_(pagination_model), |
+ pagination_model_(NULL), |
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,15 +101,24 @@ AppListMainView::AppListMainView(AppListViewDelegate* delegate, |
AddContentsView(); |
if (app_list::switches::IsExperimentalAppListEnabled()) |
AddChildView(new ContentsSwitcherView(contents_view_)); |
+ pagination_model_ = contents_view_->apps_container_view() |
+ ->apps_grid_view() |
+ ->GetPaginationModel(); |
xiyuan
2014/05/30 15:47:47
Can we get rid of |pagination_model_| as a member
tapted
2014/06/02 04:02:21
hehe - that was going to be first comment too :).
Matt Giuca
2014/06/02 07:11:23
Done.
|
+ |
+ // 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_); |
+ pagination_model_ = contents_view_->apps_container_view() |
+ ->apps_grid_view() |
+ ->GetPaginationModel(); |
+ |
#if defined(USE_AURA) |
contents_view_->SetPaintToLayer(true); |
contents_view_->SetFillsBoundsOpaquely(false); |
@@ -160,9 +166,10 @@ void AppListMainView::ModelChanged() { |
pending_icon_loaders_.clear(); |
model_ = delegate_->GetModel(); |
search_box_view_->ModelChanged(); |
+ pagination_model_->SelectPage(0, false /* animate */); |
tapted
2014/06/02 04:02:21
this is perhaps not needed any more? Or, it needs
Matt Giuca
2014/06/02 07:11:23
Ah I see. The reason this was there before was bec
|
delete contents_view_; |
contents_view_ = NULL; |
- pagination_model_->SelectPage(0, false /* animate */); |
+ pagination_model_ = NULL; |
AddContentsView(); |
Layout(); |
} |