Chromium Code Reviews| 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; | 12 class BookmarkNode; |
| 13 | 13 |
| 14 namespace bookmarks { | 14 namespace bookmarks { |
| 15 class BookmarkModel; | 15 class BookmarkModel; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace enhanced_bookmarks { | 18 namespace enhanced_bookmarks { |
| 19 | 19 |
| 20 static const char kLaunchLocationUMA[] = "Stars.LaunchLocation"; | |
| 21 | |
| 22 // Possible locations where a bookmark can be opened from. | |
| 23 // | |
| 24 // A Java counterpart will be generated for this enum. | |
| 25 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.enhancedbookmark | |
| 26 enum LaunchLocation { | |
| 27 ALL_ITEMS, | |
|
noyau (Ping after 24h)
2015/02/04 12:53:40
As those values have significance outside of the c
Kibeom Kim (inactive)
2015/02/04 17:57:32
Done.
| |
| 28 UNCATEGORIZED, // Deprecated. | |
| 29 FOLDER, | |
| 30 FILTER, | |
| 31 SEARCH, | |
| 32 BOOKMARK_EDITOR, | |
| 33 COUNT, | |
| 34 }; | |
|
noyau (Ping after 24h)
2015/02/04 12:53:40
Since this is used externally, I'd put a = 0 for t
lpromero
2015/02/04 13:33:36
They are considered as FOLDER.
| |
| 35 | |
| 20 // The vector is sorted in place. | 36 // The vector is sorted in place. |
| 21 // All of the bookmarks in |nodes| must be urls. | 37 // All of the bookmarks in |nodes| must be urls. |
| 22 void SortBookmarksByName(std::vector<const BookmarkNode*>& nodes); | 38 void SortBookmarksByName(std::vector<const BookmarkNode*>& nodes); |
| 23 | 39 |
| 24 // Returns the permanent nodes whose url children are considered uncategorized | 40 // Returns the permanent nodes whose url children are considered uncategorized |
| 25 // and whose folder children should be shown in the bookmark menu. | 41 // and whose folder children should be shown in the bookmark menu. |
| 26 // |model| must be loaded. | 42 // |model| must be loaded. |
| 27 std::vector<const BookmarkNode*> PrimaryPermanentNodes( | 43 std::vector<const BookmarkNode*> PrimaryPermanentNodes( |
| 28 bookmarks::BookmarkModel* model); | 44 bookmarks::BookmarkModel* model); |
| 29 | 45 |
| 30 // Returns an unsorted vector of folders that are considered to be at the "root" | 46 // 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 | 47 // level of the bookmark hierarchy. Functionally, this means all direct |
| 32 // descendants of PrimaryPermanentNodes. | 48 // descendants of PrimaryPermanentNodes. |
| 33 std::vector<const BookmarkNode*> RootLevelFolders( | 49 std::vector<const BookmarkNode*> RootLevelFolders( |
| 34 bookmarks::BookmarkModel* model); | 50 bookmarks::BookmarkModel* model); |
| 35 | 51 |
| 36 // Returns whether |node| is a primary permanent node in the sense of | 52 // Returns whether |node| is a primary permanent node in the sense of |
| 37 // |PrimaryPermanentNodes|. | 53 // |PrimaryPermanentNodes|. |
| 38 bool IsPrimaryPermanentNode(const BookmarkNode* node, | 54 bool IsPrimaryPermanentNode(const BookmarkNode* node, |
| 39 bookmarks::BookmarkModel* model); | 55 bookmarks::BookmarkModel* model); |
| 40 | 56 |
| 41 // Returns the root level folder in which this node is directly, or indirectly | 57 // Returns the root level folder in which this node is directly, or indirectly |
| 42 // via subfolders, located. | 58 // via subfolders, located. |
| 43 const BookmarkNode* RootLevelFolderForNode(const BookmarkNode* node, | 59 const BookmarkNode* RootLevelFolderForNode(const BookmarkNode* node, |
| 44 bookmarks::BookmarkModel* model); | 60 bookmarks::BookmarkModel* model); |
| 45 | 61 |
| 46 } // namespace enhanced_bookmarks | 62 } // namespace enhanced_bookmarks |
| 47 | 63 |
| 48 #endif // COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_UTILS_H_ | 64 #endif // COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_UTILS_H_ |
| OLD | NEW |