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 "chrome/browser/undo/bookmark_undo_service.h" | 5 #include "chrome/browser/undo/bookmark_undo_service.h" |
6 | 6 |
7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/undo/bookmark_renumber_observer.h" | 9 #include "chrome/browser/undo/bookmark_renumber_observer.h" |
10 #include "chrome/browser/undo/bookmark_undo_service_factory.h" | 10 #include "chrome/browser/undo/bookmark_undo_service_factory.h" |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 int old_index, | 427 int old_index, |
428 const BookmarkNode* node) { | 428 const BookmarkNode* node) { |
429 scoped_ptr<UndoOperation> op(new BookmarkRemoveOperation(profile_, | 429 scoped_ptr<UndoOperation> op(new BookmarkRemoveOperation(profile_, |
430 parent, | 430 parent, |
431 old_index, | 431 old_index, |
432 node)); | 432 node)); |
433 undo_manager()->AddUndoOperation(op.Pass()); | 433 undo_manager()->AddUndoOperation(op.Pass()); |
434 } | 434 } |
435 | 435 |
436 void BookmarkUndoService::OnWillRemoveAllBookmarks(BookmarkModel* model) { | 436 void BookmarkUndoService::OnWillRemoveAllBookmarks(BookmarkModel* model) { |
437 ScopedGroupBookmarkActions merge_removes(model); | 437 bookmarks::ScopedGroupBookmarkActions merge_removes(model); |
438 for (int i = 0; i < model->root_node()->child_count(); ++i) { | 438 for (int i = 0; i < model->root_node()->child_count(); ++i) { |
439 const BookmarkNode* permanent_node = model->root_node()->GetChild(i); | 439 const BookmarkNode* permanent_node = model->root_node()->GetChild(i); |
440 for (int j = permanent_node->child_count() - 1; j >= 0; --j) { | 440 for (int j = permanent_node->child_count() - 1; j >= 0; --j) { |
441 scoped_ptr<UndoOperation> op(new BookmarkRemoveOperation(profile_, | 441 scoped_ptr<UndoOperation> op(new BookmarkRemoveOperation(profile_, |
442 permanent_node, j, permanent_node->GetChild(j))); | 442 permanent_node, j, permanent_node->GetChild(j))); |
443 undo_manager()->AddUndoOperation(op.Pass()); | 443 undo_manager()->AddUndoOperation(op.Pass()); |
444 } | 444 } |
445 } | 445 } |
446 } | 446 } |
447 | 447 |
(...skipping 20 matching lines...) Expand all Loading... |
468 | 468 |
469 void BookmarkUndoService::OnBookmarkRenumbered(int64 old_id, int64 new_id) { | 469 void BookmarkUndoService::OnBookmarkRenumbered(int64 old_id, int64 new_id) { |
470 std::vector<UndoOperation*> all_operations = | 470 std::vector<UndoOperation*> all_operations = |
471 undo_manager()->GetAllUndoOperations(); | 471 undo_manager()->GetAllUndoOperations(); |
472 for (std::vector<UndoOperation*>::iterator it = all_operations.begin(); | 472 for (std::vector<UndoOperation*>::iterator it = all_operations.begin(); |
473 it != all_operations.end(); ++it) { | 473 it != all_operations.end(); ++it) { |
474 static_cast<BookmarkUndoOperation*>(*it)->OnBookmarkRenumbered(old_id, | 474 static_cast<BookmarkUndoOperation*>(*it)->OnBookmarkRenumbered(old_id, |
475 new_id); | 475 new_id); |
476 } | 476 } |
477 } | 477 } |
OLD | NEW |