OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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_HOME_VIEW_CONTROLLER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_BOOKMARKS_HOME_VIEW_CONTROLLER_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 #include <set> |
| 11 #include <vector> |
| 12 |
| 13 @protocol UrlLoader; |
| 14 @protocol BookmarkHomePrimaryView; |
| 15 |
| 16 namespace ios { |
| 17 class ChromeBrowserState; |
| 18 } // namespace ios |
| 19 |
| 20 namespace bookmarks { |
| 21 class BookmarkModel; |
| 22 } // namespace bookmarks |
| 23 |
| 24 @class BookmarkCollectionView; |
| 25 @class BookmarkPanelView; |
| 26 @class BookmarkMenuView; |
| 27 @class BookmarkHomeWaitingView; |
| 28 @class BookmarkNavigationBar; |
| 29 @class BookmarkMenuItem; |
| 30 |
| 31 // Class to navigate the bookmark hierarchy, needs subclassing for tablet / |
| 32 // handset case. |
| 33 @interface BookmarkHomeViewController : UIViewController |
| 34 |
| 35 - (instancetype)initWithNibName:(NSString*)nibNameOrNil |
| 36 bundle:(NSBundle*)nibBundleOrNil NS_UNAVAILABLE; |
| 37 - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; |
| 38 - (instancetype)init NS_UNAVAILABLE; |
| 39 - (instancetype)initWithLoader:(id<UrlLoader>)loader |
| 40 browserState:(ios::ChromeBrowserState*)browserState |
| 41 NS_DESIGNATED_INITIALIZER; |
| 42 |
| 43 // The bookmark model used. |
| 44 @property(nonatomic, assign, readonly) bookmarks::BookmarkModel* bookmarks; |
| 45 |
| 46 // The user's browser state model used. |
| 47 @property(nonatomic, assign, readonly) ios::ChromeBrowserState* browserState; |
| 48 |
| 49 // The main view showing all the bookmarks. |
| 50 @property(nonatomic, strong, readonly) BookmarkCollectionView* folderView; |
| 51 |
| 52 // Object to load URLs. |
| 53 @property(nonatomic, weak, readonly) id<UrlLoader> loader; |
| 54 |
| 55 // The menu with all the folders. |
| 56 @property(nonatomic, strong, readonly) BookmarkMenuView* menuView; |
| 57 |
| 58 // The navigation bar sits on top of the main content. |
| 59 @property(nonatomic, strong, readonly) BookmarkNavigationBar* navigationBar; |
| 60 |
| 61 // At any point in time, there is exactly one collection view whose view is part |
| 62 // of the view hierarchy. This property determines what data is visible in the |
| 63 // collection view. |
| 64 @property(nonatomic, strong, readonly) BookmarkMenuItem* primaryMenuItem; |
| 65 |
| 66 // This view holds a content view, and a menu view. |
| 67 @property(nonatomic, strong, readonly) BookmarkPanelView* panelView; |
| 68 |
| 69 // Either the menu or the primaryView can scrollToTop. |
| 70 @property(nonatomic, assign) BOOL scrollToTop; |
| 71 |
| 72 // This view is created and used if the model is not fully loaded yet by the |
| 73 // time this controller starts. Property is readwrite, so that subclasses can |
| 74 // set it to nil, once finished with it. |
| 75 @property(nonatomic, strong) BookmarkHomeWaitingView* waitForModelView; |
| 76 |
| 77 // This method should be called at most once in the life-cycle of the class. |
| 78 // It should be called at the soonest possible time after the view has been |
| 79 // loaded, and the bookmark model is loaded. |
| 80 - (void)loadBookmarkViews; |
| 81 |
| 82 // Returns the width of the menu. |
| 83 - (CGFloat)menuWidth; |
| 84 |
| 85 // This method is called if the view needs to be loaded and the model is not |
| 86 // ready yet. |
| 87 - (void)loadWaitingView; |
| 88 |
| 89 // Updates the property 'primaryMenuItem'. |
| 90 // Updates the UI to reflect the new state of 'primaryMenuItem'. |
| 91 - (void)updatePrimaryMenuItem:(BookmarkMenuItem*)menuItem; |
| 92 |
| 93 // The active collection view that corresponds to primaryMenuItem. |
| 94 - (UIView<BookmarkHomePrimaryView>*)primaryView; |
| 95 @end |
| 96 |
| 97 #endif // IOS_CHROME_BROWSER_UI_BOOKMARKS_HOME_VIEW_CONTROLLER_H_ |
OLD | NEW |