Chromium Code Reviews| Index: ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_item.h |
| diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_article_item.h b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_item.h |
| similarity index 59% |
| rename from ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_article_item.h |
| rename to ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_item.h |
| index 3335a7a5e616ca531c95c975fb0f135033607165..1f086eb11633c9bd998a297dbf58f96848b832fc 100644 |
| --- a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_article_item.h |
| +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_item.h |
| @@ -2,8 +2,8 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_ARTICLE_ITEM_H_ |
| -#define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_ARTICLE_ITEM_H_ |
| +#ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_ITEM_H_ |
| +#define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_ITEM_H_ |
| #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" |
| #import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier.h" |
| @@ -13,21 +13,21 @@ namespace base { |
| class Time; |
| } |
| -@class ContentSuggestionsArticleItem; |
| +@class ContentSuggestionsItem; |
| @class FaviconAttributes; |
| @class FaviconViewNew; |
| class GURL; |
| -// Delegate for a ContentSuggestionsArticleItem. |
| -@protocol ContentSuggestionsArticleItemDelegate |
| +// Delegate for a ContentSuggestionsItem. |
| +@protocol ContentSuggestionsItemDelegate |
| // Loads the image associated with this item. |
| -- (void)loadImageForArticleItem:(ContentSuggestionsArticleItem*)articleItem; |
| +- (void)loadImageForSuggestionItem:(ContentSuggestionsItem*)suggestionItem; |
| @end |
| // Item for an article in the suggestions. |
| -@interface ContentSuggestionsArticleItem |
| +@interface ContentSuggestionsItem |
| : CollectionViewItem<ContentSuggestionIdentification> |
| // Initialize an article with a |title|, a |subtitle|, an |image| and the |url| |
| @@ -35,36 +35,48 @@ class GURL; |
| - (instancetype)initWithType:(NSInteger)type |
| title:(NSString*)title |
| subtitle:(NSString*)subtitle |
| - delegate:(id<ContentSuggestionsArticleItemDelegate>)delegate |
| + delegate:(id<ContentSuggestionsItemDelegate>)delegate |
| url:(const GURL&)url NS_DESIGNATED_INITIALIZER; |
| - (instancetype)initWithType:(NSInteger)type NS_UNAVAILABLE; |
| @property(nonatomic, copy, readonly) NSString* title; |
| @property(nonatomic, strong) UIImage* image; |
| -@property(nonatomic, readonly, assign) GURL articleURL; |
| +@property(nonatomic, readonly, assign) GURL URL; |
| @property(nonatomic, copy) NSString* publisher; |
| @property(nonatomic, assign) base::Time publishDate; |
| -@property(nonatomic, weak) id<ContentSuggestionsArticleItemDelegate> delegate; |
| +@property(nonatomic, weak) id<ContentSuggestionsItemDelegate> delegate; |
| // Attributes for favicon. |
| @property(nonatomic, strong) FaviconAttributes* attributes; |
| +// Whether the suggestion might have an image. |
| +@property(nonatomic, assign) BOOL hasImage; |
|
jif
2017/05/10 09:06:19
mayHaveImage?
mightHaveImage?
canHaveImage?
gambard
2017/05/10 09:23:27
I have updated the comment.
|
| +// Whether the suggestion is available offline. If YES, an icon is displayed. |
| +@property(nonatomic, assign) BOOL availableOffline; |
| @end |
| // Corresponding cell for an article in the suggestions. |
| -@interface ContentSuggestionsArticleCell : MDCCollectionViewCell |
| +@interface ContentSuggestionsCell : MDCCollectionViewCell |
| @property(nonatomic, readonly, strong) UILabel* titleLabel; |
| -@property(nonatomic, readonly, strong) UILabel* subtitleLabel; |
| // View for displaying the favicon. |
| @property(nonatomic, readonly, strong) FaviconViewNew* faviconView; |
| +// Whether the image should be displayed. |
| +@property(nonatomic, assign) BOOL displayImage; |
| // Sets an |image| to illustrate the article, replacing the "no image" icon. |
| - (void)setContentImage:(UIImage*)image; |
| -// Sets the publisher |name| and |date|. |
| -- (void)setPublisherName:(NSString*)publisherName date:(base::Time)publishDate; |
| +// Sets the publisher |name| and |date| and add an icon to signal the offline |
| +// availability if |availableOffline| is YES. |
| +- (void)setAdditionalInformationWithPublisherName:(NSString*)publisherName |
| + date:(base::Time)publishDate |
| + offlineAvailability:(BOOL)availableOffline; |
| + |
| +// Setst the subtitle text. If |subtitle| is nil, the space taken by the |
| +// subtitle is removed. |
| +- (void)setSubtitleText:(NSString*)subtitle; |
| @end |
| -#endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_ARTICLE_ITEM_H_ |
| +#endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_ITEM_H_ |