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

Unified Diff: chrome/browser/undo/undo_manager.cc

Issue 19287013: Bookmark Undo service for multiple level undo/redo of bookmarks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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
Index: chrome/browser/undo/undo_manager.cc
diff --git a/chrome/browser/undo/undo_manager.cc b/chrome/browser/undo/undo_manager.cc
index 6b1c3de33df11abea08858ab16a2aaa185c2b14c..f7dad05929b6a1c51baf41dd08f81285e825ca50 100644
--- a/chrome/browser/undo/undo_manager.cc
+++ b/chrome/browser/undo/undo_manager.cc
@@ -53,7 +53,7 @@ void UndoManager::Redo() {
void UndoManager::AddUndoOperation(scoped_ptr<UndoOperation> operation) {
sky 2013/07/18 14:35:41 Can you add a max count to this class (you can cre
Tom Cassiotis 2013/07/24 15:37:56 Good idea! I'll get a quick patch for this change
if (IsUndoTrakingSuspended()) {
- RemoveAllActions();
+ Reset();
operation.reset();
return;
}
@@ -65,8 +65,8 @@ void UndoManager::AddUndoOperation(scoped_ptr<UndoOperation> operation) {
new_action->AddOperation(operation.Pass());
GetActiveUndoGroup()->insert(GetActiveUndoGroup()->end(), new_action);
- // A new user action invalidates any available redo actions.
- RemoveAllRedoActions();
+ if (is_user_action())
+ RemoveAllRedoActions();
}
}
@@ -84,11 +84,10 @@ void UndoManager::EndGroupingActions() {
// Check that StartGroupingActions and EndGroupingActions are paired.
DCHECK_GE(group_actions_count_, 0);
- bool is_user_action = !performing_undo_ && !performing_redo_;
if (pending_grouped_action_->has_operations()) {
GetActiveUndoGroup()->push_back(pending_grouped_action_.release());
// User actions invalidate any available redo actions.
- if (is_user_action)
+ if (is_user_action())
RemoveAllRedoActions();
} else {
// No changes were executed since we started grouping actions, so the
@@ -97,7 +96,7 @@ void UndoManager::EndGroupingActions() {
// This situation is only expected when it is a user initiated action.
// Undo/Redo should have at least one operation performed.
- DCHECK(is_user_action);
+ DCHECK(is_user_action());
}
}
@@ -132,7 +131,7 @@ void UndoManager::Undo(bool* performing_indicator,
EndGroupingActions();
}
-void UndoManager::RemoveAllActions() {
+void UndoManager::Reset() {
undo_actions_.clear();
RemoveAllRedoActions();
}

Powered by Google App Engine
This is Rietveld 408576698