| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/suggestions/suggestions_stack_item.h" | 5 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_stack_ite
m.h" |
| 6 | 6 |
| 7 #import "ios/chrome/browser/ui/suggestions/suggestions_stack_item_actions.h" | 7 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_stack_ite
m_actions.h" |
| 8 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 8 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| 9 | 9 |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) | 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 11 #error "This file requires ARC support." | 11 #error "This file requires ARC support." |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 const CGFloat kStackSpacing = 8; | 15 const CGFloat kStackSpacing = 8; |
| 16 } | 16 } |
| 17 | 17 |
| 18 @implementation SuggestionsStackItem { | 18 @implementation ContentSuggestionsStackItem { |
| 19 NSString* _title; | 19 NSString* _title; |
| 20 NSString* _subtitle; | 20 NSString* _subtitle; |
| 21 } | 21 } |
| 22 | 22 |
| 23 - (instancetype)initWithType:(NSInteger)type | 23 - (instancetype)initWithType:(NSInteger)type |
| 24 title:(NSString*)title | 24 title:(NSString*)title |
| 25 subtitle:(NSString*)subtitle { | 25 subtitle:(NSString*)subtitle { |
| 26 self = [super initWithType:type]; | 26 self = [super initWithType:type]; |
| 27 if (self) { | 27 if (self) { |
| 28 self.cellClass = [SuggestionsStackCell class]; | 28 self.cellClass = [ContentSuggestionsStackCell class]; |
| 29 _title = [title copy]; | 29 _title = [title copy]; |
| 30 _subtitle = [subtitle copy]; | 30 _subtitle = [subtitle copy]; |
| 31 } | 31 } |
| 32 return self; | 32 return self; |
| 33 } | 33 } |
| 34 | 34 |
| 35 #pragma mark - CollectionViewItem | 35 #pragma mark - CollectionViewItem |
| 36 | 36 |
| 37 - (void)configureCell:(SuggestionsStackCell*)cell { | 37 - (void)configureCell:(ContentSuggestionsStackCell*)cell { |
| 38 [super configureCell:cell]; | 38 [super configureCell:cell]; |
| 39 [cell.titleButton setTitle:_title forState:UIControlStateNormal]; | 39 [cell.titleButton setTitle:_title forState:UIControlStateNormal]; |
| 40 cell.detailTextLabel.text = _subtitle; | 40 cell.detailTextLabel.text = _subtitle; |
| 41 } | 41 } |
| 42 | 42 |
| 43 @end | 43 @end |
| 44 | 44 |
| 45 @implementation SuggestionsStackCell | 45 @implementation ContentSuggestionsStackCell |
| 46 | 46 |
| 47 @synthesize titleButton = _titleButton; | 47 @synthesize titleButton = _titleButton; |
| 48 @synthesize detailTextLabel = _detailTextLabel; | 48 @synthesize detailTextLabel = _detailTextLabel; |
| 49 | 49 |
| 50 - (instancetype)initWithFrame:(CGRect)frame { | 50 - (instancetype)initWithFrame:(CGRect)frame { |
| 51 self = [super initWithFrame:frame]; | 51 self = [super initWithFrame:frame]; |
| 52 if (self) { | 52 if (self) { |
| 53 self.backgroundColor = [UIColor clearColor]; | 53 self.backgroundColor = [UIColor clearColor]; |
| 54 self.contentView.backgroundColor = [UIColor clearColor]; | 54 self.contentView.backgroundColor = [UIColor clearColor]; |
| 55 self.backgroundView.backgroundColor = [UIColor clearColor]; | 55 self.backgroundView.backgroundColor = [UIColor clearColor]; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 @"oneSpace" : @(kStackSpacing * 1), | 134 @"oneSpace" : @(kStackSpacing * 1), |
| 135 @"twoSpace" : @(kStackSpacing * 2), | 135 @"twoSpace" : @(kStackSpacing * 2), |
| 136 @"threeSpace" : @(kStackSpacing * 3), | 136 @"threeSpace" : @(kStackSpacing * 3), |
| 137 @"fourSpace" : @(kStackSpacing * 4) | 137 @"fourSpace" : @(kStackSpacing * 4) |
| 138 }); | 138 }); |
| 139 } | 139 } |
| 140 return self; | 140 return self; |
| 141 } | 141 } |
| 142 | 142 |
| 143 @end | 143 @end |
| OLD | NEW |