| 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 "chrome/browser/ui/app_list/apps_model_builder.h" | 5 #include "chrome/browser/ui/app_list/apps_model_builder.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 int index = FindApp(highlight_app_id_); | 301 int index = FindApp(highlight_app_id_); |
| 302 if (index == -1) | 302 if (index == -1) |
| 303 return; | 303 return; |
| 304 | 304 |
| 305 model_->GetItemAt(index)->SetHighlighted(true); | 305 model_->GetItemAt(index)->SetHighlighted(true); |
| 306 highlighted_app_pending_ = false; | 306 highlighted_app_pending_ = false; |
| 307 } | 307 } |
| 308 | 308 |
| 309 ExtensionAppItem* AppsModelBuilder::GetAppAt(size_t index) { | 309 ExtensionAppItem* AppsModelBuilder::GetAppAt(size_t index) { |
| 310 DCHECK_LT(index, model_->item_count()); | 310 DCHECK_LT(index, model_->item_count()); |
| 311 ChromeAppListItem* item = | 311 return static_cast<ExtensionAppItem*>(model_->GetItemAt(index)); |
| 312 static_cast<ChromeAppListItem*>(model_->GetItemAt(index)); | |
| 313 DCHECK_EQ(item->type(), ChromeAppListItem::TYPE_APP); | |
| 314 | |
| 315 return static_cast<ExtensionAppItem*>(item); | |
| 316 } | 312 } |
| 317 | 313 |
| 318 void AppsModelBuilder::ListItemsAdded(size_t start, size_t count) { | 314 void AppsModelBuilder::ListItemsAdded(size_t start, size_t count) { |
| 319 } | 315 } |
| 320 | 316 |
| 321 void AppsModelBuilder::ListItemsRemoved(size_t start, size_t count) { | 317 void AppsModelBuilder::ListItemsRemoved(size_t start, size_t count) { |
| 322 } | 318 } |
| 323 | 319 |
| 324 void AppsModelBuilder::ListItemMoved(size_t index, size_t target_index) { | 320 void AppsModelBuilder::ListItemMoved(size_t index, size_t target_index) { |
| 325 if (ignore_changes_) | 321 if (ignore_changes_) |
| 326 return; | 322 return; |
| 327 | 323 |
| 328 ExtensionAppItem* prev = target_index > 0 ? GetAppAt(target_index - 1) : NULL; | 324 ExtensionAppItem* prev = target_index > 0 ? GetAppAt(target_index - 1) : NULL; |
| 329 ExtensionAppItem* next = target_index + 1 < model_->item_count() ? | 325 ExtensionAppItem* next = target_index + 1 < model_->item_count() ? |
| 330 GetAppAt(target_index + 1) : NULL; | 326 GetAppAt(target_index + 1) : NULL; |
| 331 GetAppAt(target_index)->Move(prev, next); | 327 GetAppAt(target_index)->Move(prev, next); |
| 332 } | 328 } |
| 333 | 329 |
| 334 void AppsModelBuilder::ListItemsChanged(size_t start, size_t count) { | 330 void AppsModelBuilder::ListItemsChanged(size_t start, size_t count) { |
| 335 NOTREACHED(); | 331 NOTREACHED(); |
| 336 } | 332 } |
| OLD | NEW |