OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_BOOKMARKS_BOOKMARK_COLLECTION_VIEW_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_COLLECTION_VIEW_H_ |
6 #define IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_COLLECTION_VIEW_H_ | 6 #define IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_COLLECTION_VIEW_H_ |
7 | 7 |
8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #import "ios/chrome/browser/ui/bookmarks/bookmark_collection_cells.h" | 13 #import "ios/chrome/browser/ui/bookmarks/bookmark_collection_cells.h" |
14 #import "ios/chrome/browser/ui/bookmarks/bookmark_home_primary_view.h" | 14 #import "ios/chrome/browser/ui/bookmarks/bookmark_home_primary_view.h" |
15 #include "ios/chrome/browser/ui/bookmarks/bookmark_model_bridge_observer.h" | 15 #include "ios/chrome/browser/ui/bookmarks/bookmark_model_bridge_observer.h" |
16 #import "ios/chrome/browser/ui/bookmarks/bookmark_utils_ios.h" | 16 #import "ios/chrome/browser/ui/bookmarks/bookmark_utils_ios.h" |
17 | 17 |
18 @class BookmarkCollectionView; | 18 @class BookmarkCollectionView; |
19 class GURL; | 19 class GURL; |
20 @protocol UrlLoader; | 20 @protocol UrlLoader; |
21 | 21 |
22 namespace bookmarks { | 22 namespace bookmarks { |
23 class BookmarkNode; | 23 class BookmarkNode; |
24 } // namespace bookmarks | 24 } // namespace bookmarks |
| 25 namespace user_prefs { |
| 26 class PrefRegistrySyncable; |
| 27 } // namespace user_prefs |
25 | 28 |
26 @protocol BookmarkCollectionViewDelegate<NSObject> | 29 @protocol BookmarkCollectionViewDelegate<NSObject> |
27 | 30 |
28 // This method tells the delegate to add the node and cell | 31 // This method tells the delegate to add the node and cell |
29 // to the list of those being edited. | 32 // to the list of those being edited. |
30 - (void)bookmarkCollectionView:(BookmarkCollectionView*)view | 33 - (void)bookmarkCollectionView:(BookmarkCollectionView*)view |
31 cell:(UICollectionViewCell*)cell | 34 cell:(UICollectionViewCell*)cell |
32 addNodeForEditing:(const bookmarks::BookmarkNode*)node; | 35 addNodeForEditing:(const bookmarks::BookmarkNode*)node; |
33 | 36 |
34 // This method tells the delegate to remove the node and cell from the list of | 37 // This method tells the delegate to remove the node and cell from the list of |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // * |applyContentPosition:|: Given a content position from portrait | 84 // * |applyContentPosition:|: Given a content position from portrait |
82 // orientation, change the content offset of the collection view to match | 85 // orientation, change the content offset of the collection view to match |
83 // that position. | 86 // that position. |
84 // * |changeOrientation:|: Calls |updateCollectionView|. | 87 // * |changeOrientation:|: Calls |updateCollectionView|. |
85 // * |setScrollsToTop:|: Applies |scrollsToTop| to the collection view. | 88 // * |setScrollsToTop:|: Applies |scrollsToTop| to the collection view. |
86 // * |setEditing:animated:|: This method updates the editing property, but has | 89 // * |setEditing:animated:|: This method updates the editing property, but has |
87 // no other effect. Subclasses must provide the actual functionality. | 90 // no other effect. Subclasses must provide the actual functionality. |
88 @interface BookmarkCollectionView | 91 @interface BookmarkCollectionView |
89 : UIView<BookmarkHomePrimaryView, BookmarkModelBridgeObserver> | 92 : UIView<BookmarkHomePrimaryView, BookmarkModelBridgeObserver> |
90 | 93 |
| 94 // Registers the feature preferences. |
| 95 + (void)registerBrowserStatePrefs:(user_prefs::PrefRegistrySyncable*)registry; |
| 96 |
91 // Designated initializer. | 97 // Designated initializer. |
92 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState | 98 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState |
93 frame:(CGRect)frame; | 99 frame:(CGRect)frame; |
94 | 100 |
95 // Callback whenever the collection view is scrolled. | 101 // Callback whenever the collection view is scrolled. |
96 - (void)collectionViewScrolled; | 102 - (void)collectionViewScrolled; |
97 | 103 |
98 // Refreshes the entire view to reflect |folder|. | 104 // Refreshes the entire view to reflect |folder|. |
99 - (void)resetFolder:(const bookmarks::BookmarkNode*)folder; | 105 - (void)resetFolder:(const bookmarks::BookmarkNode*)folder; |
100 | 106 |
101 // Called when something outside the view causes the promo state to change. | 107 // Called when something outside the view causes the promo state to change. |
102 - (void)promoStateChangedAnimated:(BOOL)animate; | 108 - (void)promoStateChangedAnimated:(BOOL)animate; |
103 | 109 |
104 @property(nonatomic, assign, readonly) bookmarks::BookmarkModel* bookmarkModel; | 110 @property(nonatomic, assign, readonly) bookmarks::BookmarkModel* bookmarkModel; |
105 @property(nonatomic, weak, readonly) id<UrlLoader> loader; | 111 @property(nonatomic, weak, readonly) id<UrlLoader> loader; |
106 @property(nonatomic, assign, readonly) ios::ChromeBrowserState* browserState; | 112 @property(nonatomic, assign, readonly) ios::ChromeBrowserState* browserState; |
107 @property(nonatomic, weak) id<BookmarkCollectionViewDelegate> delegate; | 113 @property(nonatomic, weak) id<BookmarkCollectionViewDelegate> delegate; |
108 @property(nonatomic, assign, readonly) const bookmarks::BookmarkNode* folder; | 114 @property(nonatomic, assign, readonly) const bookmarks::BookmarkNode* folder; |
109 | 115 |
| 116 // Called when the bookmark view becomes visible. |
| 117 - (void)wasShown; |
| 118 |
| 119 // Called when the bookmark view becomes hidden. |
| 120 - (void)wasHidden; |
| 121 |
110 #pragma mark - Editing | 122 #pragma mark - Editing |
111 | 123 |
112 @property(nonatomic, assign, readonly) BOOL editing; | 124 @property(nonatomic, assign, readonly) BOOL editing; |
113 | 125 |
114 #pragma mark - Promo Cell | 126 #pragma mark - Promo Cell |
115 | 127 |
116 // Return true if the section at the given index is a promo section. | 128 // Return true if the section at the given index is a promo section. |
117 - (BOOL)isPromoSection:(NSInteger)section; | 129 - (BOOL)isPromoSection:(NSInteger)section; |
118 - (BOOL)shouldShowPromoCell; | 130 - (BOOL)shouldShowPromoCell; |
119 - (BOOL)isPromoActive; | 131 - (BOOL)isPromoActive; |
120 | 132 |
121 @end | 133 @end |
122 | 134 |
123 #endif // IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_COLLECTION_VIEW_H_ | 135 #endif // IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_COLLECTION_VIEW_H_ |
OLD | NEW |