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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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_COLLECTION_VIEW_COLLECTION_VIEW_CONTROLLER_H_
6 #define IOS_CHROME_BROWSER_UI_COLLECTION_VIEW_COLLECTION_VIEW_CONTROLLER_H_
7
8 #import "ios/chrome/browser/ui/material_components/app_bar_presenting.h"
9 #import "ios/third_party/material_components_ios/src/components/Collections/src/ MaterialCollections.h"
10
11 @class CollectionViewModel;
12
13 typedef NS_ENUM(NSInteger, CollectionViewControllerStyle) {
14 // A simple collection view controller.
15 CollectionViewControllerStyleDefault,
16 // A collection view controller with an app bar.
17 CollectionViewControllerStyleAppBar,
18 };
19
20 // Chrome-specific Material Design collection view controller. With
21 // CollectionViewControllerStyleAppBar, it features an app bar in the card
22 // style.
23 @interface CollectionViewController
24 : MDCCollectionViewController<AppBarPresenting>
25
26 // The model of this controller.
27 @property(nonatomic, readonly) CollectionViewModel* collectionViewModel;
28
29 // Initializer with the desired style.
30 - (instancetype)initWithStyle:(CollectionViewControllerStyle)style
31 NS_DESIGNATED_INITIALIZER;
32 - (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout*)layout
33 NS_UNAVAILABLE;
34 - (instancetype)initWithNibName:(NSString*)nibNameOrNil
35 bundle:(NSBundle*)nibBundleOrNil NS_UNAVAILABLE;
36 - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE;
37 - (instancetype)init NS_UNAVAILABLE;
38
39 // Initializes the collection view model. Must be called by subclasses if they
40 // override this method in order to get a clean collectionViewModel.
41 - (void)loadModel NS_REQUIRES_SUPER;
42
43 // Reconfigures the cells corresponding to the given |items| by calling
44 // |configureCell:| on each cell.
45 - (void)reconfigureCellsForItems:(NSArray*)items
46 inSectionWithIdentifier:(NSInteger)sectionIdentifier;
47
48 #pragma mark MDCCollectionViewEditingDelegate
49
50 // Updates the model with changes to the collection view items. Must be called
51 // by subclasses if they override this method in order to maintain this
52 // functionality.
53 - (void)collectionView:(UICollectionView*)collectionView
54 willDeleteItemsAtIndexPaths:(NSArray*)indexPaths NS_REQUIRES_SUPER;
55
56 // Updates the model with changes to the collection view item. Must be called
57 // by subclasses if they override this method in order to maintain this
58 // functionality.
59 - (void)collectionView:(UICollectionView*)collectionView
60 willMoveItemAtIndexPath:(NSIndexPath*)indexPath
61 toIndexPath:(NSIndexPath*)newIndexPath NS_REQUIRES_SUPER;
62
63 #pragma mark UIScrollViewDelegate
64
65 // Updates the MDCFlexibleHeader with changes to the collection view scroll
66 // state. Must be called by subclasses if they override this method in order to
67 // maintain this functionality.
68 - (void)scrollViewDidScroll:(UIScrollView*)scrollView NS_REQUIRES_SUPER;
69
70 // Updates the MDCFlexibleHeader with changes to the collection view scroll
71 // state. Must be called by subclasses if they override this method in order to
72 // maintain this functionality.
73 - (void)scrollViewDidEndDragging:(UIScrollView*)scrollView
74 willDecelerate:(BOOL)decelerate NS_REQUIRES_SUPER;
75
76 // Updates the MDCFlexibleHeader with changes to the collection view scroll
77 // state. Must be called by subclasses if they override this method in order to
78 // maintain this functionality.
79 - (void)scrollViewDidEndDecelerating:(UIScrollView*)scrollView
80 NS_REQUIRES_SUPER;
81
82 // Updates the MDCFlexibleHeader with changes to the collection view scroll
83 // state. Must be called by subclasses if they override this method in order to
84 // maintain this functionality.
85 - (void)scrollViewWillEndDragging:(UIScrollView*)scrollView
86 withVelocity:(CGPoint)velocity
87 targetContentOffset:(inout CGPoint*)targetContentOffset
88 NS_REQUIRES_SUPER;
89
90 @end
91
92 #endif // IOS_CHROME_BROWSER_UI_COLLECTION_VIEW_COLLECTION_VIEW_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698