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

Side by Side Diff: ui/app_list/apps_grid_view.cc

Issue 10892017: app_list: Fix crash after uninstalling last app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add test Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « ui/app_list/apps_grid_view.h ('k') | ui/app_list/apps_grid_view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/apps_grid_view.h" 5 #include "ui/app_list/apps_grid_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/app_list/app_list_item_view.h" 9 #include "ui/app_list/app_list_item_view.h"
10 #include "ui/app_list/pagination_model.h" 10 #include "ui/app_list/pagination_model.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 if (selected_item_index_ >= 0) 230 if (selected_item_index_ >= 0)
231 handled = GetItemViewAtIndex(selected_item_index_)->OnKeyReleased(event); 231 handled = GetItemViewAtIndex(selected_item_index_)->OnKeyReleased(event);
232 232
233 return handled; 233 return handled;
234 } 234 }
235 235
236 void AppsGridView::OnPaintFocusBorder(gfx::Canvas* canvas) { 236 void AppsGridView::OnPaintFocusBorder(gfx::Canvas* canvas) {
237 // Override to not paint focus frame. 237 // Override to not paint focus frame.
238 } 238 }
239 239
240 void AppsGridView::ViewHierarchyChanged(bool is_add,
241 views::View* parent,
242 views::View* child) {
243 if (!is_add) {
244 if (parent == this &&
245 selected_item_index_ >= 0 &&
246 GetItemViewAtIndex(selected_item_index_) == child) {
247 selected_item_index_ = -1;
248 }
249 }
250 }
251
240 void AppsGridView::Update() { 252 void AppsGridView::Update() {
241 selected_item_index_ = -1; 253 selected_item_index_ = -1;
242 RemoveAllChildViews(true); 254 RemoveAllChildViews(true);
243 if (!model_ || model_->item_count() == 0) 255 if (!model_ || model_->item_count() == 0)
244 return; 256 return;
245 257
246 for (size_t i = 0; i < model_->item_count(); ++i) 258 for (size_t i = 0; i < model_->item_count(); ++i)
247 AddChildView(CreateViewForItemAtIndex(i)); 259 AddChildView(CreateViewForItemAtIndex(i));
248 260
249 UpdatePaginationModel(); 261 UpdatePaginationModel();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 331
320 void AppsGridView::SelectedPageChanged(int old_selected, int new_selected) { 332 void AppsGridView::SelectedPageChanged(int old_selected, int new_selected) {
321 Layout(); 333 Layout();
322 } 334 }
323 335
324 void AppsGridView::TransitionChanged() { 336 void AppsGridView::TransitionChanged() {
325 Layout(); 337 Layout();
326 } 338 }
327 339
328 } // namespace app_list 340 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/apps_grid_view.h ('k') | ui/app_list/apps_grid_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698