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

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

Issue 2972733002: Creates common super class for bookmark handset and tablet view controllers (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.h
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.h b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..9f29228a02ddfefe295804d979f301b75b795e62
--- /dev/null
+++ b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.h
@@ -0,0 +1,97 @@
+// Copyright 2017 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_HOME_VIEW_CONTROLLER_H_
+#define IOS_CHROME_BROWSER_UI_BOOKMARKS_HOME_VIEW_CONTROLLER_H_
+
+#import <UIKit/UIKit.h>
+
+#include <set>
+#include <vector>
+
+@protocol UrlLoader;
+@protocol BookmarkHomePrimaryView;
+
+namespace ios {
+class ChromeBrowserState;
+} // namespace ios
+
+namespace bookmarks {
+class BookmarkModel;
+} // namespace bookmarks
+
+@class BookmarkCollectionView;
+@class BookmarkPanelView;
+@class BookmarkMenuView;
+@class BookmarkHomeWaitingView;
+@class BookmarkNavigationBar;
+@class BookmarkMenuItem;
+
+// Class to navigate the bookmark hierarchy, needs subclassing for tablet /
+// handset case.
+@interface BookmarkHomeViewController : UIViewController
+
+- (instancetype)initWithNibName:(NSString*)nibNameOrNil
+ bundle:(NSBundle*)nibBundleOrNil NS_UNAVAILABLE;
+- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE;
+- (instancetype)init NS_UNAVAILABLE;
+- (instancetype)initWithLoader:(id<UrlLoader>)loader
+ browserState:(ios::ChromeBrowserState*)browserState
+ NS_DESIGNATED_INITIALIZER;
+
+// The bookmark model used.
+@property(nonatomic, assign, readonly) bookmarks::BookmarkModel* bookmarks;
+
+// The user's browser state model used.
+@property(nonatomic, assign, readonly) ios::ChromeBrowserState* browserState;
+
+// The main view showing all the bookmarks.
+@property(nonatomic, strong, readonly) BookmarkCollectionView* folderView;
+
+// Object to load URLs.
+@property(nonatomic, weak, readonly) id<UrlLoader> loader;
+
+// The menu with all the folders.
+@property(nonatomic, strong, readonly) BookmarkMenuView* menuView;
+
+// The navigation bar sits on top of the main content.
+@property(nonatomic, strong, readonly) BookmarkNavigationBar* navigationBar;
+
+// At any point in time, there is exactly one collection view whose view is part
+// of the view hierarchy. This property determines what data is visible in the
+// collection view.
+@property(nonatomic, strong, readonly) BookmarkMenuItem* primaryMenuItem;
+
+// This view holds a content view, and a menu view.
+@property(nonatomic, strong, readonly) BookmarkPanelView* panelView;
+
+// Either the menu or the primaryView can scrollToTop.
+@property(nonatomic, assign) BOOL scrollToTop;
+
+// This view is created and used if the model is not fully loaded yet by the
+// time this controller starts. Property is readwrite, so that subclasses can
+// set it to nil, once finished with it.
+@property(nonatomic, strong) BookmarkHomeWaitingView* waitForModelView;
+
+// This method should be called at most once in the life-cycle of the class.
+// It should be called at the soonest possible time after the view has been
+// loaded, and the bookmark model is loaded.
+- (void)loadBookmarkViews;
+
+// Returns the width of the menu.
+- (CGFloat)menuWidth;
+
+// This method is called if the view needs to be loaded and the model is not
+// ready yet.
+- (void)loadWaitingView;
+
+// Updates the property 'primaryMenuItem'.
+// Updates the UI to reflect the new state of 'primaryMenuItem'.
+- (void)updatePrimaryMenuItem:(BookmarkMenuItem*)menuItem;
+
+// The active collection view that corresponds to primaryMenuItem.
+- (UIView<BookmarkHomePrimaryView>*)primaryView;
+@end
+
+#endif // IOS_CHROME_BROWSER_UI_BOOKMARKS_HOME_VIEW_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698