| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ash/common/shelf/shelf_model.h" | 5 #include "ash/common/shelf/shelf_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/common/shelf/shelf_model_observer.h" | 9 #include "ash/common/shelf/shelf_model_observer.h" |
| 10 | 10 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } | 125 } |
| 126 | 126 |
| 127 int ShelfModel::GetItemIndexForType(ShelfItemType type) { | 127 int ShelfModel::GetItemIndexForType(ShelfItemType type) { |
| 128 for (size_t i = 0; i < items_.size(); ++i) { | 128 for (size_t i = 0; i < items_.size(); ++i) { |
| 129 if (items_[i].type == type) | 129 if (items_[i].type == type) |
| 130 return i; | 130 return i; |
| 131 } | 131 } |
| 132 return -1; | 132 return -1; |
| 133 } | 133 } |
| 134 | 134 |
| 135 ShelfItems::const_iterator ShelfModel::ItemByID(int id) const { | 135 ShelfItems::const_iterator ShelfModel::ItemByID(ShelfID id) const { |
| 136 for (ShelfItems::const_iterator i = items_.begin(); i != items_.end(); ++i) { | 136 for (ShelfItems::const_iterator i = items_.begin(); i != items_.end(); ++i) { |
| 137 if (i->id == id) | 137 if (i->id == id) |
| 138 return i; | 138 return i; |
| 139 } | 139 } |
| 140 return items_.end(); | 140 return items_.end(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 int ShelfModel::FirstRunningAppIndex() const { | 143 int ShelfModel::FirstRunningAppIndex() const { |
| 144 ShelfItem weight_dummy; | 144 ShelfItem weight_dummy; |
| 145 weight_dummy.type = TYPE_APP; | 145 weight_dummy.type = TYPE_APP; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 201 |
| 202 return index; | 202 return index; |
| 203 } | 203 } |
| 204 | 204 |
| 205 void ShelfModel::RemoveShelfItemDelegate(ShelfID id) { | 205 void ShelfModel::RemoveShelfItemDelegate(ShelfID id) { |
| 206 if (id_to_item_delegate_map_.find(id) != id_to_item_delegate_map_.end()) | 206 if (id_to_item_delegate_map_.find(id) != id_to_item_delegate_map_.end()) |
| 207 id_to_item_delegate_map_.erase(id); | 207 id_to_item_delegate_map_.erase(id); |
| 208 } | 208 } |
| 209 | 209 |
| 210 } // namespace ash | 210 } // namespace ash |
| OLD | NEW |