Index: ui/app_list/views/contents_view.cc |
diff --git a/ui/app_list/views/contents_view.cc b/ui/app_list/views/contents_view.cc |
index 452e4fdfc2d17aba57f8218b3e880806ecc1afb7..99bb6bdc201382faf3f4671054532ae07695a66e 100644 |
--- a/ui/app_list/views/contents_view.cc |
+++ b/ui/app_list/views/contents_view.cc |
@@ -46,6 +46,8 @@ ContentsView::ContentsView(AppListMainView* app_list_main_view) |
ContentsView::~ContentsView() { |
pagination_model_.RemoveObserver(this); |
+ if (contents_switcher_view_) |
+ pagination_model_.RemoveObserver(contents_switcher_view_); |
} |
void ContentsView::InitNamedPages(AppListModel* model, |
@@ -97,6 +99,13 @@ void ContentsView::SetDragAndDropHostOfCurrentAppList( |
apps_container_view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host); |
} |
+void ContentsView::set_contents_switcher_view( |
+ ContentsSwitcherView* contents_switcher_view) { |
+ contents_switcher_view_ = contents_switcher_view; |
+ if (contents_switcher_view_) |
+ pagination_model_.AddObserver(contents_switcher_view_); |
+} |
+ |
void ContentsView::SetActivePage(int page_index) { |
if (GetActivePageIndex() == page_index) |
return; |
@@ -244,9 +253,9 @@ int ContentsView::AddLauncherPage(views::View* view, int resource_id) { |
int page_index = view_model_->view_size(); |
AddChildView(view); |
view_model_->Add(view, page_index); |
- pagination_model_.SetTotalPages(view_model_->view_size()); |
if (contents_switcher_view_) |
contents_switcher_view_->AddSwitcherButton(resource_id, page_index); |
+ pagination_model_.SetTotalPages(view_model_->view_size()); |
return page_index; |
} |