ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / components / enhanced_bookmarks / enhanced_bookmark_utils.h
blob97a9b278cc20b07fb276d5581c31c549723d8826
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 static const char kLaunchLocationUMA[] = "Stars.LaunchLocation";
21 // Possible locations where a bookmark can be opened from.
22 // Please sync with the corresponding histograms.xml.
24 // A Java counterpart will be generated for this enum.
25 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.enhanced_bookmarks
26 enum LaunchLocation {
27 ALL_ITEMS = 0,
28 UNCATEGORIZED = 1, // Deprecated.
29 FOLDER = 2,
30 FILTER = 3,
31 SEARCH = 4,
32 BOOKMARK_EDITOR = 5,
33 COUNT = 6,
36 // The vector is sorted in place.
37 // All of the bookmarks in |nodes| must be urls.
38 void SortBookmarksByName(std::vector<const bookmarks::BookmarkNode*>& nodes);
40 // Returns the permanent nodes whose url children are considered uncategorized
41 // and whose folder children should be shown in the bookmark menu.
42 // |model| must be loaded.
43 std::vector<const bookmarks::BookmarkNode*> PrimaryPermanentNodes(
44 bookmarks::BookmarkModel* model);
46 // Returns an unsorted vector of folders that are considered to be at the "root"
47 // level of the bookmark hierarchy. Functionally, this means all direct
48 // descendants of PrimaryPermanentNodes.
49 std::vector<const bookmarks::BookmarkNode*> RootLevelFolders(
50 bookmarks::BookmarkModel* model);
52 // Returns whether |node| is a primary permanent node in the sense of
53 // |PrimaryPermanentNodes|.
54 bool IsPrimaryPermanentNode(const bookmarks::BookmarkNode* node,
55 bookmarks::BookmarkModel* model);
57 // Returns the root level folder in which this node is directly, or indirectly
58 // via subfolders, located.
59 const bookmarks::BookmarkNode* RootLevelFolderForNode(
60 const bookmarks::BookmarkNode* node,
61 bookmarks::BookmarkModel* model);
63 } // namespace enhanced_bookmarks
65 #endif // COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_UTILS_H_