Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Side by Side Diff: ui/app_list/views/start_page_view.cc

Issue 305123002: Fix crash in the experimental app list StartPageView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/app_list/views/app_list_view_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/app_list/views/app_list_view_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698