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

Unified Diff: ui/views/controls/menu/menu_model_adapter.cc

Issue 423833002: Check if the delegate changed the visibility of child MenuItemViews. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added MenuModelAdapter::IsCommandVisible Created 6 years, 5 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 | « ui/views/controls/menu/menu_model_adapter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/menu_model_adapter.cc
diff --git a/ui/views/controls/menu/menu_model_adapter.cc b/ui/views/controls/menu/menu_model_adapter.cc
index 18c426996eb7cd2304c81e90cbeb471f63faf56b..55c5d7d21d9d16a450caeb49fddcdd8bd10ca3ae 100644
--- a/ui/views/controls/menu/menu_model_adapter.cc
+++ b/ui/views/controls/menu/menu_model_adapter.cc
@@ -205,6 +205,16 @@ bool MenuModelAdapter::IsCommandEnabled(int id) const {
return false;
}
+bool MenuModelAdapter::IsCommandVisible(int id) const {
+ ui::MenuModel* model = menu_model_;
+ int index = 0;
+ if (ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index))
+ return model->IsVisibleAt(index);
+
+ NOTREACHED();
+ return false;
+}
+
bool MenuModelAdapter::IsItemChecked(int id) const {
ui::MenuModel* model = menu_model_;
int index = 0;
@@ -265,9 +275,6 @@ void MenuModelAdapter::BuildMenuImpl(MenuItemView* menu, ui::MenuModel* model) {
for (int i = 0; i < item_count; ++i) {
MenuItemView* item = AppendMenuItem(menu, model, i);
- if (item)
- item->SetVisible(model->IsVisibleAt(i));
-
if (model->GetTypeAt(i) == ui::MenuModel::TYPE_SUBMENU) {
DCHECK(item);
DCHECK_EQ(MenuItemView::SUBMENU, item->GetType());
« no previous file with comments | « ui/views/controls/menu/menu_model_adapter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698