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

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

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

Powered by Google App Engine
This is Rietveld 408576698