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

Unified Diff: views/controls/menu/menu_item_view.cc

Issue 7044016: Replace ButtonDropDown menu implementation (Menu2) with MenuItemView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: One last little style fix. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/controls/menu/menu_item_view.h ('k') | views/controls/menu/menu_model_adapter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/menu/menu_item_view.cc
diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc
index 4b251dfab3f58ee8a5759e0230cdacce1bcb9485..8c0e07e4a88e9ca298d2ed140b4332a523493dc9 100644
--- a/views/controls/menu/menu_item_view.cc
+++ b/views/controls/menu/menu_item_view.cc
@@ -36,7 +36,7 @@ namespace {
class EmptyMenuMenuItem : public MenuItemView {
public:
explicit EmptyMenuMenuItem(MenuItemView* parent)
- : MenuItemView(parent, 0, NORMAL) {
+ : MenuItemView(parent, 0, EMPTY) {
// Set this so that we're not identified as a normal menu item.
SetID(kEmptyMenuItemViewID);
SetTitle(UTF16ToWide(
@@ -136,6 +136,7 @@ void MenuItemView::GetAccessibleState(ui::AccessibleViewState* state) {
break;
case NORMAL:
case SEPARATOR:
+ case EMPTY:
// No additional accessibility states currently for these menu states.
break;
}
@@ -260,6 +261,7 @@ MenuItemView* MenuItemView::AddMenuItemAt(int index,
const std::wstring& label,
const SkBitmap& icon,
Type type) {
+ DCHECK_NE(type, EMPTY);
DCHECK_LE(0, index);
if (!submenu_)
CreateSubmenu();
@@ -563,9 +565,9 @@ void MenuItemView::Init(MenuItemView* parent,
has_icons_ = false;
// Don't request enabled status from the root menu item as it is just
- // a container for real items.
+ // a container for real items. EMPTY items will be disabled.
MenuDelegate* root_delegate = GetDelegate();
- if (parent && root_delegate)
+ if (parent && type != EMPTY && root_delegate)
SetEnabled(root_delegate->IsCommandEnabled(command));
}
« no previous file with comments | « views/controls/menu/menu_item_view.h ('k') | views/controls/menu/menu_model_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698