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

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

Issue 2701833003: Fetch images for ContentSuggestions (Closed)
Patch Set: Address comments Created 3 years, 10 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_CONTENT_SUGGESTIONS_ARTICLE_IT EM_H_ 5 #ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_ARTICLE_IT EM_H_
6 #define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_ARTICLE_IT EM_H_ 6 #define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_ARTICLE_IT EM_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/content_suggestion_identifier .h" 9 #import "ios/chrome/browser/ui/content_suggestions/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 #include "url/gurl.h" 11 #include "url/gurl.h"
12 12
13 namespace base { 13 namespace base {
14 class Time; 14 class Time;
15 } 15 }
16 16
17 @class ContentSuggestionsArticleItem;
18
19 // Delegate for a ContentSuggestionsArticleItem.
20 @protocol ContentSuggestionsArticleItemDelegate
21
22 // Loads the image associated with this item.
23 - (void)loadImageForArticleItem:(ContentSuggestionsArticleItem*)articleItem;
24
25 @end
26
17 // Item for an article in the suggestions. 27 // Item for an article in the suggestions.
18 @interface ContentSuggestionsArticleItem 28 @interface ContentSuggestionsArticleItem
19 : CollectionViewItem<ContentSuggestionIdentification> 29 : CollectionViewItem<ContentSuggestionIdentification>
20 30
21 // Initialize an article with a |title|, a |subtitle|, an |image| and the |url| 31 // Initialize an article with a |title|, a |subtitle|, an |image| and the |url|
22 // to the full article. |type| is the type of the item. 32 // to the full article. |type| is the type of the item.
23 - (instancetype)initWithType:(NSInteger)type 33 - (instancetype)initWithType:(NSInteger)type
24 title:(NSString*)title 34 title:(NSString*)title
25 subtitle:(NSString*)subtitle 35 subtitle:(NSString*)subtitle
26 image:(UIImage*)image 36 delegate:(id<ContentSuggestionsArticleItemDelegate>)delegate
27 url:(const GURL&)url NS_DESIGNATED_INITIALIZER; 37 url:(const GURL&)url NS_DESIGNATED_INITIALIZER;
28 38
29 - (instancetype)initWithType:(NSInteger)type NS_UNAVAILABLE; 39 - (instancetype)initWithType:(NSInteger)type NS_UNAVAILABLE;
30 40
31 @property(nonatomic, copy, readonly) NSString* title; 41 @property(nonatomic, copy, readonly) NSString* title;
32 @property(nonatomic, strong) UIImage* image; 42 @property(nonatomic, strong) UIImage* image;
33 @property(nonatomic, readonly, assign) GURL articleURL; 43 @property(nonatomic, readonly, assign) GURL articleURL;
34 @property(nonatomic, copy) NSString* publisher; 44 @property(nonatomic, copy) NSString* publisher;
35 @property(nonatomic, assign) base::Time publishDate; 45 @property(nonatomic, assign) base::Time publishDate;
36 46
47 // Whether the image is being fetched. This property is set by the delegate.
48 @property(nonatomic, assign) BOOL imageBeingFetched;
49
37 @end 50 @end
38 51
39 // Corresponding cell for an article in the suggestions. 52 // Corresponding cell for an article in the suggestions.
40 @interface ContentSuggestionsArticleCell : MDCCollectionViewCell 53 @interface ContentSuggestionsArticleCell : MDCCollectionViewCell
41 54
42 @property(nonatomic, readonly, strong) UILabel* titleLabel; 55 @property(nonatomic, readonly, strong) UILabel* titleLabel;
43 @property(nonatomic, readonly, strong) UILabel* subtitleLabel; 56 @property(nonatomic, readonly, strong) UILabel* subtitleLabel;
44 @property(nonatomic, readonly, strong) UIImageView* imageView; 57 @property(nonatomic, readonly, strong) UIImageView* imageView;
45 58
46 - (void)setPublisherName:(NSString*)publisherName date:(base::Time)publishDate; 59 - (void)setPublisherName:(NSString*)publisherName date:(base::Time)publishDate;
47 60
48 @end 61 @end
49 62
50 #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_ARTICLE _ITEM_H_ 63 #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_ARTICLE _ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698