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

Unified Diff: ios/chrome/browser/ui/bookmarks/undo_manager_wrapper.h

Issue 2588713002: Upstream Chrome on iOS source code [4/11]. (Closed)
Patch Set: Created 4 years 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: ios/chrome/browser/ui/bookmarks/undo_manager_wrapper.h
diff --git a/ios/chrome/browser/ui/bookmarks/undo_manager_wrapper.h b/ios/chrome/browser/ui/bookmarks/undo_manager_wrapper.h
new file mode 100644
index 0000000000000000000000000000000000000000..58cfe420f20de35bc7065664dcf2668e2358a92a
--- /dev/null
+++ b/ios/chrome/browser/ui/bookmarks/undo_manager_wrapper.h
@@ -0,0 +1,47 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_UI_BOOKMARKS_UNDO_MANAGER_WRAPPER_H_
+#define IOS_CHROME_BROWSER_UI_BOOKMARKS_UNDO_MANAGER_WRAPPER_H_
+
+#import <Foundation/Foundation.h>
+
+namespace ios {
+class ChromeBrowserState;
+} // namespace ios
+
+// This object is a convenience ObjC wrapper around UndoManager.
+// On construction, it registers itself as an observer of the UndoManager.
+// On destruction, it unregisters itself as an observer of the UndoManager.
+// Provides a convenient interface to the UndoManager.
+// The general usage of this class should be:
+// - startGroupingActions
+// - *make changes to BookmarkModel*
+// - stopGroupingActions
+// - resetUndoManagerChanged
+// At a later point in time, an undo should only be attempted if
+// hasUndoManagerChanged returns NO.
+@interface UndoManagerWrapper : NSObject
+
+// Designated initializer.
+- (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState;
+
+// Subsequent changes to the BookmarkModel are grouped together so that a single
+// undo will revert all changes.
+- (void)startGroupingActions;
+// Stops grouping changes to the BookmarkModel. Calls to this method must mirror
+// calls to startGroupingActions.
+- (void)stopGroupingActions;
+
+// Resets the internal state for whether the UndoManager has changed to NO.
+- (void)resetUndoManagerChanged;
+// Returns YES if the UndoManager has changed since the last call to
+// resetUndoManagerChanged.
+- (BOOL)hasUndoManagerChanged;
+// Reverts the last change made to the BookmarkModel.
+- (void)undo;
+
+@end
+
+#endif // IOS_CHROME_BROWSER_UI_BOOKMARKS_UNDO_MANAGER_WRAPPER_H_

Powered by Google App Engine
This is Rietveld 408576698