Index: ash/shelf/shelf_model.cc |
diff --git a/ash/shelf/shelf_model.cc b/ash/shelf/shelf_model.cc |
index e5ddd25680b09483ebeb2074dd498ffeed4b7f89..85262e384df30b90eecb560bb06aedb520296531 100644 |
--- a/ash/shelf/shelf_model.cc |
+++ b/ash/shelf/shelf_model.cc |
@@ -106,8 +106,8 @@ int ShelfModel::Add(const ShelfItem& item) { |
int ShelfModel::AddAt(int index, const ShelfItem& item) { |
// Items should have unique non-empty ids to avoid undefined model behavior. |
- DCHECK(!item.id.IsNull()); |
- DCHECK_EQ(ItemIndexByID(item.id), -1); |
+ DCHECK(!item.id.IsNull()) << " The id is null."; |
+ DCHECK_EQ(ItemIndexByID(item.id), -1) << " The id is not unique: " << item.id; |
index = ValidateInsertionIndex(item.type, index); |
items_.insert(items_.begin() + index, item); |
for (auto& observer : observers_) |
@@ -210,6 +210,10 @@ void ShelfModel::SetShelfItemDelegate( |
item_delegate->set_shelf_id(shelf_id); |
// This assignment replaces any ShelfItemDelegate already registered for |id|. |
id_to_item_delegate_map_[shelf_id] = std::move(item_delegate); |
+ for (auto& observer : observers_) { |
+ observer.ShelfItemDelegateChanged(shelf_id, |
+ id_to_item_delegate_map_[shelf_id].get()); |
+ } |
} |
ShelfItemDelegate* ShelfModel::GetShelfItemDelegate(const ShelfID& shelf_id) { |