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

Unified Diff: ios/chrome/browser/ui/content_suggestions/content_suggestions_section_information.h

Issue 2689953003: Add Category wrapper for ContentSuggestions on iOS (Closed)
Patch Set: Fix title copu 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/content_suggestions/content_suggestions_section_information.h
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_section_information.h b/ios/chrome/browser/ui/content_suggestions/content_suggestions_section_information.h
new file mode 100644
index 0000000000000000000000000000000000000000..92545c166d28a3203e860b8cff8e9d7457c6f312
--- /dev/null
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_section_information.h
@@ -0,0 +1,54 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// 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_CONTENT_SUGGESTIONS_SECTION_INFORMATION_H_
+#define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_SECTION_INFORMATION_H_
+
+#import <Foundation/Foundation.h>
+
+#import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
+
+// Layout for the section and its items.
+typedef NS_ENUM(NSInteger, ContentSuggestionsSectionLayout) {
+ // Follows the card layout.
+ ContentSuggestionsSectionLayoutCard,
+ // No specific layout.
+ ContentSuggestionsSectionLayoutCustom,
+};
+
+// This enum is used for ordering the sections and as ID for the section. Make
+// all sections in the same collection have different ID.
+// When adding a new kind of suggestions, add a new corresponding section. The
+// ordering is not persisted between launch, reordering is possible.
+typedef NS_ENUM(NSInteger, ContentSuggestionsSectionID) {
+ ContentSuggestionsSectionBookmarks = 0,
+ ContentSuggestionsSectionArticles = 1,
+
+ // Do not use this. It will trigger a DCHECK.
+ // Do not add value after this one.
+ ContentSuggestionsSectionCount
+};
+
+// Contains the information needed to display the section.
+@interface ContentSuggestionsSectionInformation : NSObject
+
+- (instancetype)initWithID:(ContentSuggestionsSectionID)ID
+ emptyCell:(CollectionViewItem*)emptyCell
+ layout:(ContentSuggestionsSectionLayout)layout
+ title:(NSString*)title NS_DESIGNATED_INITIALIZER;
+- (instancetype)init NS_UNAVAILABLE;
+
+// Item to display when the section is empty. If nil the section should not be
+// displayed when empty.
+@property(nonatomic, strong, readonly) CollectionViewItem* emptyCell;
+// Layout to display the content of the section.
+@property(nonatomic, assign, readonly) ContentSuggestionsSectionLayout layout;
+// ID of the section. Used for ordering.
+@property(nonatomic, assign, readonly) ContentSuggestionsSectionID ID;
+// Title for the section.
+@property(nonatomic, copy, readonly) NSString* title;
+
+@end
+
+#endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_SECTION_INFORMATION_H_

Powered by Google App Engine
This is Rietveld 408576698