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

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

Issue 2888403002: Limit the number of Most Visited lines to two (Closed)
Patch Set: Address comments Created 3 years, 7 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
« no previous file with comments | « ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 self.styler.cellStyle = MDCCollectionViewCellStyleCard; 117 self.styler.cellStyle = MDCCollectionViewCellStyleCard;
118 118
119 UILongPressGestureRecognizer* longPressRecognizer = 119 UILongPressGestureRecognizer* longPressRecognizer =
120 [[UILongPressGestureRecognizer alloc] 120 [[UILongPressGestureRecognizer alloc]
121 initWithTarget:self 121 initWithTarget:self
122 action:@selector(handleLongPress:)]; 122 action:@selector(handleLongPress:)];
123 longPressRecognizer.numberOfTouchesRequired = 1; 123 longPressRecognizer.numberOfTouchesRequired = 1;
124 [self.collectionView addGestureRecognizer:longPressRecognizer]; 124 [self.collectionView addGestureRecognizer:longPressRecognizer];
125 } 125 }
126 126
127 - (void)viewWillTransitionToSize:(CGSize)size
128 withTransitionCoordinator:
129 (id<UIViewControllerTransitionCoordinator>)coordinator {
130 [self.collectionUpdater updateMostVisitedForSize:size];
131 }
132
127 #pragma mark - UICollectionViewDelegate 133 #pragma mark - UICollectionViewDelegate
128 134
129 - (void)collectionView:(UICollectionView*)collectionView 135 - (void)collectionView:(UICollectionView*)collectionView
130 didSelectItemAtIndexPath:(NSIndexPath*)indexPath { 136 didSelectItemAtIndexPath:(NSIndexPath*)indexPath {
131 [super collectionView:collectionView didSelectItemAtIndexPath:indexPath]; 137 [super collectionView:collectionView didSelectItemAtIndexPath:indexPath];
132 138
133 CollectionViewItem* item = 139 CollectionViewItem* item =
134 [self.collectionViewModel itemAtIndexPath:indexPath]; 140 [self.collectionViewModel itemAtIndexPath:indexPath];
135 switch ([self.collectionUpdater contentSuggestionTypeForItem:item]) { 141 switch ([self.collectionUpdater contentSuggestionTypeForItem:item]) {
136 case ContentSuggestionTypeReadingList: 142 case ContentSuggestionTypeReadingList:
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 - (void)addEmptySectionPlaceholderIfNeeded:(NSInteger)section { 265 - (void)addEmptySectionPlaceholderIfNeeded:(NSInteger)section {
260 if ([self.collectionViewModel numberOfItemsInSection:section] > 0) 266 if ([self.collectionViewModel numberOfItemsInSection:section] > 0)
261 return; 267 return;
262 268
263 NSIndexPath* emptyItem = 269 NSIndexPath* emptyItem =
264 [self.collectionUpdater addEmptyItemForSection:section]; 270 [self.collectionUpdater addEmptyItemForSection:section];
265 [self.collectionView insertItemsAtIndexPaths:@[ emptyItem ]]; 271 [self.collectionView insertItemsAtIndexPaths:@[ emptyItem ]];
266 } 272 }
267 273
268 @end 274 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698