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

Unified Diff: components/enhanced_bookmarks/enhanced_bookmark_utils.h

Issue 452913002: First implementation of enhanced_bookmark_utils. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/enhanced_bookmarks.gypi ('k') | components/enhanced_bookmarks/enhanced_bookmark_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/enhanced_bookmarks/enhanced_bookmark_utils.h
diff --git a/components/enhanced_bookmarks/enhanced_bookmark_utils.h b/components/enhanced_bookmarks/enhanced_bookmark_utils.h
new file mode 100644
index 0000000000000000000000000000000000000000..54417e1b72d79424051b120f345df849551f4454
--- /dev/null
+++ b/components/enhanced_bookmarks/enhanced_bookmark_utils.h
@@ -0,0 +1,49 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_UTILS_H_
+#define COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_UTILS_H_
+
+#include <set>
+#include <string>
+#include <vector>
+
+class BookmarkModel;
+class BookmarkNode;
+
+namespace enhanced_bookmark_utils {
blundell 2014/08/08 13:39:09 oops, I had missed that this namespace should just
+
+// Returns an ordered vector of bookmarks that are urls that match |query|.
+// |query| must be UTF8 encoded.
+std::vector<const BookmarkNode*> FindBookmarksWithQuery(
+ BookmarkModel* bookmark_model,
+ const std::string& query);
+
+// The vector is sorted in place.
+// All of the bookmarks in |nodes| must be urls.
+void SortBookmarksByName(std::vector<const BookmarkNode*>& nodes);
+
+// Returns the permanent nodes whose url children are considered uncategorized
+// and whose folder children should be shown in the bookmark menu.
+// |model| must be loaded.
+std::vector<const BookmarkNode*> PrimaryPermanentNodes(BookmarkModel* model);
+
+// Returns an unsorted vector of folders that are considered to be at the "root"
+// level of the bookmark hierarchy. Functionally, this means all direct
+// descendants of PrimaryPermanentNodes, and possibly a node for the bookmarks
+// bar.
+std::vector<const BookmarkNode*> RootLevelFolders(BookmarkModel* model);
+
+// Returns whether |node| is a primary permanent node in the sense of
+// |PrimaryPermanentNodes|.
+bool IsPrimaryPermanentNode(const BookmarkNode* node, BookmarkModel* model);
+
+// Returns the root level folder in which this node is directly, or indirectly
+// via subfolders, located.
+const BookmarkNode* RootLevelFolderForNode(const BookmarkNode* node,
+ BookmarkModel* model);
+
+} // namespace enhanced_bookmark_utils
+
+#endif // COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_UTILS_H_
« no previous file with comments | « components/enhanced_bookmarks.gypi ('k') | components/enhanced_bookmarks/enhanced_bookmark_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698