| OLD | NEW | 
|---|
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_UTILS_IOS_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_UTILS_IOS_H_ | 
| 6 #define IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_UTILS_IOS_H_ | 6 #define IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_UTILS_IOS_H_ | 
| 7 | 7 | 
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> | 
|  | 9 | 
|  | 10 #include <memory> | 
| 9 #include <set> | 11 #include <set> | 
| 10 #include <vector> | 12 #include <vector> | 
| 11 | 13 | 
| 12 #include "base/memory/scoped_vector.h" |  | 
| 13 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" | 
| 14 #include "base/time/time.h" | 15 #include "base/time/time.h" | 
| 15 | 16 | 
| 16 @class BookmarkCell; | 17 @class BookmarkCell; | 
| 17 @class BookmarkMenuItem; | 18 @class BookmarkMenuItem; | 
| 18 @class BookmarkPositionCache; | 19 @class BookmarkPositionCache; | 
| 19 class GURL; | 20 class GURL; | 
| 20 | 21 | 
| 21 namespace bookmarks { | 22 namespace bookmarks { | 
| 22 class BookmarkModel; | 23 class BookmarkModel; | 
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 144   base::Time time; | 145   base::Time time; | 
| 145   // A string representation of |time|. | 146   // A string representation of |time|. | 
| 146   // e.g. (March 2014) or (4 March 2014). | 147   // e.g. (March 2014) or (4 March 2014). | 
| 147   std::string timeRepresentation; | 148   std::string timeRepresentation; | 
| 148 }; | 149 }; | 
| 149 | 150 | 
| 150 // Given the nodes in |vector|, segregates them by some time property into | 151 // Given the nodes in |vector|, segregates them by some time property into | 
| 151 // NodesSections. | 152 // NodesSections. | 
| 152 // Automatically clears, populates and sorts |nodesSectionVector|. | 153 // Automatically clears, populates and sorts |nodesSectionVector|. | 
| 153 // This method is not thread safe - it should only be called from the ui thread. | 154 // This method is not thread safe - it should only be called from the ui thread. | 
| 154 void segregateNodes(const NodeVector& vector, | 155 void segregateNodes( | 
| 155                     ScopedVector<NodesSection>& nodesSectionVector); | 156     const NodeVector& vector, | 
|  | 157     std::vector<std::unique_ptr<NodesSection>>& nodesSectionVector); | 
| 156 | 158 | 
| 157 #pragma mark - Useful bookmark manipulation. | 159 #pragma mark - Useful bookmark manipulation. | 
| 158 | 160 | 
| 159 // Sorts a vector full of folders by title. | 161 // Sorts a vector full of folders by title. | 
| 160 void SortFolders(NodeVector* vector); | 162 void SortFolders(NodeVector* vector); | 
| 161 | 163 | 
| 162 // Returns a vector of root level folders and all their folder descendants, | 164 // Returns a vector of root level folders and all their folder descendants, | 
| 163 // sorted depth-first, then alphabetically. The returned nodes are visible, and | 165 // sorted depth-first, then alphabetically. The returned nodes are visible, and | 
| 164 // are guaranteed to not be descendants of any nodes in |obstructions|. | 166 // are guaranteed to not be descendants of any nodes in |obstructions|. | 
| 165 NodeVector VisibleNonDescendantNodes(const NodeSet& obstructions, | 167 NodeVector VisibleNonDescendantNodes(const NodeSet& obstructions, | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 184 // |item| and |position| are out variables, only populated if the return is YES. | 186 // |item| and |position| are out variables, only populated if the return is YES. | 
| 185 BOOL GetPositionCache(bookmarks::BookmarkModel* model, | 187 BOOL GetPositionCache(bookmarks::BookmarkModel* model, | 
| 186                       BookmarkMenuItem** item, | 188                       BookmarkMenuItem** item, | 
| 187                       CGFloat* position); | 189                       CGFloat* position); | 
| 188 // Method exists for testing. | 190 // Method exists for testing. | 
| 189 void ClearPositionCache(); | 191 void ClearPositionCache(); | 
| 190 | 192 | 
| 191 }  // namespace bookmark_utils_ios | 193 }  // namespace bookmark_utils_ios | 
| 192 | 194 | 
| 193 #endif  // IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_UTILS_IOS_H_ | 195 #endif  // IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_UTILS_IOS_H_ | 
| OLD | NEW | 
|---|