| OLD | NEW |
| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 if ([self.collectionUpdater isMostVisitedSection:section]) { | 184 if ([self.collectionUpdater isMostVisitedSection:section]) { |
| 185 return content_suggestions::spacingBetweenTiles(); | 185 return content_suggestions::spacingBetweenTiles(); |
| 186 } | 186 } |
| 187 return [super collectionView:collectionView | 187 return [super collectionView:collectionView |
| 188 layout:collectionViewLayout | 188 layout:collectionViewLayout |
| 189 minimumLineSpacingForSectionAtIndex:section]; | 189 minimumLineSpacingForSectionAtIndex:section]; |
| 190 } | 190 } |
| 191 | 191 |
| 192 #pragma mark - MDCCollectionViewStylingDelegate | 192 #pragma mark - MDCCollectionViewStylingDelegate |
| 193 | 193 |
| 194 // TODO(crbug.com/724493): Use collectionView:hidesInkViewAtIndexPath: when it |
| 195 // is fixed. For now hidding the ink prevent cell interaction. |
| 196 - (UIColor*)collectionView:(UICollectionView*)collectionView |
| 197 inkColorAtIndexPath:(NSIndexPath*)indexPath { |
| 198 if ([self.collectionUpdater |
| 199 shouldUseCustomStyleForSection:indexPath.section]) { |
| 200 return [UIColor clearColor]; |
| 201 } |
| 202 return nil; |
| 203 } |
| 204 |
| 194 - (UIColor*)collectionView:(nonnull UICollectionView*)collectionView | 205 - (UIColor*)collectionView:(nonnull UICollectionView*)collectionView |
| 195 cellBackgroundColorAtIndexPath:(nonnull NSIndexPath*)indexPath { | 206 cellBackgroundColorAtIndexPath:(nonnull NSIndexPath*)indexPath { |
| 196 if ([self.collectionUpdater | 207 if ([self.collectionUpdater |
| 197 shouldUseCustomStyleForSection:indexPath.section]) { | 208 shouldUseCustomStyleForSection:indexPath.section]) { |
| 198 return [UIColor clearColor]; | 209 return [UIColor clearColor]; |
| 199 } | 210 } |
| 200 return [UIColor whiteColor]; | 211 return [UIColor whiteColor]; |
| 201 } | 212 } |
| 202 | 213 |
| 203 - (BOOL)collectionView:(nonnull UICollectionView*)collectionView | 214 - (BOOL)collectionView:(nonnull UICollectionView*)collectionView |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 - (void)addEmptySectionPlaceholderIfNeeded:(NSInteger)section { | 273 - (void)addEmptySectionPlaceholderIfNeeded:(NSInteger)section { |
| 263 if ([self.collectionViewModel numberOfItemsInSection:section] > 0) | 274 if ([self.collectionViewModel numberOfItemsInSection:section] > 0) |
| 264 return; | 275 return; |
| 265 | 276 |
| 266 NSIndexPath* emptyItem = | 277 NSIndexPath* emptyItem = |
| 267 [self.collectionUpdater addEmptyItemForSection:section]; | 278 [self.collectionUpdater addEmptyItemForSection:section]; |
| 268 [self.collectionView insertItemsAtIndexPaths:@[ emptyItem ]]; | 279 [self.collectionView insertItemsAtIndexPaths:@[ emptyItem ]]; |
| 269 } | 280 } |
| 270 | 281 |
| 271 @end | 282 @end |
| OLD | NEW |