OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/app_list_item_list.h" | 5 #include "ui/app_list/app_list_item_list.h" |
6 | 6 |
7 #include "ui/app_list/app_list_item.h" | 7 #include "ui/app_list/app_list_item.h" |
8 | 8 |
9 namespace app_list { | 9 namespace app_list { |
10 | 10 |
11 AppListItemList::AppListItemList() { | 11 AppListItemList::AppListItemList() { |
12 } | 12 } |
13 | 13 |
14 AppListItemList::~AppListItemList() { | 14 AppListItemList::~AppListItemList() { |
15 } | 15 } |
16 | 16 |
17 void AppListItemList::AddObserver(AppListItemListObserver* observer) { | 17 void AppListItemList::AddObserver(AppListItemListObserver* observer) { |
18 observers_.AddObserver(observer); | 18 observers_.AddObserver(observer); |
19 } | 19 } |
20 | 20 |
21 void AppListItemList::RemoveObserver(AppListItemListObserver* observer) { | 21 void AppListItemList::RemoveObserver(AppListItemListObserver* observer) { |
| 22 DCHECK(observers_.HasObserver(observer)); |
22 observers_.RemoveObserver(observer); | 23 observers_.RemoveObserver(observer); |
23 } | 24 } |
24 | 25 |
25 AppListItem* AppListItemList::FindItem(const std::string& id) { | 26 AppListItem* AppListItemList::FindItem(const std::string& id) { |
26 for (size_t i = 0; i < app_list_items_.size(); ++i) { | 27 for (size_t i = 0; i < app_list_items_.size(); ++i) { |
27 AppListItem* item = app_list_items_[i]; | 28 AppListItem* item = app_list_items_[i]; |
28 if (item->id() == id) | 29 if (item->id() == id) |
29 return item; | 30 return item; |
30 } | 31 } |
31 return NULL; | 32 return NULL; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 else | 237 else |
237 cur->set_position(prev->position().CreateAfter()); | 238 cur->set_position(prev->position().CreateAfter()); |
238 prev = cur; | 239 prev = cur; |
239 } | 240 } |
240 FOR_EACH_OBSERVER(AppListItemListObserver, | 241 FOR_EACH_OBSERVER(AppListItemListObserver, |
241 observers_, | 242 observers_, |
242 OnListItemMoved(index, index, app_list_items_[index])); | 243 OnListItemMoved(index, index, app_list_items_[index])); |
243 } | 244 } |
244 | 245 |
245 } // namespace app_list | 246 } // namespace app_list |
OLD | NEW |