summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/bookmarks/bookmark_context_menu_controller.cc19
-rw-r--r--chrome/browser/bookmarks/bookmark_utils.cc13
-rw-r--r--chrome/browser/bookmarks/bookmark_utils.h4
-rw-r--r--chrome/browser/ui/views/bookmark_context_menu_controller_views.cc19
4 files changed, 19 insertions, 36 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.
//
diff --git a/chrome/browser/ui/views/bookmark_context_menu_controller_views.cc b/chrome/browser/ui/views/bookmark_context_menu_controller_views.cc
index 3a5bec8..1c83a3f 100644
--- a/chrome/browser/ui/views/bookmark_context_menu_controller_views.cc
+++ b/chrome/browser/ui/views/bookmark_context_menu_controller_views.cc
@@ -18,23 +18,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
-
BookmarkContextMenuControllerViews::BookmarkContextMenuControllerViews(
gfx::NativeWindow parent_window,
BookmarkContextMenuControllerViewsDelegate* delegate,
@@ -285,7 +268,7 @@ BookmarkModel* BookmarkContextMenuControllerViews::RemoveModelObserver() {
bool BookmarkContextMenuControllerViews::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;