Index: components/bookmarks/browser/bookmark_model.cc |
diff --git a/components/bookmarks/browser/bookmark_model.cc b/components/bookmarks/browser/bookmark_model.cc |
index 10d5b2f24ea2dbd107fa88b87dd84bfa34cc30ed..2e174dbedc63314fc2de85d1accdda9582439c90 100644 |
--- a/components/bookmarks/browser/bookmark_model.cc |
+++ b/components/bookmarks/browser/bookmark_model.cc |
@@ -188,12 +188,13 @@ void BookmarkModel::EndGroupedChanges() { |
GroupedBookmarkChangesEnded(this)); |
} |
-void BookmarkModel::Remove(const BookmarkNode* parent, int index) { |
- if (!loaded_ || !IsValidIndex(parent, index, false) || is_root_node(parent)) { |
+void BookmarkModel::Remove(const BookmarkNode* node) { |
+ DCHECK(node); |
+ if (!loaded_ || is_root_node(node)) { |
NOTREACHED(); |
return; |
} |
- RemoveAndDeleteNode(AsMutable(parent->GetChild(index))); |
+ RemoveAndDeleteNode(AsMutable(node)); |
} |
void BookmarkModel::RemoveAllUserBookmarks() { |
@@ -847,6 +848,7 @@ void BookmarkModel::RemoveAndDeleteNode(BookmarkNode* delete_me) { |
const BookmarkNode* parent = node->parent(); |
DCHECK(parent); |
int index = parent->GetIndexOf(node.get()); |
+ DCHECK_NE(-1, index); |
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_, |
OnWillRemoveBookmarks(this, parent, index, node.get())); |