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