Index: components/bookmarks/browser/bookmark_utils.cc |
diff --git a/components/bookmarks/browser/bookmark_utils.cc b/components/bookmarks/browser/bookmark_utils.cc |
index cda6cd3f49ca092683667f31cc93fda2272b9463..7199ad5c6332400c87d051e716d2eda1fd7516ac 100644 |
--- a/components/bookmarks/browser/bookmark_utils.cc |
+++ b/components/bookmarks/browser/bookmark_utils.cc |
@@ -510,4 +510,18 @@ const BookmarkNode* GetBookmarkNodeByID(const BookmarkModel* model, int64 id) { |
return GetNodeByID(model->root_node(), id); |
} |
+bool IsDescendantOf(const bookmarks::BookmarkNode* node, |
+ const bookmarks::BookmarkNode* root) { |
+ return node && node->HasAncestor(root); |
+} |
+ |
+bool HasDescendantsOf(const std::vector<const bookmarks::BookmarkNode*>& list, |
+ const bookmarks::BookmarkNode* root) { |
+ for (const BookmarkNode* node : list) { |
+ if (IsDescendantOf(node, root)) |
+ return true; |
+ } |
+ return false; |
+} |
+ |
} // namespace bookmarks |