Index: chrome/browser/undo/undo_manager.h |
diff --git a/chrome/browser/undo/undo_manager.h b/chrome/browser/undo/undo_manager.h |
index 4031cba74a387eabc5147a2e26c26d8456ceeee9..b3a156c9fe1c96546085d11d7d8e4b6a9eb18137 100644 |
--- a/chrome/browser/undo/undo_manager.h |
+++ b/chrome/browser/undo/undo_manager.h |
@@ -24,9 +24,13 @@ class UndoGroup { |
bool has_operations() const { |
return !operations_.empty(); |
} |
- |
void Undo(); |
+ template <typename F> |
+ void ForEachUndoOperation(F fn) { |
+ std::for_each(operations_.begin(), operations_.end(), fn); |
+ } |
+ |
private: |
ScopedVector<UndoOperation> operations_; |
@@ -61,11 +65,27 @@ class UndoManager { |
void ResumeUndoTracking(); |
bool IsUndoTrakingSuspended() const; |
+ // Remove all undo and redo operations. |
+ void Reset(); |
+ |
+ // Applies |fn| to UndoOperations in all UndoGroups. |
+ template <typename F> |
+ void ForEachUndoOperation(F &fn) { |
+ for (ScopedVector<UndoGroup>::iterator it = undo_actions_.begin(); |
+ it != undo_actions_.end(); ++it) { |
+ (*it)->ForEachUndoOperation(fn); |
+ } |
+ for (ScopedVector<UndoGroup>::iterator it = redo_actions_.begin(); |
+ it != redo_actions_.end(); ++it) { |
+ (*it)->ForEachUndoOperation(fn); |
+ } |
+ } |
+ |
private: |
void Undo(bool* performing_indicator, |
ScopedVector<UndoGroup>* active_undo_group); |
+ bool is_user_action() const { return !performing_undo_ && !performing_redo_; } |
- void RemoveAllActions(); |
void RemoveAllRedoActions(); |
ScopedVector<UndoGroup>* GetActiveUndoGroup(); |