| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |