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

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
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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 BuildMenu(other_folder, 0, submenu, next_menu_id); 351 BuildMenu(other_folder, 0, submenu, next_menu_id);
352 menu_id_to_node_map_[id] = other_folder; 352 menu_id_to_node_map_[id] = other_folder;
353 } 353 }
354 354
355 void BookmarkMenuDelegate::BuildMenu(const BookmarkNode* parent, 355 void BookmarkMenuDelegate::BuildMenu(const BookmarkNode* parent,
356 int start_child_index, 356 int start_child_index,
357 MenuItemView* menu, 357 MenuItemView* menu,
358 int* next_menu_id) { 358 int* next_menu_id) {
359 DCHECK(!parent->child_count() || 359 DCHECK(!parent->child_count() ||
360 start_child_index < parent->child_count()); 360 start_child_index < parent->child_count());
361
362 if ((start_child_index < parent->child_count()) &&
363 (parent == profile_->GetBookmarkModel()->GetBookmarkBarNode())) {
364 menu->AppendSeparator();
365 }
366
Roger Tawa OOO till Jul 10th 2011/07/21 20:41:48 I think it would be better to check if the menu ar
Roger Tawa OOO till Jul 10th 2011/07/21 20:43:54 Sorry, meant to say "one or more children", not "m
361 for (int i = start_child_index; i < parent->child_count(); ++i) { 367 for (int i = start_child_index; i < parent->child_count(); ++i) {
362 const BookmarkNode* node = parent->GetChild(i); 368 const BookmarkNode* node = parent->GetChild(i);
363 int id = *next_menu_id; 369 int id = *next_menu_id;
364 370
365 (*next_menu_id)++; 371 (*next_menu_id)++;
366 if (node->is_url()) { 372 if (node->is_url()) {
367 SkBitmap icon = profile_->GetBookmarkModel()->GetFavicon(node); 373 SkBitmap icon = profile_->GetBookmarkModel()->GetFavicon(node);
368 if (icon.width() == 0) { 374 if (icon.width() == 0) {
369 icon = *ResourceBundle::GetSharedInstance(). 375 icon = *ResourceBundle::GetSharedInstance().
370 GetBitmapNamed(IDR_DEFAULT_FAVICON); 376 GetBitmapNamed(IDR_DEFAULT_FAVICON);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 break; 447 break;
442 } 448 }
443 } 449 }
444 if (ancestor_removed) { 450 if (ancestor_removed) {
445 node_to_menu_id_map_.erase(i++); 451 node_to_menu_id_map_.erase(i++);
446 } else { 452 } else {
447 ++i; 453 ++i;
448 } 454 }
449 } 455 }
450 } 456 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698