OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/app_list/views/start_page_view.h" | 5 #include "ui/app_list/views/start_page_view.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
9 #include "ui/app_list/app_list_constants.h" | 9 #include "ui/app_list/app_list_constants.h" |
10 #include "ui/app_list/app_list_item.h" | 10 #include "ui/app_list/app_list_item.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 tiles_container_->AddChildView(tile_item); | 114 tiles_container_->AddChildView(tile_item); |
115 tile_views_.push_back(tile_item); | 115 tile_views_.push_back(tile_item); |
116 } | 116 } |
117 | 117 |
118 SetModel(view_delegate_->GetModel()); | 118 SetModel(view_delegate_->GetModel()); |
119 view_delegate_->AddObserver(this); | 119 view_delegate_->AddObserver(this); |
120 } | 120 } |
121 | 121 |
122 StartPageView::~StartPageView() { | 122 StartPageView::~StartPageView() { |
123 view_delegate_->RemoveObserver(this); | 123 view_delegate_->RemoveObserver(this); |
| 124 if (model_) |
| 125 model_->RemoveObserver(this); |
124 } | 126 } |
125 | 127 |
126 void StartPageView::SetModel(AppListModel* model) { | 128 void StartPageView::SetModel(AppListModel* model) { |
127 DCHECK(model); | 129 DCHECK(model); |
128 if (model_) | 130 if (model_) |
129 model_->RemoveObserver(this); | 131 model_->RemoveObserver(this); |
130 model_ = model; | 132 model_ = model; |
131 model_->AddObserver(this); | 133 model_->AddObserver(this); |
132 Reset(); | 134 Reset(); |
133 } | 135 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 169 |
168 void StartPageView::OnAppListItemDeleted() { | 170 void StartPageView::OnAppListItemDeleted() { |
169 Reset(); | 171 Reset(); |
170 } | 172 } |
171 | 173 |
172 void StartPageView::OnAppListItemUpdated(AppListItem* item) { | 174 void StartPageView::OnAppListItemUpdated(AppListItem* item) { |
173 Reset(); | 175 Reset(); |
174 } | 176 } |
175 | 177 |
176 } // namespace app_list | 178 } // namespace app_list |
OLD | NEW |