| 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/content_suggestions/content_suggestions_article_i
tem.h" | 5 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_article_i
tem.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.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) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #pragma mark - ContentSuggestionsArticleItem | 25 #pragma mark - ContentSuggestionsArticleItem |
| 26 | 26 |
| 27 @implementation ContentSuggestionsArticleItem | 27 @implementation ContentSuggestionsArticleItem |
| 28 | 28 |
| 29 @synthesize title = _title; | 29 @synthesize title = _title; |
| 30 @synthesize subtitle = _subtitle; | 30 @synthesize subtitle = _subtitle; |
| 31 @synthesize image = _image; | 31 @synthesize image = _image; |
| 32 @synthesize articleURL = _articleURL; | 32 @synthesize articleURL = _articleURL; |
| 33 @synthesize publisher = _publisher; | 33 @synthesize publisher = _publisher; |
| 34 @synthesize publishDate = _publishDate; | 34 @synthesize publishDate = _publishDate; |
| 35 @synthesize suggestionIdentifier = _suggestionIdentifier; |
| 35 | 36 |
| 36 - (instancetype)initWithType:(NSInteger)type | 37 - (instancetype)initWithType:(NSInteger)type |
| 37 title:(NSString*)title | 38 title:(NSString*)title |
| 38 subtitle:(NSString*)subtitle | 39 subtitle:(NSString*)subtitle |
| 39 image:(UIImage*)image | 40 image:(UIImage*)image |
| 40 url:(const GURL&)url { | 41 url:(const GURL&)url { |
| 41 self = [super initWithType:type]; | 42 self = [super initWithType:type]; |
| 42 if (self) { | 43 if (self) { |
| 43 self.cellClass = [ContentSuggestionsArticleCell class]; | 44 self.cellClass = [ContentSuggestionsArticleCell class]; |
| 44 _title = [title copy]; | 45 _title = [title copy]; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 CGFloat parentWidth = CGRectGetWidth(self.contentView.bounds); | 154 CGFloat parentWidth = CGRectGetWidth(self.contentView.bounds); |
| 154 self.subtitleLabel.preferredMaxLayoutWidth = | 155 self.subtitleLabel.preferredMaxLayoutWidth = |
| 155 parentWidth - self.imageView.bounds.size.width - 3 * 8; | 156 parentWidth - self.imageView.bounds.size.width - 3 * 8; |
| 156 | 157 |
| 157 // Re-layout with the new preferred width to allow the label to adjust its | 158 // Re-layout with the new preferred width to allow the label to adjust its |
| 158 // height. | 159 // height. |
| 159 [super layoutSubviews]; | 160 [super layoutSubviews]; |
| 160 } | 161 } |
| 161 | 162 |
| 162 @end | 163 @end |
| OLD | NEW |