Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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()) && | |
|
sky
2011/07/22 21:09:09
Couple of problems with this:
I don't like putting
| |
| 363 (menu->GetSubmenu()->GetMenuItemCount() > 0)) { | |
| 364 menu->AppendSeparator(); | |
| 365 } | |
| 366 | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |