Commit d6828ed7 authored by tapted's avatar tapted Committed by Commit bot

Remove StartPageView from being a AppListViewDelegateObserver

It observes OnProfilesChanged, but the set of profiles changing doesn't
affect the start page. However, it probably once helped avoid crashes
when deleting profiles since the AppListViewDelegate would hold on to
the Profile* until the app list was shown again. But that was fixed in
http://crrev.com/291852 (now AppListServiceImpl::DestroyAppList() will
reliably tear down the AppListView if the profile is destroyed, without
having to wait for a ShowAppList().

When regular profile switching occurs (i.e. not when the profile is
being destroyed), the profile currently being used by the
StartPageView is also replaced. That is handled by
AppListMainView::ModelChanged() calling into
ContentsView::InitNamedPages() which makes an entirely new
StartPageView().

BUG=403647

Review URL: https://codereview.chromium.org/589333002

Cr-Commit-Position: refs/heads/master@{#296175}
parent c31b500a
......@@ -89,11 +89,9 @@ StartPageView::StartPageView(AppListMainView* app_list_main_view,
AddChildView(tiles_container_);
SetModel(view_delegate_->GetModel());
view_delegate_->AddObserver(this);
}
StartPageView::~StartPageView() {
view_delegate_->RemoveObserver(this);
if (search_results_model_)
search_results_model_->RemoveObserver(this);
}
......@@ -244,10 +242,6 @@ void StartPageView::QueryChanged(SearchBoxView* sender) {
sender->search_box()->SetText(base::string16());
}
void StartPageView::OnProfilesChanged() {
SetModel(view_delegate_->GetModel());
}
void StartPageView::ListItemsAdded(size_t start, size_t count) {
ScheduleUpdate();
}
......
......@@ -24,8 +24,7 @@ class TileItemView;
// The start page for the experimental app list.
class APP_LIST_EXPORT StartPageView : public views::View,
public ui::ListModelObserver,
public SearchBoxViewDelegate,
public AppListViewDelegateObserver {
public SearchBoxViewDelegate {
public:
StartPageView(AppListMainView* app_list_main_view,
AppListViewDelegate* view_delegate);
......@@ -67,9 +66,6 @@ class APP_LIST_EXPORT StartPageView : public views::View,
// Overridden from SearchBoxViewDelegate:
virtual void QueryChanged(SearchBoxView* sender) OVERRIDE;
// Overridden from AppListViewDelegateObserver:
virtual void OnProfilesChanged() OVERRIDE;
// Overridden from ui::ListModelObserver:
virtual void ListItemsAdded(size_t start, size_t count) OVERRIDE;
virtual void ListItemsRemoved(size_t start, size_t count) OVERRIDE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment