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

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

Issue 2701833003: Fetch images for ContentSuggestions (Closed)
Patch Set: Reviewable 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_id.h" 9 #import "ios/chrome/browser/ui/content_suggestions/content_suggestion_id.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 @class ContentSuggestionsArticleItem;
14
15 // Delegate for a ContentSuggestionsArticleItem.
16 @protocol ContentSuggestionsArticleItemDelegate
17
18 // Loads the image associated with this item.
19 - (void)loadImageForArticleItem:(ContentSuggestionsArticleItem*)articleItem;
20
21 @end
22
13 // Item for an article in the suggestions. 23 // Item for an article in the suggestions.
14 @interface ContentSuggestionsArticleItem 24 @interface ContentSuggestionsArticleItem
15 : CollectionViewItem<ContentSuggestionIDHolder> 25 : CollectionViewItem<ContentSuggestionIDHolder>
16 26
17 // Initialize an article with a |title|, a |subtitle|, an |image| and the |url| 27 // Initialize an article with a |title|, a |subtitle|, an |image| and the |url|
18 // to the full article. |type| is the type of the item. 28 // to the full article. |type| is the type of the item.
19 - (instancetype)initWithType:(NSInteger)type 29 - (instancetype)initWithType:(NSInteger)type
20 title:(NSString*)title 30 title:(NSString*)title
21 subtitle:(NSString*)subtitle 31 subtitle:(NSString*)subtitle
22 image:(UIImage*)image 32 delegate:(id<ContentSuggestionsArticleItemDelegate>)delegate
23 url:(const GURL&)url NS_DESIGNATED_INITIALIZER; 33 url:(const GURL&)url NS_DESIGNATED_INITIALIZER;
24 34
25 - (instancetype)initWithType:(NSInteger)type NS_UNAVAILABLE; 35 - (instancetype)initWithType:(NSInteger)type NS_UNAVAILABLE;
26 36
27 @property(nonatomic, copy, readonly) NSString* title; 37 @property(nonatomic, copy, readonly) NSString* title;
28 @property(nonatomic, strong) UIImage* image; 38 @property(nonatomic, strong) UIImage* image;
29 @property(nonatomic, readonly, assign) GURL articleURL; 39 @property(nonatomic, readonly, assign) GURL articleURL;
40 // Whether the image is being fetched.
41 @property(nonatomic, assign) BOOL imageBeingFetched;
30 42
31 @end 43 @end
32 44
33 // Corresponding cell for an article in the suggestions. 45 // Corresponding cell for an article in the suggestions.
34 @interface ContentSuggestionsArticleCell : MDCCollectionViewCell 46 @interface ContentSuggestionsArticleCell : MDCCollectionViewCell
35 47
36 @property(nonatomic, readonly, strong) UILabel* titleLabel; 48 @property(nonatomic, readonly, strong) UILabel* titleLabel;
37 @property(nonatomic, readonly, strong) UILabel* subtitleLabel; 49 @property(nonatomic, readonly, strong) UILabel* subtitleLabel;
38 @property(nonatomic, readonly, strong) UIImageView* imageView; 50 @property(nonatomic, readonly, strong) UIImageView* imageView;
39 51
40 @end 52 @end
41 53
42 #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_ARTICLE _ITEM_H_ 54 #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_ARTICLE _ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698