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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc

Issue 7483003: Removed separator in bookmarks sub-menu if there are no bookmarks or folders to display (only fix... (Closed) Base URL: http://src.chromium.org/svn/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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_menu_model.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/bookmarks/bookmark_model.h" 9 #include "chrome/browser/bookmarks/bookmark_model.h"
10 #include "chrome/browser/bookmarks/bookmark_node_data.h" 10 #include "chrome/browser/bookmarks/bookmark_node_data.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 MenuItemView* parent, 57 MenuItemView* parent,
58 const BookmarkNode* node, 58 const BookmarkNode* node,
59 int start_child_index, 59 int start_child_index,
60 ShowOptions show_options) { 60 ShowOptions show_options) {
61 profile_->GetBookmarkModel()->AddObserver(this); 61 profile_->GetBookmarkModel()->AddObserver(this);
62 real_delegate_ = real_delegate; 62 real_delegate_ = real_delegate;
63 if (parent) { 63 if (parent) {
64 parent_menu_item_ = parent; 64 parent_menu_item_ = parent;
65 int initial_count = parent->GetSubmenu() ? 65 int initial_count = parent->GetSubmenu() ?
66 parent->GetSubmenu()->GetMenuItemCount() : 0; 66 parent->GetSubmenu()->GetMenuItemCount() : 0;
67 if ((start_child_index < node->child_count()) &&
68 (initial_count > 0)) {
69 parent->AppendSeparator();
70 }
67 BuildMenu(node, start_child_index, parent, &next_menu_id_); 71 BuildMenu(node, start_child_index, parent, &next_menu_id_);
68 if (show_options == SHOW_OTHER_FOLDER) { 72 if (show_options == SHOW_OTHER_FOLDER) {
69 const BookmarkNode* other_folder = 73 const BookmarkNode* other_folder =
70 profile_->GetBookmarkModel()->other_node(); 74 profile_->GetBookmarkModel()->other_node();
71 if (other_folder->child_count() > 0) { 75 if (!other_folder->empty()) {
72 int current_count = parent->GetSubmenu() ? 76 parent->AppendSeparator();
73 parent->GetSubmenu()->GetMenuItemCount() : 0;
74 if (current_count != initial_count)
75 parent->AppendSeparator();
76 BuildOtherFolderMenu(parent, &next_menu_id_); 77 BuildOtherFolderMenu(parent, &next_menu_id_);
77 } 78 }
78 } 79 }
79 } else { 80 } else {
80 menu_ = CreateMenu(node, start_child_index, show_options); 81 menu_ = CreateMenu(node, start_child_index, show_options);
81 } 82 }
82 } 83 }
83 84
84 void BookmarkMenuDelegate::SetActiveMenu(const BookmarkNode* node, 85 void BookmarkMenuDelegate::SetActiveMenu(const BookmarkNode* node,
85 int start_index) { 86 int start_index) {
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 break; 442 break;
442 } 443 }
443 } 444 }
444 if (ancestor_removed) { 445 if (ancestor_removed) {
445 node_to_menu_id_map_.erase(i++); 446 node_to_menu_id_map_.erase(i++);
446 } else { 447 } else {
447 ++i; 448 ++i;
448 } 449 }
449 } 450 }
450 } 451 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_menu_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698