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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/bookmarks/bookmark_model.h" | 8 #include "chrome/browser/bookmarks/bookmark_model.h" |
9 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 9 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
10 #include "chrome/browser/bookmarks/bookmark_utils.h" | 10 #include "chrome/browser/bookmarks/bookmark_utils.h" |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 392 |
393 void BookmarkMenuDelegate::BuildOtherFolderMenu( | 393 void BookmarkMenuDelegate::BuildOtherFolderMenu( |
394 MenuItemView* menu, int* next_menu_id) { | 394 MenuItemView* menu, int* next_menu_id) { |
395 const BookmarkNode* other_folder = profile_->GetBookmarkModel()->other_node(); | 395 const BookmarkNode* other_folder = profile_->GetBookmarkModel()->other_node(); |
396 int id = *next_menu_id; | 396 int id = *next_menu_id; |
397 (*next_menu_id)++; | 397 (*next_menu_id)++; |
398 SkBitmap* folder_icon = ResourceBundle::GetSharedInstance(). | 398 SkBitmap* folder_icon = ResourceBundle::GetSharedInstance(). |
399 GetBitmapNamed(IDR_BOOKMARK_BAR_FOLDER); | 399 GetBitmapNamed(IDR_BOOKMARK_BAR_FOLDER); |
400 MenuItemView* submenu = menu->AppendSubMenuWithIcon( | 400 MenuItemView* submenu = menu->AppendSubMenuWithIcon( |
401 id, UTF16ToWide( | 401 id, UTF16ToWide( |
402 l10n_util::GetStringUTF16(IDS_BOOMARK_BAR_OTHER_BOOKMARKED)), | 402 l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_OTHER_BOOKMARKED)), |
403 *folder_icon); | 403 *folder_icon); |
404 BuildMenu(other_folder, 0, submenu, next_menu_id); | 404 BuildMenu(other_folder, 0, submenu, next_menu_id); |
405 menu_id_to_node_map_[id] = other_folder; | 405 menu_id_to_node_map_[id] = other_folder; |
406 } | 406 } |
407 | 407 |
408 void BookmarkMenuDelegate::BuildMenu(const BookmarkNode* parent, | 408 void BookmarkMenuDelegate::BuildMenu(const BookmarkNode* parent, |
409 int start_child_index, | 409 int start_child_index, |
410 MenuItemView* menu, | 410 MenuItemView* menu, |
411 int* next_menu_id) { | 411 int* next_menu_id) { |
412 DCHECK(parent->empty() || start_child_index < parent->child_count()); | 412 DCHECK(parent->empty() || start_child_index < parent->child_count()); |
(...skipping 27 matching lines...) Expand all Loading... |
440 MenuItemView* BookmarkMenuDelegate::GetMenuByID(int id) { | 440 MenuItemView* BookmarkMenuDelegate::GetMenuByID(int id) { |
441 for (NodeToMenuMap::const_iterator i = node_to_menu_map_.begin(); | 441 for (NodeToMenuMap::const_iterator i = node_to_menu_map_.begin(); |
442 i != node_to_menu_map_.end(); ++i) { | 442 i != node_to_menu_map_.end(); ++i) { |
443 MenuItemView* menu = i->second->GetMenuItemByID(id); | 443 MenuItemView* menu = i->second->GetMenuItemByID(id); |
444 if (menu) | 444 if (menu) |
445 return menu; | 445 return menu; |
446 } | 446 } |
447 | 447 |
448 return parent_menu_item_ ? parent_menu_item_->GetMenuItemByID(id) : NULL; | 448 return parent_menu_item_ ? parent_menu_item_->GetMenuItemByID(id) : NULL; |
449 } | 449 } |
OLD | NEW |