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

Unified Diff: ui/app_list/app_list_model.cc

Issue 487853003: Add additional CHECKs to AppListModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + feedback Created 6 years, 4 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
« no previous file with comments | « ui/app_list/app_list_item_list_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/app_list_model.cc
diff --git a/ui/app_list/app_list_model.cc b/ui/app_list/app_list_model.cc
index 2d0f58f64500196d931c7badf513c7dd7f4a5843..22ac8a25634973496035b81e118e10ef1e14ad89 100644
--- a/ui/app_list/app_list_model.cc
+++ b/ui/app_list/app_list_model.cc
@@ -74,8 +74,8 @@ AppListItem* AppListModel::AddItemToFolder(scoped_ptr<AppListItem> item,
if (folder_id.empty())
return AddItem(item.Pass());
DVLOG(2) << "AddItemToFolder: " << item->id() << ": " << folder_id;
- DCHECK(!item->IsInFolder() || item->folder_id() == folder_id);
- DCHECK(item->GetItemType() != AppListFolderItem::kItemType);
+ CHECK_NE(folder_id, item->folder_id());
+ DCHECK_NE(AppListFolderItem::kItemType, item->GetItemType());
AppListFolderItem* dest_folder = FindOrCreateFolderItem(folder_id);
if (!dest_folder)
return NULL;
@@ -159,10 +159,12 @@ void AppListModel::MoveItemToFolder(AppListItem* item,
return;
AppListFolderItem* dest_folder = FindOrCreateFolderItem(folder_id);
scoped_ptr<AppListItem> item_ptr = RemoveItem(item);
- if (dest_folder)
+ if (dest_folder) {
+ CHECK(!item->IsInFolder());
AddItemToFolderItemAndNotify(dest_folder, item_ptr.Pass());
- else
+ } else {
AddItemToItemListAndNotifyUpdate(item_ptr.Pass());
+ }
}
bool AppListModel::MoveItemToFolderAt(AppListItem* item,
@@ -357,6 +359,7 @@ AppListItem* AppListModel::AddItemToItemListAndNotifyUpdate(
AppListItem* AppListModel::AddItemToFolderItemAndNotify(
AppListFolderItem* folder,
scoped_ptr<AppListItem> item_ptr) {
+ CHECK_NE(folder->id(), item_ptr->folder_id());
AppListItem* item = folder->item_list()->AddItem(item_ptr.Pass());
item->set_folder_id(folder->id());
FOR_EACH_OBSERVER(AppListModelObserver,
@@ -377,7 +380,7 @@ scoped_ptr<AppListItem> AppListModel::RemoveItemFromFolder(
AppListFolderItem* folder,
AppListItem* item) {
std::string folder_id = folder->id();
- DCHECK_EQ(item->folder_id(), folder_id);
+ CHECK_EQ(item->folder_id(), folder_id);
scoped_ptr<AppListItem> result = folder->item_list()->RemoveItem(item->id());
result->set_folder_id("");
if (folder->item_list()->item_count() == 0) {
« no previous file with comments | « ui/app_list/app_list_item_list_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698