Chromium Code Reviews| 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..9bf6d0ed6986194faeabe044578c8e396f80e129 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* child) { |
| + DCHECK(child); |
| + if (!loaded_ || is_root_node(child->parent())) { |
|
sky
2015/04/30 18:16:13
|| is_root_node(child)
Deepak
2015/05/02 08:15:48
Done.
|
| NOTREACHED(); |
| return; |
| } |
| - RemoveAndDeleteNode(AsMutable(parent->GetChild(index))); |
| + RemoveAndDeleteNode(AsMutable(child)); |
| } |
| void BookmarkModel::RemoveAllUserBookmarks() { |
| @@ -847,6 +848,10 @@ void BookmarkModel::RemoveAndDeleteNode(BookmarkNode* delete_me) { |
| const BookmarkNode* parent = node->parent(); |
| DCHECK(parent); |
| int index = parent->GetIndexOf(node.get()); |
| + if (!IsValidIndex(parent, index, false)) { |
|
sky
2015/04/30 18:16:13
DCHECK_NE(-1, index);
Deepak
2015/05/02 08:15:48
Done.
|
| + NOTREACHED(); |
| + return; |
| + } |
| FOR_EACH_OBSERVER(BookmarkModelObserver, observers_, |
| OnWillRemoveBookmarks(this, parent, index, node.get())); |