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

Side by Side Diff: ios/chrome/browser/ui/bookmarks/bookmark_menu_item.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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_MENU_ITEM_H_
6 #define IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_MENU_ITEM_H_
7
8 #import <UIKit/UIKit.h>
9
10 namespace bookmarks {
11 class BookmarkNode;
12
13 // The types get cached, which means that their values must not change.
14 //
15 // This enum values are store on disk (see BookmarkPositionCache class)
16 // and must not be changed. New values must be added at the end, and if
17 // a value is removed it should not be reused.
18 typedef enum {
19 // Corresponds with the "all items" view.
20 MenuItemAll = 0,
21 // A very thin divider.
22 MenuItemDivider = 1,
23 // A BookmarkNode* that is a folder.
24 MenuItemFolder = 2,
25 // Section header.
26 MenuItemSectionHeader = 4,
27 MenuItemLast = MenuItemSectionHeader
28 } MenuItemType;
29
30 BOOL NumberIsValidMenuItemType(int number);
31 } // namespace bookmarks
32
33 // This model object represents a single row in the bookmark menu.
34 // This model should only be used from the main thread.
35 @interface BookmarkMenuItem : NSObject
36
37 // Returns the title to show in the menu.
38 - (NSString*)titleForMenu;
39 // Returns the title to show in the navigation bar.
40 - (NSString*)titleForNavigationBar;
41 // Returns the value to use as accessibility identifier.
42 - (NSString*)accessibilityIdentifier;
43 // Returns the image to show in the menu.
44 - (UIImage*)imagePrimary:(BOOL)primary;
45 // Returns the height of the corresponding row in the menu.
46 - (CGFloat)height;
47 // Whether the row can be selected.
48 - (BOOL)canBeSelected;
49 // Whether the view controller associated with this menu item supports editing.
50 - (BOOL)supportsEditing;
51 // Returns the menuitem located at the root ancestor of this item.
52 - (BookmarkMenuItem*)parentItem;
53
54 + (BookmarkMenuItem*)allMenuItem;
55 + (BookmarkMenuItem*)dividerMenuItem;
56 + (BookmarkMenuItem*)folderMenuItemForNode:(const bookmarks::BookmarkNode*)node
57 rootAncestor:
58 (const bookmarks::BookmarkNode*)ancestor;
59 + (BookmarkMenuItem*)sectionMenuItemWithTitle:(NSString*)title;
60
61 // |folder| is only valid if |type| == MenuItemFolder or MenuItemManaged.
62 @property(nonatomic, assign, readonly) const bookmarks::BookmarkNode* folder;
63 @property(nonatomic, assign, readonly)
64 const bookmarks::BookmarkNode* rootAncestor;
65 @property(nonatomic, assign, readonly) bookmarks::MenuItemType type;
66 // |sectionTitle| is only valid if |type| == MenuItemSectionHeader.
67 @property(nonatomic, copy, readonly) NSString* sectionTitle;
68
69 @end
70
71 #endif // IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_MENU_ITEM_H_
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/bookmarks/bookmark_menu_cell.mm ('k') | ios/chrome/browser/ui/bookmarks/bookmark_menu_item.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698