| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 286 |
| 287 if (selected_item_index_ >= 0) | 287 if (selected_item_index_ >= 0) |
| 288 GetItemViewAtIndex(selected_item_index_)->SchedulePaint(); | 288 GetItemViewAtIndex(selected_item_index_)->SchedulePaint(); |
| 289 | 289 |
| 290 if (index < 0 || index >= child_count()) { | 290 if (index < 0 || index >= child_count()) { |
| 291 selected_item_index_ = -1; | 291 selected_item_index_ = -1; |
| 292 } else { | 292 } else { |
| 293 selected_item_index_ = index; | 293 selected_item_index_ = index; |
| 294 AppListItemView* selected_view = GetItemViewAtIndex(selected_item_index_); | 294 AppListItemView* selected_view = GetItemViewAtIndex(selected_item_index_); |
| 295 selected_view->SchedulePaint(); | 295 selected_view->SchedulePaint(); |
| 296 GetWidget()->NotifyAccessibilityEvent( | 296 if (GetWidget()) { |
| 297 selected_view, ui::AccessibilityTypes::EVENT_FOCUS, true); | 297 GetWidget()->NotifyAccessibilityEvent( |
| 298 selected_view, ui::AccessibilityTypes::EVENT_FOCUS, true); |
| 299 } |
| 298 | 300 |
| 299 if (tiles_per_page()) { | 301 if (tiles_per_page()) { |
| 300 pagination_model_->SelectPage(selected_item_index_ / tiles_per_page(), | 302 pagination_model_->SelectPage(selected_item_index_ / tiles_per_page(), |
| 301 true /* animate */); | 303 true /* animate */); |
| 302 } | 304 } |
| 303 } | 305 } |
| 304 } | 306 } |
| 305 | 307 |
| 306 void AppsGridView::ListItemsAdded(size_t start, size_t count) { | 308 void AppsGridView::ListItemsAdded(size_t start, size_t count) { |
| 307 for (size_t i = start; i < start + count; ++i) | 309 for (size_t i = start; i < start + count; ++i) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 337 void AppsGridView::TransitionChanged() { | 339 void AppsGridView::TransitionChanged() { |
| 338 // Update layout for valid page transition only since over-scroll no longer | 340 // Update layout for valid page transition only since over-scroll no longer |
| 339 // animates app icons. | 341 // animates app icons. |
| 340 const PaginationModel::Transition& transition = | 342 const PaginationModel::Transition& transition = |
| 341 pagination_model_->transition(); | 343 pagination_model_->transition(); |
| 342 if (pagination_model_->is_valid_page(transition.target_page)) | 344 if (pagination_model_->is_valid_page(transition.target_page)) |
| 343 Layout(); | 345 Layout(); |
| 344 } | 346 } |
| 345 | 347 |
| 346 } // namespace app_list | 348 } // namespace app_list |
| OLD | NEW |