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

Side by Side Diff: chrome/browser/ui/views/wrench_menu.cc

Issue 7076027: Couple more wrench menu issues. The patch I sent around a couple of (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Makes unit test compile Created 9 years, 7 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/wrench_menu.h" 5 #include "chrome/browser/ui/views/wrench_menu.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 MenuDelegate::GetDragOperations(sender); 686 MenuDelegate::GetDragOperations(sender);
687 } 687 }
688 688
689 int WrenchMenu::GetMaxWidthForMenu(MenuItemView* menu) { 689 int WrenchMenu::GetMaxWidthForMenu(MenuItemView* menu) {
690 return is_bookmark_command(menu->GetCommand()) ? 690 return is_bookmark_command(menu->GetCommand()) ?
691 bookmark_menu_delegate_->GetMaxWidthForMenu(menu) : 691 bookmark_menu_delegate_->GetMaxWidthForMenu(menu) :
692 MenuDelegate::GetMaxWidthForMenu(menu); 692 MenuDelegate::GetMaxWidthForMenu(menu);
693 } 693 }
694 694
695 bool WrenchMenu::IsItemChecked(int id) const { 695 bool WrenchMenu::IsItemChecked(int id) const {
696 if (!is_bookmark_command(id)) 696 if (is_bookmark_command(id))
697 return false; 697 return false;
698 698
699 const Entry& entry = id_to_entry_.find(id)->second; 699 const Entry& entry = id_to_entry_.find(id)->second;
700 return entry.first->IsItemCheckedAt(entry.second); 700 return entry.first->IsItemCheckedAt(entry.second);
701 } 701 }
702 702
703 bool WrenchMenu::IsCommandEnabled(int id) const { 703 bool WrenchMenu::IsCommandEnabled(int id) const {
704 if (is_bookmark_command(id)) 704 if (is_bookmark_command(id))
705 return true; 705 return true;
706 706
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 menu_accelerator.modifiers()); 755 menu_accelerator.modifiers());
756 return true; 756 return true;
757 } 757 }
758 758
759 void WrenchMenu::WillShowMenu(MenuItemView* menu) { 759 void WrenchMenu::WillShowMenu(MenuItemView* menu) {
760 if (menu == bookmark_menu_) 760 if (menu == bookmark_menu_)
761 CreateBookmarkMenu(); 761 CreateBookmarkMenu();
762 } 762 }
763 763
764 void WrenchMenu::BookmarkModelChanged() { 764 void WrenchMenu::BookmarkModelChanged() {
765 root_->Cancel(); 765 DCHECK(bookmark_menu_delegate_.get());
766 if (!bookmark_menu_delegate_->is_mutating_model())
767 root_->Cancel();
766 } 768 }
767 769
768 WrenchMenu::~WrenchMenu() { 770 WrenchMenu::~WrenchMenu() {
769 } 771 }
770 772
771 void WrenchMenu::PopulateMenu(MenuItemView* parent, 773 void WrenchMenu::PopulateMenu(MenuItemView* parent,
772 MenuModel* model, 774 MenuModel* model,
773 int* next_id) { 775 int* next_id) {
774 int index_offset = model->GetFirstItemIndex(NULL); 776 int index_offset = model->GetFirstItemIndex(NULL);
775 for (int i = 0, max = model->GetItemCount(); i < max; ++i) { 777 for (int i = 0, max = model->GetItemCount(); i < max; ++i) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 model->AddObserver(this); 857 model->AddObserver(this);
856 bookmark_menu_delegate_.reset( 858 bookmark_menu_delegate_.reset(
857 new BookmarkMenuDelegate(browser_->profile(), 859 new BookmarkMenuDelegate(browser_->profile(),
858 NULL, 860 NULL,
859 browser_->window()->GetNativeHandle(), 861 browser_->window()->GetNativeHandle(),
860 first_bookmark_command_id_)); 862 first_bookmark_command_id_));
861 bookmark_menu_delegate_->Init( 863 bookmark_menu_delegate_->Init(
862 this, bookmark_menu_, model->GetBookmarkBarNode(), 0, 864 this, bookmark_menu_, model->GetBookmarkBarNode(), 0,
863 BookmarkMenuDelegate::SHOW_OTHER_FOLDER); 865 BookmarkMenuDelegate::SHOW_OTHER_FOLDER);
864 } 866 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc ('k') | views/controls/menu/menu_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698