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

Side by Side Diff: ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm

Issue 2638413006: Add ContentSuggestionsMediator (Closed)
Patch Set: Format Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_cont roller.h" 5 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_cont roller.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom e.h" 8 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom e.h"
9 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" 9 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
10 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" 10 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
(...skipping 22 matching lines...) Expand all
33 // according to |expand|. 33 // according to |expand|.
34 - (void)expand:(BOOL)expand cell:(UICollectionViewCell*)cell; 34 - (void)expand:(BOOL)expand cell:(UICollectionViewCell*)cell;
35 35
36 @end 36 @end
37 37
38 @implementation ContentSuggestionsViewController 38 @implementation ContentSuggestionsViewController
39 39
40 @synthesize suggestionCommandHandler = _suggestionCommandHandler; 40 @synthesize suggestionCommandHandler = _suggestionCommandHandler;
41 @synthesize collectionUpdater = _collectionUpdater; 41 @synthesize collectionUpdater = _collectionUpdater;
42 42
43 - (instancetype)initWithStyle:(CollectionViewControllerStyle)style
44 dataSource:(id<ContentSuggestionsDataSource>)dataSource {
45 self = [super initWithStyle:style];
46 if (self) {
47 _collectionUpdater = [[ContentSuggestionsCollectionUpdater alloc]
48 initWithDataSource:dataSource];
49 }
50 return self;
51 }
52
43 #pragma mark - UIViewController 53 #pragma mark - UIViewController
44 54
45 - (void)viewDidLoad { 55 - (void)viewDidLoad {
46 [super viewDidLoad]; 56 [super viewDidLoad];
47 57
48 _collectionUpdater = [[ContentSuggestionsCollectionUpdater alloc] init];
49 _collectionUpdater.collectionViewController = self; 58 _collectionUpdater.collectionViewController = self;
50 59
51 self.collectionView.delegate = self; 60 self.collectionView.delegate = self;
52 self.styler.cellStyle = MDCCollectionViewCellStyleCard; 61 self.styler.cellStyle = MDCCollectionViewCellStyleCard;
53 } 62 }
54 63
55 #pragma mark - UICollectionViewDelegate 64 #pragma mark - UICollectionViewDelegate
56 65
57 - (void)collectionView:(UICollectionView*)collectionView 66 - (void)collectionView:(UICollectionView*)collectionView
58 didSelectItemAtIndexPath:(NSIndexPath*)indexPath { 67 didSelectItemAtIndexPath:(NSIndexPath*)indexPath {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 164
156 [UIView 165 [UIView
157 animateWithDuration:kAnimationDuration 166 animateWithDuration:kAnimationDuration
158 animations:^{ 167 animations:^{
159 [self.collectionView.collectionViewLayout invalidateLayout]; 168 [self.collectionView.collectionViewLayout invalidateLayout];
160 }]; 169 }];
161 } 170 }
162 } 171 }
163 172
164 @end 173 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698