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(); |
} |