Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: components/enhanced_bookmarks/enhanced_bookmark_utils.h

Issue 1067703004: Clean up enhanced_bookmark_utils.h/cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 namespace bookmarks { 12 namespace bookmarks {
13 class BookmarkModel; 13 class BookmarkModel;
14 class BookmarkNode; 14 class BookmarkNode;
15 } 15 }
16 16
17 namespace enhanced_bookmarks { 17 namespace enhanced_bookmarks {
18 18
19 static const char kLaunchLocationUMA[] = "Stars.LaunchLocation";
20
21 // Possible locations where a bookmark can be opened from. 19 // Possible locations where a bookmark can be opened from.
22 // Please sync with the corresponding histograms.xml. 20 // Please sync with the corresponding histograms.xml.
23 // 21 //
24 // A Java counterpart will be generated for this enum. 22 // A Java counterpart will be generated for this enum.
25 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.enhanced_bookmarks 23 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.enhanced_bookmarks
26 enum LaunchLocation { 24 enum LaunchLocation {
27 ALL_ITEMS = 0, 25 ALL_ITEMS = 0,
28 UNCATEGORIZED = 1, // Deprecated. 26 UNCATEGORIZED = 1, // Deprecated.
29 FOLDER = 2, 27 FOLDER = 2,
30 FILTER = 3, 28 FILTER = 3,
31 SEARCH = 4, 29 SEARCH = 4,
32 BOOKMARK_EDITOR = 5, 30 BOOKMARK_EDITOR = 5,
33 COUNT = 6, 31 COUNT = 6,
34 }; 32 };
35 33
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);
39
40 // Returns the permanent nodes whose url children are considered uncategorized 34 // Returns the permanent nodes whose url children are considered uncategorized
41 // and whose folder children should be shown in the bookmark menu. 35 // and whose folder children should be shown in the bookmark menu.
42 // |model| must be loaded. 36 // |model| must be loaded.
43 std::vector<const bookmarks::BookmarkNode*> PrimaryPermanentNodes( 37 std::vector<const bookmarks::BookmarkNode*> PrimaryPermanentNodes(
44 bookmarks::BookmarkModel* model); 38 bookmarks::BookmarkModel* model);
45 39
46 // Returns an unsorted vector of folders that are considered to be at the "root" 40 // 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 41 // level of the bookmark hierarchy. Functionally, this means all direct
48 // descendants of PrimaryPermanentNodes. 42 // descendants of PrimaryPermanentNodes.
49 std::vector<const bookmarks::BookmarkNode*> RootLevelFolders( 43 std::vector<const bookmarks::BookmarkNode*> RootLevelFolders(
50 bookmarks::BookmarkModel* model); 44 bookmarks::BookmarkModel* model);
51 45
52 // Returns whether |node| is a primary permanent node in the sense of 46 // Returns whether |node| is a primary permanent node in the sense of
53 // |PrimaryPermanentNodes|. 47 // |PrimaryPermanentNodes|.
54 bool IsPrimaryPermanentNode(const bookmarks::BookmarkNode* node, 48 bool IsPrimaryPermanentNode(const bookmarks::BookmarkNode* node,
55 bookmarks::BookmarkModel* model); 49 bookmarks::BookmarkModel* model);
56 50
57 // Returns the root level folder in which this node is directly, or indirectly 51 // Returns the root level folder in which this node is directly, or indirectly
58 // via subfolders, located. 52 // via subfolders, located.
59 const bookmarks::BookmarkNode* RootLevelFolderForNode( 53 const bookmarks::BookmarkNode* RootLevelFolderForNode(
60 const bookmarks::BookmarkNode* node, 54 const bookmarks::BookmarkNode* node,
61 bookmarks::BookmarkModel* model); 55 bookmarks::BookmarkModel* model);
62 56
63 } // namespace enhanced_bookmarks 57 } // namespace enhanced_bookmarks
64 58
65 #endif // COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_UTILS_H_ 59 #endif // COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_UTILS_H_
66 60
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698