| Index: ui/app_list/views/app_list_view.cc
|
| diff --git a/ui/app_list/views/app_list_view.cc b/ui/app_list/views/app_list_view.cc
|
| index 863e25e55df8ed22c06c2754746e4cb85b65f187..4190173ee685f24f160a714d677ac3676d6eaa99 100644
|
| --- a/ui/app_list/views/app_list_view.cc
|
| +++ b/ui/app_list/views/app_list_view.cc
|
| @@ -129,6 +129,28 @@ void AppListView::InitAsBubble(gfx::NativeView parent,
|
| #endif
|
| }
|
|
|
| +void AppListView::SetModel(app_list::AppListModel* model) {
|
| + if (GetSigninDelegate())
|
| + GetSigninDelegate()->RemoveObserver(this);
|
| + // Sets the model on the view so the view is hooked up to listen to the model.
|
| + // This cleans up the observers of the old model.
|
| + app_list_main_view_->SetModel(model);
|
| + // Build the model which will notify the view, updating it. This also resets
|
| + // the signin delegate which will fail if any observers are listening to the
|
| + // old delegate.
|
| + if (delegate_)
|
| + delegate_->SetModel(model);
|
| + // Reset the model here, freeing it. This is done after all cleanup involving
|
| + // references to this model is complete.
|
| + model_.reset(model);
|
| + // Sets the signin view's delegate from the AppListViewDelegate.
|
| + signin_view_->SetDelegate(GetSigninDelegate());
|
| + if (GetSigninDelegate())
|
| + GetSigninDelegate()->AddObserver(this);
|
| + // Show the signin view if the new profile is not signed in.
|
| + OnSigninStatusChanged();
|
| +}
|
| +
|
| void AppListView::SetBubbleArrow(views::BubbleBorder::Arrow arrow) {
|
| GetBubbleFrameView()->bubble_border()->set_arrow(arrow);
|
| SizeToContents(); // Recalcuates with new border.
|
| @@ -178,6 +200,7 @@ void AppListView::OnSigninStatusChanged() {
|
| GetSigninDelegate() && GetSigninDelegate()->NeedSignin();
|
|
|
| signin_view_->SetVisible(needs_signin);
|
| + delegate_->RebuildAvatarMenuItems(model_.get());
|
| app_list_main_view_->SetVisible(!needs_signin);
|
| app_list_main_view_->search_box_view()->InvalidateMenu();
|
| }
|
|
|