| 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/collection_view/collection_view_controller.h" | 5 #import "ios/chrome/browser/ui/collection_view/collection_view_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 } | 54 } |
| 55 | 55 |
| 56 - (UIViewController*)childViewControllerForStatusBarStyle { | 56 - (UIViewController*)childViewControllerForStatusBarStyle { |
| 57 return self.appBar.headerViewController; | 57 return self.appBar.headerViewController; |
| 58 } | 58 } |
| 59 | 59 |
| 60 - (void)loadModel { | 60 - (void)loadModel { |
| 61 _collectionViewModel = [[CollectionViewModel alloc] init]; | 61 _collectionViewModel = [[CollectionViewModel alloc] init]; |
| 62 } | 62 } |
| 63 | 63 |
| 64 - (void)reconfigureCellsForItems:(NSArray*)items | 64 - (void)reconfigureCellsForItems:(NSArray*)items { |
| 65 inSectionWithIdentifier:(NSInteger)sectionIdentifier { | |
| 66 for (CollectionViewItem* item in items) { | 65 for (CollectionViewItem* item in items) { |
| 67 NSIndexPath* indexPath = | 66 NSIndexPath* indexPath = [self.collectionViewModel indexPathForItem:item]; |
| 68 [self.collectionViewModel indexPathForItem:item | |
| 69 inSectionWithIdentifier:sectionIdentifier]; | |
| 70 [self reconfigureCellAtIndexPath:indexPath withItem:item]; | 67 [self reconfigureCellAtIndexPath:indexPath withItem:item]; |
| 71 } | 68 } |
| 72 } | 69 } |
| 73 | 70 |
| 74 - (void)reconfigureCellsAtIndexPaths:(NSArray*)indexPaths { | 71 - (void)reconfigureCellsAtIndexPaths:(NSArray*)indexPaths { |
| 75 for (NSIndexPath* indexPath in indexPaths) { | 72 for (NSIndexPath* indexPath in indexPaths) { |
| 76 CollectionViewItem* item = | 73 CollectionViewItem* item = |
| 77 [self.collectionViewModel itemAtIndexPath:indexPath]; | 74 [self.collectionViewModel itemAtIndexPath:indexPath]; |
| 78 [self reconfigureCellAtIndexPath:indexPath withItem:item]; | 75 [self reconfigureCellAtIndexPath:indexPath withItem:item]; |
| 79 } | 76 } |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 base::mac::ObjCCastStrict<MDCCollectionViewCell>( | 274 base::mac::ObjCCastStrict<MDCCollectionViewCell>( |
| 278 [self.collectionView cellForItemAtIndexPath:indexPath]); | 275 [self.collectionView cellForItemAtIndexPath:indexPath]); |
| 279 | 276 |
| 280 // |cell| may be nil if the row is not currently on screen. | 277 // |cell| may be nil if the row is not currently on screen. |
| 281 if (cell) { | 278 if (cell) { |
| 282 [item configureCell:cell]; | 279 [item configureCell:cell]; |
| 283 } | 280 } |
| 284 } | 281 } |
| 285 | 282 |
| 286 @end | 283 @end |
| OLD | NEW |