| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/undo/bookmark_undo_service.h" | 5 #include "components/undo/bookmark_undo_service.h" |
| 6 | 6 |
| 7 #include "components/bookmarks/browser/bookmark_model.h" | 7 #include "components/bookmarks/browser/bookmark_model.h" |
| 8 #include "components/bookmarks/browser/bookmark_node_data.h" | 8 #include "components/bookmarks/browser/bookmark_node_data.h" |
| 9 #include "components/bookmarks/browser/bookmark_utils.h" | 9 #include "components/bookmarks/browser/bookmark_utils.h" |
| 10 #include "components/bookmarks/browser/scoped_group_bookmark_actions.h" | 10 #include "components/bookmarks/browser/scoped_group_bookmark_actions.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 parent_id_(parent->id()), | 77 parent_id_(parent->id()), |
| 78 index_(index) { | 78 index_(index) { |
| 79 } | 79 } |
| 80 | 80 |
| 81 void BookmarkAddOperation::Undo() { | 81 void BookmarkAddOperation::Undo() { |
| 82 BookmarkModel* model = bookmark_model(); | 82 BookmarkModel* model = bookmark_model(); |
| 83 const BookmarkNode* parent = | 83 const BookmarkNode* parent = |
| 84 bookmarks::GetBookmarkNodeByID(model, parent_id_); | 84 bookmarks::GetBookmarkNodeByID(model, parent_id_); |
| 85 DCHECK(parent); | 85 DCHECK(parent); |
| 86 | 86 |
| 87 model->Remove(parent, index_); | 87 model->Remove(parent->GetChild(index_)); |
| 88 } | 88 } |
| 89 | 89 |
| 90 int BookmarkAddOperation::GetUndoLabelId() const { | 90 int BookmarkAddOperation::GetUndoLabelId() const { |
| 91 return IDS_BOOKMARK_BAR_UNDO_ADD; | 91 return IDS_BOOKMARK_BAR_UNDO_ADD; |
| 92 } | 92 } |
| 93 | 93 |
| 94 int BookmarkAddOperation::GetRedoLabelId() const { | 94 int BookmarkAddOperation::GetRedoLabelId() const { |
| 95 return IDS_BOOKMARK_BAR_REDO_DELETE; | 95 return IDS_BOOKMARK_BAR_REDO_DELETE; |
| 96 } | 96 } |
| 97 | 97 |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 } | 486 } |
| 487 | 487 |
| 488 void BookmarkUndoService::OnBookmarkRenumbered(int64 old_id, int64 new_id) { | 488 void BookmarkUndoService::OnBookmarkRenumbered(int64 old_id, int64 new_id) { |
| 489 std::vector<UndoOperation*> all_operations = | 489 std::vector<UndoOperation*> all_operations = |
| 490 undo_manager()->GetAllUndoOperations(); | 490 undo_manager()->GetAllUndoOperations(); |
| 491 for (UndoOperation* op : all_operations) { | 491 for (UndoOperation* op : all_operations) { |
| 492 static_cast<BookmarkUndoOperation*>(op) | 492 static_cast<BookmarkUndoOperation*>(op) |
| 493 ->OnBookmarkRenumbered(old_id, new_id); | 493 ->OnBookmarkRenumbered(old_id, new_id); |
| 494 } | 494 } |
| 495 } | 495 } |
| OLD | NEW |