diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-20 00:14:13 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-20 00:14:13 +0000 |
commit | 1ed23e569ff71b26d70b5f02a59fa3a621b3620b (patch) | |
tree | 40b13e70da052d1c781856e0d74c33aac7abdcb2 /chrome/browser/bookmarks | |
parent | 096724916756e0eaec9b3e65bad9d929cfb9ffd4 (diff) | |
download | chromium_src-1ed23e569ff71b26d70b5f02a59fa3a621b3620b.zip chromium_src-1ed23e569ff71b26d70b5f02a59fa3a621b3620b.tar.gz chromium_src-1ed23e569ff71b26d70b5f02a59fa3a621b3620b.tar.bz2 |
bookmarks: Move NodeHasURLs function to bookmark_utils.
So it can be shared by all platforms.
BUG=35020
TEST=trybots
Review URL: http://codereview.chromium.org/4981001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66849 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks')
-rw-r--r-- | chrome/browser/bookmarks/bookmark_context_menu_controller.cc | 19 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_utils.cc | 13 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_utils.h | 4 |
3 files changed, 18 insertions, 18 deletions
diff --git a/chrome/browser/bookmarks/bookmark_context_menu_controller.cc b/chrome/browser/bookmarks/bookmark_context_menu_controller.cc index a4af97d..e177ed2 100644 --- a/chrome/browser/bookmarks/bookmark_context_menu_controller.cc +++ b/chrome/browser/bookmarks/bookmark_context_menu_controller.cc @@ -19,23 +19,6 @@ #include "chrome/common/pref_names.h" #include "grit/generated_resources.h" -namespace { - -// Returns true if the specified node is of type URL, or has a descendant -// of type URL. -bool NodeHasURLs(const BookmarkNode* node) { - if (node->is_url()) - return true; - - for (int i = 0; i < node->GetChildCount(); ++i) { - if (NodeHasURLs(node->GetChild(i))) - return true; - } - return false; -} - -} // namespace - BookmarkContextMenuController::BookmarkContextMenuController( gfx::NativeWindow parent_window, BookmarkContextMenuControllerDelegate* delegate, @@ -302,7 +285,7 @@ void BookmarkContextMenuController::BookmarkModelChanged() { bool BookmarkContextMenuController::HasURLs() const { for (size_t i = 0; i < selection_.size(); ++i) { - if (NodeHasURLs(selection_[i])) + if (bookmark_utils::NodeHasURLs(selection_[i])) return true; } return false; diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc index b89463d..d01b42d 100644 --- a/chrome/browser/bookmarks/bookmark_utils.cc +++ b/chrome/browser/bookmarks/bookmark_utils.cc @@ -654,4 +654,17 @@ const BookmarkNode* GetParentForNewNodes( return real_parent; } +bool NodeHasURLs(const BookmarkNode* node) { + DCHECK(node); + + if (node->is_url()) + return true; + + for (int i = 0; i < node->GetChildCount(); ++i) { + if (NodeHasURLs(node->GetChild(i))) + return true; + } + return false; +} + } // namespace bookmark_utils diff --git a/chrome/browser/bookmarks/bookmark_utils.h b/chrome/browser/bookmarks/bookmark_utils.h index adbe74e..0aac72c 100644 --- a/chrome/browser/bookmarks/bookmark_utils.h +++ b/chrome/browser/bookmarks/bookmark_utils.h @@ -203,6 +203,10 @@ const BookmarkNode* GetParentForNewNodes( const std::vector<const BookmarkNode*>& selection, int* index); +// Returns true if the specified node is of type URL, or has a descendant +// of type URL. +bool NodeHasURLs(const BookmarkNode* node); + // Number of bookmarks we'll open before prompting the user to see if they // really want to open all. // |