| 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 #ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_ITEM
_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_CELL
_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_ITEM
_H_ | 6 #define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_CELL
_H_ |
| 7 | 7 |
| 8 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" | |
| 9 #import "ios/chrome/browser/ui/content_suggestions/cells/suggested_content.h" | |
| 10 #import "ios/third_party/material_components_ios/src/components/CollectionCells/
src/MaterialCollectionCells.h" | 8 #import "ios/third_party/material_components_ios/src/components/CollectionCells/
src/MaterialCollectionCells.h" |
| 11 | 9 |
| 12 namespace base { | |
| 13 class Time; | |
| 14 } | |
| 15 | |
| 16 @class ContentSuggestionsItem; | |
| 17 @class FaviconAttributes; | |
| 18 @class FaviconViewNew; | 10 @class FaviconViewNew; |
| 19 class GURL; | |
| 20 | |
| 21 // Item for an article in the suggestions. | |
| 22 @interface ContentSuggestionsItem : CollectionViewItem<SuggestedContent> | |
| 23 | |
| 24 // Initialize an article with a |title|, a |subtitle|, an |image| and the |url| | |
| 25 // to the full article. |type| is the type of the item. | |
| 26 - (instancetype)initWithType:(NSInteger)type | |
| 27 title:(NSString*)title | |
| 28 subtitle:(NSString*)subtitle | |
| 29 url:(const GURL&)url NS_DESIGNATED_INITIALIZER; | |
| 30 | |
| 31 - (instancetype)initWithType:(NSInteger)type NS_UNAVAILABLE; | |
| 32 | |
| 33 @property(nonatomic, copy, readonly) NSString* title; | |
| 34 @property(nonatomic, readonly, assign) GURL URL; | |
| 35 @property(nonatomic, copy) NSString* publisher; | |
| 36 @property(nonatomic, assign) base::Time publishDate; | |
| 37 // Whether the suggestion has an image associated. | |
| 38 @property(nonatomic, assign) BOOL hasImage; | |
| 39 // Whether the suggestion is available offline. If YES, an icon is displayed. | |
| 40 @property(nonatomic, assign) BOOL availableOffline; | |
| 41 | |
| 42 @end | |
| 43 | 11 |
| 44 // Corresponding cell for an article in the suggestions. | 12 // Corresponding cell for an article in the suggestions. |
| 45 @interface ContentSuggestionsCell : MDCCollectionViewCell | 13 @interface ContentSuggestionsCell : MDCCollectionViewCell |
| 46 | 14 |
| 47 @property(nonatomic, readonly, strong) UILabel* titleLabel; | 15 @property(nonatomic, readonly, strong) UILabel* titleLabel; |
| 48 // View for displaying the favicon. | 16 // View for displaying the favicon. |
| 49 @property(nonatomic, readonly, strong) FaviconViewNew* faviconView; | 17 @property(nonatomic, readonly, strong) FaviconViewNew* faviconView; |
| 50 // Whether the image should be displayed. | 18 // Whether the image should be displayed. |
| 51 @property(nonatomic, assign) BOOL displayImage; | 19 @property(nonatomic, assign) BOOL displayImage; |
| 52 | 20 |
| 53 // Sets an |image| to illustrate the article, replacing the "no image" icon. | 21 // Sets an |image| to illustrate the article, replacing the "no image" icon. |
| 54 - (void)setContentImage:(UIImage*)image; | 22 - (void)setContentImage:(UIImage*)image; |
| 55 | 23 |
| 56 // Sets the publisher |name| and |date| and add an icon to signal the offline | 24 // Sets the publisher |name| and |date| and add an icon to signal the offline |
| 57 // availability if |availableOffline| is YES. | 25 // availability if |availableOffline| is YES. |
| 58 - (void)setAdditionalInformationWithPublisherName:(NSString*)publisherName | 26 - (void)setAdditionalInformationWithPublisherName:(NSString*)publisherName |
| 59 date:(base::Time)publishDate | 27 date:(NSDate*)publishDate |
| 60 offlineAvailability:(BOOL)availableOffline; | 28 offlineAvailability:(BOOL)availableOffline; |
| 61 | 29 |
| 62 // Setst the subtitle text. If |subtitle| is nil, the space taken by the | 30 // Setst the subtitle text. If |subtitle| is nil, the space taken by the |
| 63 // subtitle is removed. | 31 // subtitle is removed. |
| 64 - (void)setSubtitleText:(NSString*)subtitle; | 32 - (void)setSubtitleText:(NSString*)subtitle; |
| 65 | 33 |
| 66 @end | 34 @end |
| 67 | 35 |
| 68 #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_I
TEM_H_ | 36 #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_C
ELL_H_ |
| OLD | NEW |