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

Unified Diff: chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc

Issue 7327010: Makes the bookmark menu show a separator before other bookmarks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc b/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc
index 14217002861123a07016b24fe64137e093cc5cb4..6a178f2c0a4e49cd545bb6f090087870673b2898 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc
@@ -25,6 +25,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/menu/menu_item_view.h"
+#include "views/controls/menu/submenu_view.h"
using views::MenuItemView;
@@ -61,9 +62,20 @@ void BookmarkMenuDelegate::Init(views::MenuDelegate* real_delegate,
real_delegate_ = real_delegate;
if (parent) {
parent_menu_item_ = parent;
+ int initial_count = parent->GetSubmenu() ?
+ parent->GetSubmenu()->GetMenuItemCount() : 0;
BuildMenu(node, start_child_index, parent, &next_menu_id_);
- if (show_options == SHOW_OTHER_FOLDER)
- BuildOtherFolderMenu(parent, &next_menu_id_);
+ if (show_options == SHOW_OTHER_FOLDER) {
+ const BookmarkNode* other_folder =
+ profile_->GetBookmarkModel()->other_node();
+ if (other_folder->child_count() > 0) {
+ int current_count = parent->GetSubmenu() ?
+ parent->GetSubmenu()->GetMenuItemCount() : 0;
+ if (current_count != initial_count)
+ parent->AppendSeparator();
+ BuildOtherFolderMenu(parent, &next_menu_id_);
+ }
+ }
} else {
menu_ = CreateMenu(node, start_child_index, show_options);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698