OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_UI_BOOKMARKS_UNDO_MANAGER_WRAPPER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_BOOKMARKS_UNDO_MANAGER_WRAPPER_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 namespace ios { |
| 11 class ChromeBrowserState; |
| 12 } // namespace ios |
| 13 |
| 14 // This object is a convenience ObjC wrapper around UndoManager. |
| 15 // On construction, it registers itself as an observer of the UndoManager. |
| 16 // On destruction, it unregisters itself as an observer of the UndoManager. |
| 17 // Provides a convenient interface to the UndoManager. |
| 18 // The general usage of this class should be: |
| 19 // - startGroupingActions |
| 20 // - *make changes to BookmarkModel* |
| 21 // - stopGroupingActions |
| 22 // - resetUndoManagerChanged |
| 23 // At a later point in time, an undo should only be attempted if |
| 24 // hasUndoManagerChanged returns NO. |
| 25 @interface UndoManagerWrapper : NSObject |
| 26 |
| 27 // Designated initializer. |
| 28 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState; |
| 29 |
| 30 // Subsequent changes to the BookmarkModel are grouped together so that a single |
| 31 // undo will revert all changes. |
| 32 - (void)startGroupingActions; |
| 33 // Stops grouping changes to the BookmarkModel. Calls to this method must mirror |
| 34 // calls to startGroupingActions. |
| 35 - (void)stopGroupingActions; |
| 36 |
| 37 // Resets the internal state for whether the UndoManager has changed to NO. |
| 38 - (void)resetUndoManagerChanged; |
| 39 // Returns YES if the UndoManager has changed since the last call to |
| 40 // resetUndoManagerChanged. |
| 41 - (BOOL)hasUndoManagerChanged; |
| 42 // Reverts the last change made to the BookmarkModel. |
| 43 - (void)undo; |
| 44 |
| 45 @end |
| 46 |
| 47 #endif // IOS_CHROME_BROWSER_UI_BOOKMARKS_UNDO_MANAGER_WRAPPER_H_ |
OLD | NEW |