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

Unified Diff: ios/chrome/browser/ui/collection_view/collection_view_controller.h

Issue 2588713002: Upstream Chrome on iOS source code [4/11]. (Closed)
Patch Set: Created 4 years 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/collection_view/collection_view_controller.h
diff --git a/ios/chrome/browser/ui/collection_view/collection_view_controller.h b/ios/chrome/browser/ui/collection_view/collection_view_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..cd8d08c6c8c5cca4b2dc3461809e6d4271b295bb
--- /dev/null
+++ b/ios/chrome/browser/ui/collection_view/collection_view_controller.h
@@ -0,0 +1,92 @@
+// Copyright 2016 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_COLLECTION_VIEW_COLLECTION_VIEW_CONTROLLER_H_
+#define IOS_CHROME_BROWSER_UI_COLLECTION_VIEW_COLLECTION_VIEW_CONTROLLER_H_
+
+#import "ios/chrome/browser/ui/material_components/app_bar_presenting.h"
+#import "ios/third_party/material_components_ios/src/components/Collections/src/MaterialCollections.h"
+
+@class CollectionViewModel;
+
+typedef NS_ENUM(NSInteger, CollectionViewControllerStyle) {
+ // A simple collection view controller.
+ CollectionViewControllerStyleDefault,
+ // A collection view controller with an app bar.
+ CollectionViewControllerStyleAppBar,
+};
+
+// Chrome-specific Material Design collection view controller. With
+// CollectionViewControllerStyleAppBar, it features an app bar in the card
+// style.
+@interface CollectionViewController
+ : MDCCollectionViewController<AppBarPresenting>
+
+// The model of this controller.
+@property(nonatomic, readonly) CollectionViewModel* collectionViewModel;
+
+// Initializer with the desired style.
+- (instancetype)initWithStyle:(CollectionViewControllerStyle)style
+ NS_DESIGNATED_INITIALIZER;
+- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout*)layout
+ NS_UNAVAILABLE;
+- (instancetype)initWithNibName:(NSString*)nibNameOrNil
+ bundle:(NSBundle*)nibBundleOrNil NS_UNAVAILABLE;
+- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE;
+- (instancetype)init NS_UNAVAILABLE;
+
+// Initializes the collection view model. Must be called by subclasses if they
+// override this method in order to get a clean collectionViewModel.
+- (void)loadModel NS_REQUIRES_SUPER;
+
+// Reconfigures the cells corresponding to the given |items| by calling
+// |configureCell:| on each cell.
+- (void)reconfigureCellsForItems:(NSArray*)items
+ inSectionWithIdentifier:(NSInteger)sectionIdentifier;
+
+#pragma mark MDCCollectionViewEditingDelegate
+
+// Updates the model with changes to the collection view items. Must be called
+// by subclasses if they override this method in order to maintain this
+// functionality.
+- (void)collectionView:(UICollectionView*)collectionView
+ willDeleteItemsAtIndexPaths:(NSArray*)indexPaths NS_REQUIRES_SUPER;
+
+// Updates the model with changes to the collection view item. Must be called
+// by subclasses if they override this method in order to maintain this
+// functionality.
+- (void)collectionView:(UICollectionView*)collectionView
+ willMoveItemAtIndexPath:(NSIndexPath*)indexPath
+ toIndexPath:(NSIndexPath*)newIndexPath NS_REQUIRES_SUPER;
+
+#pragma mark UIScrollViewDelegate
+
+// Updates the MDCFlexibleHeader with changes to the collection view scroll
+// state. Must be called by subclasses if they override this method in order to
+// maintain this functionality.
+- (void)scrollViewDidScroll:(UIScrollView*)scrollView NS_REQUIRES_SUPER;
+
+// Updates the MDCFlexibleHeader with changes to the collection view scroll
+// state. Must be called by subclasses if they override this method in order to
+// maintain this functionality.
+- (void)scrollViewDidEndDragging:(UIScrollView*)scrollView
+ willDecelerate:(BOOL)decelerate NS_REQUIRES_SUPER;
+
+// Updates the MDCFlexibleHeader with changes to the collection view scroll
+// state. Must be called by subclasses if they override this method in order to
+// maintain this functionality.
+- (void)scrollViewDidEndDecelerating:(UIScrollView*)scrollView
+ NS_REQUIRES_SUPER;
+
+// Updates the MDCFlexibleHeader with changes to the collection view scroll
+// state. Must be called by subclasses if they override this method in order to
+// maintain this functionality.
+- (void)scrollViewWillEndDragging:(UIScrollView*)scrollView
+ withVelocity:(CGPoint)velocity
+ targetContentOffset:(inout CGPoint*)targetContentOffset
+ NS_REQUIRES_SUPER;
+
+@end
+
+#endif // IOS_CHROME_BROWSER_UI_COLLECTION_VIEW_COLLECTION_VIEW_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698