Roll WebGL conformance tests.
[chromium-blink-merge.git] / components / enhanced_bookmarks / enhanced_bookmark_utils.h
blob8cc5996c0c8b4e5834af0f0104ec730b50cefd0a
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.
5 #ifndef COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_UTILS_H_
6 #define COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_UTILS_H_
8 #include <set>
9 #include <string>
10 #include <vector>
12 class BookmarkModel;
13 class BookmarkNode;
15 namespace enhanced_bookmarks {
17 // Returns an ordered vector of bookmarks that are urls that match |query|.
18 // |query| must be UTF8 encoded.
19 std::vector<const BookmarkNode*> FindBookmarksWithQuery(
20 BookmarkModel* bookmark_model,
21 const std::string& query);
23 // The vector is sorted in place.
24 // All of the bookmarks in |nodes| must be urls.
25 void SortBookmarksByName(std::vector<const BookmarkNode*>& nodes);
27 // Returns the permanent nodes whose url children are considered uncategorized
28 // and whose folder children should be shown in the bookmark menu.
29 // |model| must be loaded.
30 std::vector<const BookmarkNode*> PrimaryPermanentNodes(BookmarkModel* model);
32 // Returns an unsorted vector of folders that are considered to be at the "root"
33 // level of the bookmark hierarchy. Functionally, this means all direct
34 // descendants of PrimaryPermanentNodes, and possibly a node for the bookmarks
35 // bar.
36 std::vector<const BookmarkNode*> RootLevelFolders(BookmarkModel* model);
38 // Returns whether |node| is a primary permanent node in the sense of
39 // |PrimaryPermanentNodes|.
40 bool IsPrimaryPermanentNode(const BookmarkNode* node, BookmarkModel* model);
42 // Returns the root level folder in which this node is directly, or indirectly
43 // via subfolders, located.
44 const BookmarkNode* RootLevelFolderForNode(const BookmarkNode* node,
45 BookmarkModel* model);
47 } // namespace enhanced_bookmarks
49 #endif // COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_UTILS_H_