summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-25 16:25:09 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-25 16:25:09 +0000
commit199c68e2b33c9b3b5a25177006c0fb371f2e0be1 (patch)
tree8be8192696e9e595585a35dc0a22f7dbe7cef607 /views
parentf232a7f4e57fc85cb529c3aa18744b5972b79ee3 (diff)
downloadchromium_src-199c68e2b33c9b3b5a25177006c0fb371f2e0be1.zip
chromium_src-199c68e2b33c9b3b5a25177006c0fb371f2e0be1.tar.gz
chromium_src-199c68e2b33c9b3b5a25177006c0fb371f2e0be1.tar.bz2
Fixes couple of issues with bookmarks in wrench menu:
. Crash when deleting via context menu. This was happening because BookmarkMenuDelegate didn't keep a handle to the menu item it added the items to. . If other bookmarks folder is empty it wouldn't show a menu item for (empty). . Deleting the last item in the other folder would prematurely close the menu. . Hit DCHECK when adding empty menu (long standing issue). BUG=83746 TEST=from the wrench menu on windows right click a bookmark, delete it, and make sure you don't crash. R=ben@chromium.org Review URL: http://codereview.chromium.org/7066034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86634 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/menu/menu_item_view.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc
index a914f40..1978951e 100644
--- a/views/controls/menu/menu_item_view.cc
+++ b/views/controls/menu/menu_item_view.cc
@@ -37,10 +37,10 @@ class EmptyMenuMenuItem : public MenuItemView {
public:
explicit EmptyMenuMenuItem(MenuItemView* parent)
: MenuItemView(parent, 0, NORMAL) {
- SetTitle(UTF16ToWide(
- l10n_util::GetStringUTF16(IDS_APP_MENU_EMPTY_SUBMENU)));
// Set this so that we're not identified as a normal menu item.
SetID(kEmptyMenuItemViewID);
+ SetTitle(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_APP_MENU_EMPTY_SUBMENU)));
SetEnabled(false);
}
@@ -738,6 +738,11 @@ int MenuItemView::GetChildPreferredWidth() {
}
string16 MenuItemView::GetAcceleratorText() {
+ if (GetID() == kEmptyMenuItemViewID) {
+ // Don't query the delegate for menus that represent no children.
+ return string16();
+ }
+
Accelerator accelerator;
return (GetDelegate() &&
GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ?