Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1939)

Side by Side Diff: ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_item.h

Issue 2865183003: Use the same design for all suggestions (Closed)
Patch Set: Reviewable Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_ARTI CLE_ITEM_H_ 5 #ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_ITEM _H_
6 #define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_ARTI CLE_ITEM_H_ 6 #define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_ITEM _H_
7 7
8 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" 8 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
9 #import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion _identifier.h" 9 #import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion _identifier.h"
10 #import "ios/third_party/material_components_ios/src/components/CollectionCells/ src/MaterialCollectionCells.h" 10 #import "ios/third_party/material_components_ios/src/components/CollectionCells/ src/MaterialCollectionCells.h"
11 11
12 namespace base { 12 namespace base {
13 class Time; 13 class Time;
14 } 14 }
15 15
16 @class ContentSuggestionsArticleItem; 16 @class ContentSuggestionsItem;
17 @class FaviconAttributes; 17 @class FaviconAttributes;
18 @class FaviconViewNew; 18 @class FaviconViewNew;
19 class GURL; 19 class GURL;
20 20
21 // Delegate for a ContentSuggestionsArticleItem. 21 // Delegate for a ContentSuggestionsItem.
22 @protocol ContentSuggestionsArticleItemDelegate 22 @protocol ContentSuggestionsItemDelegate
23 23
24 // Loads the image associated with this item. 24 // Loads the image associated with this item.
25 - (void)loadImageForArticleItem:(ContentSuggestionsArticleItem*)articleItem; 25 - (void)loadImageForSuggestionItem:(ContentSuggestionsItem*)suggestionItem;
26 26
27 @end 27 @end
28 28
29 // Item for an article in the suggestions. 29 // Item for an article in the suggestions.
30 @interface ContentSuggestionsArticleItem 30 @interface ContentSuggestionsItem
31 : CollectionViewItem<ContentSuggestionIdentification> 31 : CollectionViewItem<ContentSuggestionIdentification>
32 32
33 // Initialize an article with a |title|, a |subtitle|, an |image| and the |url| 33 // Initialize an article with a |title|, a |subtitle|, an |image| and the |url|
34 // to the full article. |type| is the type of the item. 34 // to the full article. |type| is the type of the item.
35 - (instancetype)initWithType:(NSInteger)type 35 - (instancetype)initWithType:(NSInteger)type
36 title:(NSString*)title 36 title:(NSString*)title
37 subtitle:(NSString*)subtitle 37 subtitle:(NSString*)subtitle
38 delegate:(id<ContentSuggestionsArticleItemDelegate>)delegate 38 delegate:(id<ContentSuggestionsItemDelegate>)delegate
39 url:(const GURL&)url NS_DESIGNATED_INITIALIZER; 39 url:(const GURL&)url NS_DESIGNATED_INITIALIZER;
40 40
41 - (instancetype)initWithType:(NSInteger)type NS_UNAVAILABLE; 41 - (instancetype)initWithType:(NSInteger)type NS_UNAVAILABLE;
42 42
43 @property(nonatomic, copy, readonly) NSString* title; 43 @property(nonatomic, copy, readonly) NSString* title;
44 @property(nonatomic, strong) UIImage* image; 44 @property(nonatomic, strong) UIImage* image;
45 @property(nonatomic, readonly, assign) GURL articleURL; 45 @property(nonatomic, readonly, assign) GURL URL;
46 @property(nonatomic, copy) NSString* publisher; 46 @property(nonatomic, copy) NSString* publisher;
47 @property(nonatomic, assign) base::Time publishDate; 47 @property(nonatomic, assign) base::Time publishDate;
48 @property(nonatomic, weak) id<ContentSuggestionsArticleItemDelegate> delegate; 48 @property(nonatomic, weak) id<ContentSuggestionsItemDelegate> delegate;
49 // Attributes for favicon. 49 // Attributes for favicon.
50 @property(nonatomic, strong) FaviconAttributes* attributes; 50 @property(nonatomic, strong) FaviconAttributes* attributes;
51 // Whether the suggestion might have an image.
52 @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.
53 // Whether the suggestion is available offline. If YES, an icon is displayed.
54 @property(nonatomic, assign) BOOL availableOffline;
51 55
52 @end 56 @end
53 57
54 // Corresponding cell for an article in the suggestions. 58 // Corresponding cell for an article in the suggestions.
55 @interface ContentSuggestionsArticleCell : MDCCollectionViewCell 59 @interface ContentSuggestionsCell : MDCCollectionViewCell
56 60
57 @property(nonatomic, readonly, strong) UILabel* titleLabel; 61 @property(nonatomic, readonly, strong) UILabel* titleLabel;
58 @property(nonatomic, readonly, strong) UILabel* subtitleLabel;
59 // View for displaying the favicon. 62 // View for displaying the favicon.
60 @property(nonatomic, readonly, strong) FaviconViewNew* faviconView; 63 @property(nonatomic, readonly, strong) FaviconViewNew* faviconView;
64 // Whether the image should be displayed.
65 @property(nonatomic, assign) BOOL displayImage;
61 66
62 // Sets an |image| to illustrate the article, replacing the "no image" icon. 67 // Sets an |image| to illustrate the article, replacing the "no image" icon.
63 - (void)setContentImage:(UIImage*)image; 68 - (void)setContentImage:(UIImage*)image;
64 69
65 // Sets the publisher |name| and |date|. 70 // Sets the publisher |name| and |date| and add an icon to signal the offline
66 - (void)setPublisherName:(NSString*)publisherName date:(base::Time)publishDate; 71 // availability if |availableOffline| is YES.
72 - (void)setAdditionalInformationWithPublisherName:(NSString*)publisherName
73 date:(base::Time)publishDate
74 offlineAvailability:(BOOL)availableOffline;
75
76 // Setst the subtitle text. If |subtitle| is nil, the space taken by the
77 // subtitle is removed.
78 - (void)setSubtitleText:(NSString*)subtitle;
67 79
68 @end 80 @end
69 81
70 #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_A RTICLE_ITEM_H_ 82 #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_I TEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698