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

Unified Diff: ios/chrome/browser/ui/bookmarks/bookmark_collection_cells.h

Issue 2586993002: Upstream Chrome on iOS source code [3/11]. (Closed)
Patch Set: Created 4 years 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/bookmarks/bookmark_collection_cells.h
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_collection_cells.h b/ios/chrome/browser/ui/bookmarks/bookmark_collection_cells.h
new file mode 100644
index 0000000000000000000000000000000000000000..4652ca0a67f9e93e7f6d4f7106264b32f0b948b0
--- /dev/null
+++ b/ios/chrome/browser/ui/bookmarks/bookmark_collection_cells.h
@@ -0,0 +1,97 @@
+// Copyright 2014 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_BOOKMARKS_BOOKMARK_COLLECTION_CELLS_H_
+#define IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_COLLECTION_CELLS_H_
+
+#import <UIKit/UIKit.h>
+
+namespace bookmark_cell {
+// The types get cached, which means that their values must not change.
+typedef enum {
+ ButtonNone = 0, // No button.
+ ButtonMenu, // 3-vertical-dots button.
+} ButtonType;
+
+} // bookmark_cell
+
+// Views that expect to display an image associated with a bookmark must
+// implement this protocol.
+// Since the image fetching API is asynchronous and uncancellable, views must
+// store some metadata associated with the image to ensure irrelevant callbacks
+// are discarded.
+@protocol BookmarkImageableView
+@property(nonatomic, assign) BOOL shouldAnimateImageChanges;
+// Sets the image on the view, animating the change if
+// shouldAnimateImageChanges is YES. Hides the overlay placeholder text.
+- (void)setImage:(UIImage*)image;
+// Sets the placeholder text that is displayed over the image view. Hides the
+// image.
+- (void)setPlaceholderText:(NSString*)text
+ textColor:(UIColor*)textColor
+ backgroundColor:(UIColor*)backgroundColor;
+@end
+
+#pragma mark - Base Classes For Both Device Types
+
+// Abstract base class for cells in the bookmark collection view.
+// Most controllers that use this cell have an "edit" mode that allows users to
+// select multiple bookmarks. When a cell is selected, a translucent overlay
+// is layered on top to change the look of the view.
+// Subclasses should insert new views below the "highlightCover" property.
+// There is also an image and an optional menu button.
+@interface BookmarkCell : UICollectionViewCell<BookmarkImageableView>
+
+@property(nonatomic, retain, readonly) UILabel* titleLabel;
+
++ (NSString*)reuseIdentifier;
+
+// Sets the target/selector for the top-right corner button.
+// |action| must take exactly 2 arguments.
+// The first object passed to |action| will be of type BookmarkItemCell.
+// The second will be the view that was tapped on to trigger the action.
+- (void)setButtonTarget:(id)target action:(SEL)action;
+
+// Changes the appearance of the button.
+- (void)showButtonOfType:(bookmark_cell::ButtonType)buttonType
+ animated:(BOOL)animated;
+
+// The cell has been selected by the user in editing mode.
+- (void)setSelectedForEditing:(BOOL)selected animated:(BOOL)animated;
+
+// Sets the title.
+- (void)updateWithTitle:(NSString*)title;
+
+@end
+
+#pragma mark - Specialized Cells
+
+// Specialized cell for bookmark urls.
+// It is intended to show the title, domain, and parent folder of the bookmark.
+@interface BookmarkItemCell : BookmarkCell
+// Returns the icon size that is preferred for this cell. Icons are square, and
+// the returned value is the side of the square in points.
++ (CGFloat)preferredImageSize;
+@end
+
+// Specialized cell for bookmark folders. Uses a default folder image.
+@interface BookmarkFolderCell : BookmarkCell
+@end
+
+#pragma mark - Header Views
+
+// Standard header view for a section.
+@interface BookmarkHeaderView : UICollectionReusableView
++ (NSString*)reuseIdentifier;
++ (CGFloat)handsetHeight;
+- (void)setTitle:(NSString*)title;
+@end
+
+// Blank white header with thin separator line in the bottom.
+@interface BookmarkHeaderSeparatorView : UICollectionReusableView
++ (NSString*)reuseIdentifier;
++ (CGFloat)preferredHeight;
+@end
+
+#endif // IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_COLLECTION_CELLS_H_

Powered by Google App Engine
This is Rietveld 408576698