Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Unified Diff: ash/shelf/shelf_model.cc

Issue 2833173002: mash: Support ShelfModel access in Chrome. (Closed)
Patch Set: Cleanup; Fix an Arc test by use CLC, not Ash's ShelfModel. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698