OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" |
| 6 |
| 7 #import "base/logging.h" |
| 8 #import "ios/third_party/material_components_ios/src/components/CollectionCells/
src/MaterialCollectionCells.h" |
| 9 |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 11 #error "This file requires ARC support." |
| 12 #endif |
| 13 |
| 14 @implementation CollectionViewItem |
| 15 |
| 16 @synthesize type = _type; |
| 17 @synthesize cellClass = _cellClass; |
| 18 @synthesize accessibilityIdentifier = _accessibilityIdentifier; |
| 19 |
| 20 - (instancetype)initWithType:(NSInteger)type { |
| 21 if ((self = [super init])) { |
| 22 _type = type; |
| 23 _cellClass = [MDCCollectionViewCell class]; |
| 24 } |
| 25 return self; |
| 26 } |
| 27 |
| 28 - (instancetype)init { |
| 29 NOTREACHED(); |
| 30 return nil; |
| 31 } |
| 32 |
| 33 - (void)setCellClass:(Class)cellClass { |
| 34 DCHECK([cellClass isSubclassOfClass:[MDCCollectionViewCell class]]); |
| 35 _cellClass = cellClass; |
| 36 } |
| 37 |
| 38 - (void)configureCell:(MDCCollectionViewCell*)cell { |
| 39 DCHECK([cell class] == self.cellClass); |
| 40 cell.accessibilityTraits = self.accessibilityTraits; |
| 41 cell.accessibilityIdentifier = self.accessibilityIdentifier; |
| 42 } |
| 43 |
| 44 @end |
OLD | NEW |