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

Side by Side Diff: ios/chrome/browser/ui/collection_view/collection_view_controller.mm

Issue 2761263003: Allow CollectionViewModel/Controller queries without SectionIdentifier (Closed)
Patch Set: Add reconfigure to the VC Created 3 years, 8 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/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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 - (void)reconfigureCellsForItems:(NSArray*)items 64 - (void)reconfigureCellsForItems:(NSArray*)items
65 inSectionWithIdentifier:(NSInteger)sectionIdentifier { 65 inSectionWithIdentifier:(NSInteger)sectionIdentifier {
66 for (CollectionViewItem* item in items) { 66 for (CollectionViewItem* item in items) {
67 NSIndexPath* indexPath = 67 NSIndexPath* indexPath =
68 [self.collectionViewModel indexPathForItem:item 68 [self.collectionViewModel indexPathForItem:item
69 inSectionWithIdentifier:sectionIdentifier]; 69 inSectionWithIdentifier:sectionIdentifier];
70 [self reconfigureCellAtIndexPath:indexPath withItem:item]; 70 [self reconfigureCellAtIndexPath:indexPath withItem:item];
71 } 71 }
72 } 72 }
73 73
74 - (void)reconfigureCellsForItems:(NSArray*)items {
75 for (CollectionViewItem* item in items) {
76 NSIndexPath* indexPath = [self.collectionViewModel indexPathForItem:item];
77 [self reconfigureCellAtIndexPath:indexPath withItem:item];
78 }
79 }
80
74 - (void)reconfigureCellsAtIndexPaths:(NSArray*)indexPaths { 81 - (void)reconfigureCellsAtIndexPaths:(NSArray*)indexPaths {
75 for (NSIndexPath* indexPath in indexPaths) { 82 for (NSIndexPath* indexPath in indexPaths) {
76 CollectionViewItem* item = 83 CollectionViewItem* item =
77 [self.collectionViewModel itemAtIndexPath:indexPath]; 84 [self.collectionViewModel itemAtIndexPath:indexPath];
78 [self reconfigureCellAtIndexPath:indexPath withItem:item]; 85 [self reconfigureCellAtIndexPath:indexPath withItem:item];
79 } 86 }
80 } 87 }
81 88
82 #pragma mark MDCCollectionViewEditingDelegate 89 #pragma mark MDCCollectionViewEditingDelegate
83 90
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 base::mac::ObjCCastStrict<MDCCollectionViewCell>( 278 base::mac::ObjCCastStrict<MDCCollectionViewCell>(
272 [self.collectionView cellForItemAtIndexPath:indexPath]); 279 [self.collectionView cellForItemAtIndexPath:indexPath]);
273 280
274 // |cell| may be nil if the row is not currently on screen. 281 // |cell| may be nil if the row is not currently on screen.
275 if (cell) { 282 if (cell) {
276 [item configureCell:cell]; 283 [item configureCell:cell];
277 } 284 }
278 } 285 }
279 286
280 @end 287 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698