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 COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_UTILS_H_ | 5 #ifndef COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_UTILS_H_ |
6 #define COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_UTILS_H_ | 6 #define COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_UTILS_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 class BookmarkNode; | |
13 | |
14 namespace bookmarks { | 12 namespace bookmarks { |
15 class BookmarkModel; | 13 class BookmarkModel; |
| 14 class BookmarkNode; |
16 } | 15 } |
17 | 16 |
18 namespace enhanced_bookmarks { | 17 namespace enhanced_bookmarks { |
19 | 18 |
20 // The vector is sorted in place. | 19 // The vector is sorted in place. |
21 // All of the bookmarks in |nodes| must be urls. | 20 // All of the bookmarks in |nodes| must be urls. |
22 void SortBookmarksByName(std::vector<const BookmarkNode*>& nodes); | 21 void SortBookmarksByName(std::vector<const bookmarks::BookmarkNode*>& nodes); |
23 | 22 |
24 // Returns the permanent nodes whose url children are considered uncategorized | 23 // Returns the permanent nodes whose url children are considered uncategorized |
25 // and whose folder children should be shown in the bookmark menu. | 24 // and whose folder children should be shown in the bookmark menu. |
26 // |model| must be loaded. | 25 // |model| must be loaded. |
27 std::vector<const BookmarkNode*> PrimaryPermanentNodes( | 26 std::vector<const bookmarks::BookmarkNode*> PrimaryPermanentNodes( |
28 bookmarks::BookmarkModel* model); | 27 bookmarks::BookmarkModel* model); |
29 | 28 |
30 // Returns an unsorted vector of folders that are considered to be at the "root" | 29 // Returns an unsorted vector of folders that are considered to be at the "root" |
31 // level of the bookmark hierarchy. Functionally, this means all direct | 30 // level of the bookmark hierarchy. Functionally, this means all direct |
32 // descendants of PrimaryPermanentNodes. | 31 // descendants of PrimaryPermanentNodes. |
33 std::vector<const BookmarkNode*> RootLevelFolders( | 32 std::vector<const bookmarks::BookmarkNode*> RootLevelFolders( |
34 bookmarks::BookmarkModel* model); | 33 bookmarks::BookmarkModel* model); |
35 | 34 |
36 // Returns whether |node| is a primary permanent node in the sense of | 35 // Returns whether |node| is a primary permanent node in the sense of |
37 // |PrimaryPermanentNodes|. | 36 // |PrimaryPermanentNodes|. |
38 bool IsPrimaryPermanentNode(const BookmarkNode* node, | 37 bool IsPrimaryPermanentNode(const bookmarks::BookmarkNode* node, |
39 bookmarks::BookmarkModel* model); | 38 bookmarks::BookmarkModel* model); |
40 | 39 |
41 // Returns the root level folder in which this node is directly, or indirectly | 40 // Returns the root level folder in which this node is directly, or indirectly |
42 // via subfolders, located. | 41 // via subfolders, located. |
43 const BookmarkNode* RootLevelFolderForNode(const BookmarkNode* node, | 42 const bookmarks::BookmarkNode* RootLevelFolderForNode( |
44 bookmarks::BookmarkModel* model); | 43 const bookmarks::BookmarkNode* node, |
| 44 bookmarks::BookmarkModel* model); |
45 | 45 |
46 } // namespace enhanced_bookmarks | 46 } // namespace enhanced_bookmarks |
47 | 47 |
48 #endif // COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_UTILS_H_ | 48 #endif // COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_UTILS_H_ |
| 49 |
OLD | NEW |