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

Side by Side Diff: ios/chrome/browser/ui/bookmarks/bookmark_home_handset_view_controller.h

Issue 2929993002: Refactoring bookmark viewcontrollers (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_HOME_HANDSET_VIEW_CONTROLLER_H_ 5 #ifndef IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_HOME_HANDSET_VIEW_CONTROLLER_H_
6 #define IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_HOME_HANDSET_VIEW_CONTROLLER_H_ 6 #define IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_HOME_HANDSET_VIEW_CONTROLLER_H_
7 7
8 #import "ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.h" 8 #import <UIKit/UIKit.h>
9
10 #include <set>
11 #include <vector>
12
13 @class BookmarkHomeHandsetViewController;
14 @class BookmarkCollectionView;
15 class GURL;
16 @protocol UrlLoader;
17
18 namespace bookmarks {
19 class BookmarkModel;
20 class BookmarkNode;
21 } // namespace bookmarks
22
23 namespace ios {
24 class ChromeBrowserState;
25 } // namespace ios
26
27 @protocol BookmarkHomeHandsetViewControllerDelegate
28 // The view controller wants to be dismissed.
29 // If |url| != GURL(), then the user has selected |url| for navigation.
30 - (void)bookmarkHomeHandsetViewControllerWantsDismissal:
31 (BookmarkHomeHandsetViewController*)controller
32 navigationToUrl:(const GURL&)url;
33 @end
9 34
10 // Navigate/edit the bookmark hierarchy on a handset. 35 // Navigate/edit the bookmark hierarchy on a handset.
11 @interface BookmarkHomeHandsetViewController : BookmarkHomeViewController 36 @interface BookmarkHomeHandsetViewController : UIViewController {
37 @protected
38 // The following 2 ivars both represent the set of nodes being edited.
39 // The set is for fast lookup.
40 // The vector maintains the order that edit nodes were added.
41 // Use the relevant instance methods to modify these two ivars in tandem.
42 // DO NOT modify these two ivars directly.
43 std::set<const bookmarks::BookmarkNode*> _editNodes;
44 std::vector<const bookmarks::BookmarkNode*> _editNodesOrdered;
45 }
12 // Designated initializer. 46 // Designated initializer.
13 - (instancetype)initWithLoader:(id<UrlLoader>)loader 47 - (instancetype)initWithLoader:(id<UrlLoader>)loader
14 browserState:(ios::ChromeBrowserState*)browserState; 48 browserState:(ios::ChromeBrowserState*)browserState;
49
50 #pragma mark - Properties Relevant To Presenters
51
52 @property(nonatomic, weak) id<BookmarkHomeHandsetViewControllerDelegate>
53 delegate;
54
55 #pragma mark - Properties
56 // Whether the view controller is in editing mode.
57 @property(nonatomic, assign, readonly) BOOL editing;
58 // The set of selected index paths for edition.
59 @property(nonatomic, strong, readonly) NSMutableArray* editIndexPaths;
60 @property(nonatomic, assign, readonly) bookmarks::BookmarkModel* bookmarks;
61 @property(nonatomic, weak, readonly) id<UrlLoader> loader;
62 @property(nonatomic, assign, readonly) ios::ChromeBrowserState* browserState;
63
64 #pragma mark - Relevant Methods
65 // Replaces |_editNodes| and |_editNodesOrdered| with new container objects.
66 - (void)resetEditNodes;
67 // Adds |node| and |indexPath| if it isn't already present.
68 - (void)insertEditNode:(const bookmarks::BookmarkNode*)node
69 atIndexPath:(NSIndexPath*)indexPath;
70 // Removes |node| and |indexPath| if it's present.
71 - (void)removeEditNode:(const bookmarks::BookmarkNode*)node
72 atIndexPath:(NSIndexPath*)indexPath;
73
74 // This method updates the property, and resets the edit nodes.
75 - (void)setEditing:(BOOL)editing animated:(BOOL)animated;
76
77 // Dismisses any modal interaction elements. The base implementation does
78 // nothing.
79 - (void)dismissModals:(BOOL)animated;
80
15 @end 81 @end
16 82
17 @interface BookmarkHomeHandsetViewController (ExposedForTesting) 83 @interface BookmarkHomeHandsetViewController (ExposedForTesting)
18 // Creates the default view to show all bookmarks, if it doesn't already exist. 84 // Creates the default view to show all bookmarks, if it doesn't already exist.
19 - (void)ensureAllViewExists; 85 - (void)ensureAllViewExists;
86 - (const std::set<const bookmarks::BookmarkNode*>&)editNodes;
87 - (void)setEditNodes:(const std::set<const bookmarks::BookmarkNode*>&)editNodes;
20 @end 88 @end
21 89
22 #endif // IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_HOME_HANDSET_VIEW_CONTROLLER _H_ 90 #endif // IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_HOME_HANDSET_VIEW_CONTROLLER _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698