Implement multiple alternative services per origin.
[chromium-blink-merge.git] / components / enhanced_bookmarks / enhanced_bookmark_utils.h
blobc66fa9adf8c07b69bc46c0f791ce27784559797b
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 namespace bookmarks {
13 class BookmarkModel;
14 class BookmarkNode;
17 namespace enhanced_bookmarks {
19 // Possible locations where a bookmark can be opened from.
20 // Please sync with the corresponding histograms.xml.
22 // A Java counterpart will be generated for this enum.
23 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.enhanced_bookmarks
24 enum LaunchLocation {
25 ALL_ITEMS = 0,
26 UNCATEGORIZED = 1, // Deprecated.
27 FOLDER = 2,
28 FILTER = 3,
29 SEARCH = 4,
30 BOOKMARK_EDITOR = 5,
31 COUNT = 6,
34 // Returns the permanent nodes whose url children are considered uncategorized
35 // and whose folder children should be shown in the bookmark menu.
36 // |model| must be loaded.
37 std::vector<const bookmarks::BookmarkNode*> PrimaryPermanentNodes(
38 bookmarks::BookmarkModel* model);
40 // Returns an unsorted vector of folders that are considered to be at the "root"
41 // level of the bookmark hierarchy. Functionally, this means all direct
42 // descendants of PrimaryPermanentNodes.
43 std::vector<const bookmarks::BookmarkNode*> RootLevelFolders(
44 bookmarks::BookmarkModel* model);
46 // Returns whether |node| is a primary permanent node in the sense of
47 // |PrimaryPermanentNodes|.
48 bool IsPrimaryPermanentNode(const bookmarks::BookmarkNode* node,
49 bookmarks::BookmarkModel* model);
51 // Returns the root level folder in which this node is directly, or indirectly
52 // via subfolders, located.
53 const bookmarks::BookmarkNode* RootLevelFolderForNode(
54 const bookmarks::BookmarkNode* node,
55 bookmarks::BookmarkModel* model);
57 } // namespace enhanced_bookmarks
59 #endif // COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_UTILS_H_