| 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 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 7 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| 8 | 8 |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) | 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 10 #error "This file requires ARC support." | 10 #error "This file requires ARC support." |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 @end | 23 @end |
| 24 | 24 |
| 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 suggestionID = _suggestionID; |
| 33 | 34 |
| 34 - (instancetype)initWithType:(NSInteger)type | 35 - (instancetype)initWithType:(NSInteger)type |
| 35 title:(NSString*)title | 36 title:(NSString*)title |
| 36 subtitle:(NSString*)subtitle | 37 subtitle:(NSString*)subtitle |
| 37 image:(UIImage*)image | 38 image:(UIImage*)image |
| 38 url:(const GURL&)url { | 39 url:(const GURL&)url { |
| 39 self = [super initWithType:type]; | 40 self = [super initWithType:type]; |
| 40 if (self) { | 41 if (self) { |
| 41 self.cellClass = [ContentSuggestionsArticleCell class]; | 42 self.cellClass = [ContentSuggestionsArticleCell class]; |
| 42 _title = [title copy]; | 43 _title = [title copy]; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // changes, for instance on screen rotation. | 121 // changes, for instance on screen rotation. |
| 121 CGFloat parentWidth = CGRectGetWidth(self.contentView.bounds); | 122 CGFloat parentWidth = CGRectGetWidth(self.contentView.bounds); |
| 122 self.subtitleLabel.preferredMaxLayoutWidth = parentWidth - kImageSize - 3 * 8; | 123 self.subtitleLabel.preferredMaxLayoutWidth = parentWidth - kImageSize - 3 * 8; |
| 123 | 124 |
| 124 // Re-layout with the new preferred width to allow the label to adjust its | 125 // Re-layout with the new preferred width to allow the label to adjust its |
| 125 // height. | 126 // height. |
| 126 [super layoutSubviews]; | 127 [super layoutSubviews]; |
| 127 } | 128 } |
| 128 | 129 |
| 129 @end | 130 @end |
| OLD | NEW |