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

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

Issue 2865183003: Use the same design for all suggestions (Closed)
Patch Set: Address comments 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 side-by-side diff with in-line comments
Download patch
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..a27b4823e0c099beddb087acb192eb620a4ac9af 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 has an image associated.
+@property(nonatomic, assign) BOOL hasImage;
+// 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_

Powered by Google App Engine
This is Rietveld 408576698